diff --git a/composer.json b/composer.json index c5bc030c8eb..e6df9a4c5e4 100644 --- a/composer.json +++ b/composer.json @@ -77,7 +77,7 @@ "pint", "npm run prettier" ], - "pint": "pint --config pint-strict-imports.json", + "pint": "pint", "test:pest": "pest --parallel", "test:phpstan": "phpstan analyse", "test": [ diff --git a/packages/upgrade/src/Rector/SimpleMethodChangesRector.php b/packages/upgrade/src/Rector/FixMethodsRector.php similarity index 86% rename from packages/upgrade/src/Rector/SimpleMethodChangesRector.php rename to packages/upgrade/src/Rector/FixMethodsRector.php index 7a54b459676..0f760224884 100644 --- a/packages/upgrade/src/Rector/SimpleMethodChangesRector.php +++ b/packages/upgrade/src/Rector/FixMethodsRector.php @@ -6,9 +6,13 @@ use Filament\Pages\Dashboard; use Filament\Pages\Page; use Filament\Resources\Pages\CreateRecord; +use Filament\Schemas\Components\Component; use PhpParser\Modifiers; use PhpParser\Node; +use PhpParser\Node\Expr\ConstFetch; +use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; +use PhpParser\Node\Name; use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; @@ -19,7 +23,7 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; -class SimpleMethodChangesRector extends AbstractRector +class FixMethodsRector extends AbstractRector { protected VariableRenamer $variableRenamer; @@ -74,6 +78,19 @@ public function getChanges(): array }, ], ], + [ + 'class' => [ + Component::class, + ], + 'changes' => [ + 'getChildComponents' => function (ClassMethod $node): void { + $param = new Param(new Variable('slot'), default: new ConstFetch(new Name('null'))); + $param->type = new Name('?string'); + + $node->params = [$param]; + }, + ], + ], ]; } diff --git a/packages/upgrade/src/Rector/SimplePropertyChangesRector.php b/packages/upgrade/src/Rector/FixPropertiesRector.php similarity index 99% rename from packages/upgrade/src/Rector/SimplePropertyChangesRector.php rename to packages/upgrade/src/Rector/FixPropertiesRector.php index 143615be772..470ebe3fe16 100644 --- a/packages/upgrade/src/Rector/SimplePropertyChangesRector.php +++ b/packages/upgrade/src/Rector/FixPropertiesRector.php @@ -22,7 +22,7 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; -class SimplePropertyChangesRector extends AbstractRector +class FixPropertiesRector extends AbstractRector { /** * @return arrayrules([ - Rector\SimpleMethodChangesRector::class, - Rector\SimplePropertyChangesRector::class, + Rector\FixMethodsRector::class, + Rector\FixPropertiesRector::class, Rector\RenameSchemaParamToMatchTypeRector::class, ]); $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [ new MethodCallRename(Schema::class, 'schema', 'components'), + new MethodCallRename(ImageColumn::class, 'height', 'imageHeight'), + new MethodCallRename(ImageColumn::class, 'width', 'imageWidth'), + new MethodCallRename(ImageEntry::class, 'height', 'imageHeight'), + new MethodCallRename(ImageEntry::class, 'width', 'imageWidth'), ]); }; diff --git a/pint-strict-imports.json b/pint-strict-imports.json deleted file mode 100644 index 4e54320d7ce..00000000000 --- a/pint-strict-imports.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "preset": "laravel", - "rules": { - "blank_line_before_statement": true, - "concat_space": { - "spacing": "one" - }, - "fully_qualified_strict_types": { - "import_symbols": true - }, - "method_argument_space": true, - "single_trait_insert_per_statement": true, - "types_spaces": { - "space": "single" - } - } -} diff --git a/pint.json b/pint.json index c6ddb4940cf..580e983cdbb 100644 --- a/pint.json +++ b/pint.json @@ -5,6 +5,10 @@ "concat_space": { "spacing": "one" }, + "fully_qualified_strict_types": { + "import_symbols": true + }, + "global_namespace_import": true, "method_argument_space": true, "single_trait_insert_per_statement": true, "types_spaces": {