From cb096cbffb5e01db226fc84951956d85da081bf1 Mon Sep 17 00:00:00 2001 From: MGatner Date: Sat, 2 Mar 2024 13:23:51 +0000 Subject: [PATCH 1/3] Ignore removed files --- src/Bundles/DataTablesBundle.php | 8 +++++++- src/Publishers/DataTablesStylePublisher.php | 1 - tests/BundlesTest.php | 1 - tests/PublishersTest.php | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Bundles/DataTablesBundle.php b/src/Bundles/DataTablesBundle.php index f71cc8b..6443841 100644 --- a/src/Bundles/DataTablesBundle.php +++ b/src/Bundles/DataTablesBundle.php @@ -2,6 +2,7 @@ namespace Tatter\Frontend\Bundles; +use CodeIgniter\Files\Exceptions\FileNotFoundException; use Tatter\Frontend\FrontendBundle; class DataTablesBundle extends FrontendBundle @@ -11,8 +12,13 @@ class DataTablesBundle extends FrontendBundle */ 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 + } + $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()); diff --git a/src/Publishers/DataTablesStylePublisher.php b/src/Publishers/DataTablesStylePublisher.php index 228c2fb..30bdba9 100644 --- a/src/Publishers/DataTablesStylePublisher.php +++ b/src/Publishers/DataTablesStylePublisher.php @@ -18,7 +18,6 @@ public function publish(): bool { return $this ->addPath('css') - ->addPath('images') ->addPath('js') ->addPath('types') ->removePattern('*.ts') diff --git a/tests/BundlesTest.php b/tests/BundlesTest.php index 9a2b0c4..ea47aa9 100644 --- a/tests/BundlesTest.php +++ b/tests/BundlesTest.php @@ -42,7 +42,6 @@ public function bundleProvider(): array [ 'bootstrap.bundle.min.js', 'dataTables.bootstrap4.min.js', - 'jquery.dataTables.min.js', ], ], [ diff --git a/tests/PublishersTest.php b/tests/PublishersTest.php index 98530ef..96db4f0 100644 --- a/tests/PublishersTest.php +++ b/tests/PublishersTest.php @@ -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', ], ], From 61a55b5363e9080eb4639743972d3b1e55e5f047 Mon Sep 17 00:00:00 2001 From: MGatner Date: Sat, 2 Mar 2024 13:25:49 +0000 Subject: [PATCH 2/3] Update Rector config --- rector.php | 14 ++++++++++++-- src/Test/PublishersTestCase.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/rector.php b/rector.php index 17204be..2abf5af 100644 --- a/rector.php +++ b/rector.php @@ -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; @@ -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; @@ -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([ @@ -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, diff --git a/src/Test/PublishersTestCase.php b/src/Test/PublishersTestCase.php index 9dd2236..1d68f5f 100644 --- a/src/Test/PublishersTestCase.php +++ b/src/Test/PublishersTestCase.php @@ -14,7 +14,7 @@ abstract class PublishersTestCase extends CIUnitTestCase * @dataProvider publisherProvider * * @param class-string $class - * @param string[] $expected + * @param list $expected */ public function testPublishesFiles(string $class, array $expected): void { From 0c6072e2ac132dc55fcba7c5a9decf79ff9959b1 Mon Sep 17 00:00:00 2001 From: MGatner Date: Sat, 2 Mar 2024 13:42:06 +0000 Subject: [PATCH 3/3] Remove module files --- src/Publishers/DataTablesStylePublisher.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Publishers/DataTablesStylePublisher.php b/src/Publishers/DataTablesStylePublisher.php index 30bdba9..676fa00 100644 --- a/src/Publishers/DataTablesStylePublisher.php +++ b/src/Publishers/DataTablesStylePublisher.php @@ -21,6 +21,7 @@ public function publish(): bool ->addPath('js') ->addPath('types') ->removePattern('*.ts') + ->removePattern('*.mjs') ->merge(true); } }