Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Fix missing file in bundle #35

Merged
merged 3 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
Expand All @@ -14,12 +15,12 @@
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector;
use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
Expand All @@ -35,7 +36,10 @@
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
Expand Down Expand Up @@ -112,10 +116,16 @@
$rectorConfig->rule(FuncGetArgsToVariadicParamRector::class);
$rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class);
$rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
$rectorConfig->rule(SimplifyEmptyCheckOnEmptyArrayRector::class);
$rectorConfig->rule(TernaryEmptyArrayArrayDimFetchToCoalesceRector::class);
$rectorConfig->rule(EmptyOnNullableObjectToInstanceOfRector::class);
$rectorConfig->rule(DisallowedEmptyRuleFixerRector::class);
$rectorConfig
->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [
/**
* The INLINE_PUBLIC value is default to false to avoid BC break, if you use for libraries and want to preserve BC break, you don't need to configure it, as it included in LevelSetList::UP_TO_PHP_74
* The INLINE_PUBLIC value is default to false to avoid BC break,
* if you use for libraries and want to preserve BC break, you don't
* need to configure it, as it included in LevelSetList::UP_TO_PHP_74
* Set to true for projects that allow BC break
*/
TypedPropertyFromAssignsRector::INLINE_PUBLIC => true,
Expand Down
8 changes: 7 additions & 1 deletion src/Bundles/DataTablesBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tatter\Frontend\Bundles;

use CodeIgniter\Files\Exceptions\FileNotFoundException;
use Tatter\Frontend\FrontendBundle;

class DataTablesBundle extends FrontendBundle
Expand All @@ -11,8 +12,13 @@
*/
protected function define(): void
{
try {
$this->addPath('datatables/js/jquery.dataTables.min.js');

Check warning on line 16 in src/Bundles/DataTablesBundle.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ protected function define() : void { try { - $this->addPath('datatables/js/jquery.dataTables.min.js'); + } catch (FileNotFoundException) { // this seems to have been removed in some DataTables release }
} catch (FileNotFoundException) {
// this seems to have been removed in some DataTables release
}

$this
->addPath('datatables/js/jquery.dataTables.min.js')
->addPath('datatables/js/dataTables.bootstrap4.min.js')
->addPath('datatables/css/dataTables.bootstrap4.min.css')
->merge(new BootstrapBundle());
Expand Down
2 changes: 1 addition & 1 deletion src/Publishers/DataTablesStylePublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public function publish(): bool
{
return $this
->addPath('css')
->addPath('images')
->addPath('js')
->addPath('types')
->removePattern('*.ts')
->removePattern('*.mjs')
->merge(true);
}
}
2 changes: 1 addition & 1 deletion src/Test/PublishersTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class PublishersTestCase extends CIUnitTestCase
* @dataProvider publisherProvider
*
* @param class-string<FrontendPublisher> $class
* @param string[] $expected
* @param list<string> $expected
*/
public function testPublishesFiles(string $class, array $expected): void
{
Expand Down
1 change: 0 additions & 1 deletion tests/BundlesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function bundleProvider(): array
[
'bootstrap.bundle.min.js',
'dataTables.bootstrap4.min.js',
'jquery.dataTables.min.js',
],
],
[
Expand Down
3 changes: 1 addition & 2 deletions tests/PublishersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ public function publisherProvider(): array
[
DataTablesPublisher::class,
[
'datatables/js/jquery.dataTables.js',
'datatables/js/dataTables.min.js',
],
],
[
DataTablesStylePublisher::class,
[
'datatables/css/dataTables.bootstrap4.min.css',
'datatables/images/sort_asc_disabled.png',
'datatables/js/dataTables.bootstrap4.js',
],
],
Expand Down
Loading