diff --git a/composer.json b/composer.json index 2872f9d..886485f 100644 --- a/composer.json +++ b/composer.json @@ -15,13 +15,13 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "phpstan/extension-installer": "^1.3.1", - "phpstan/phpstan": "^1.10.56", + "phpstan/phpstan": "^1.10.58", "phpstan/phpstan-deprecation-rules": "^1.1.4", "phpstan/phpstan-strict-rules": "^1.5.2", - "rector/rector": "^0.19.2", + "rector/rector": "^1.0.1", "roave/security-advisories": "dev-latest", "sentry/sentry": "^3.22.1", - "symfony/http-client": "^6.4.2" + "symfony/http-client": "^6.4.3" }, "license": "MIT", "authors": [ diff --git a/rector.php b/rector.php index c7ab87e..d60fd3e 100644 --- a/rector.php +++ b/rector.php @@ -2,30 +2,39 @@ declare(strict_types=1); +use Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector; +use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector; use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\Config\RectorConfig; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php80\Rector\FunctionLike\MixedTypeRector; -use Rector\Set\ValueObject\LevelSetList; -use Rector\Set\ValueObject\SetList; -return static function (RectorConfig $rectorConfig): void { - $rectorConfig->paths([ +return RectorConfig::configure() + ->withPhpSets() + ->withPreparedSets( + codeQuality: true, + ) + ->withAttributesSets( + symfony: true, + doctrine: true, + ) + ->withPaths([ __DIR__ . '/src', - ]); - - $rectorConfig->skip([ + ]) + ->withSkip([ CountArrayToEmptyArrayComparisonRector::class, StringClassNameToClassConstantRector::class => [ 'src/Elastica/Client/ElasticsearchClientFactory.php', ], MixedTypeRector::class => [ 'src/Document/DataObjectNormalizerTrait.php', + 'src/Index/IndexInterface.php', ], - ]); - - $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_81, - SetList::CODE_QUALITY, - ]); -}; + SingleInArrayToCompareRector::class => [ + 'src/Command/NonBundleIndexTrait.php', + ], + SimplifyForeachToCoalescingRector::class => [ + 'src/Repository/IndexRepository.php', + ], + ]) + ->withRootFiles(); diff --git a/src/Document/DataObjectNormalizerTrait.php b/src/Document/DataObjectNormalizerTrait.php index c51149a..16ab6df 100644 --- a/src/Document/DataObjectNormalizerTrait.php +++ b/src/Document/DataObjectNormalizerTrait.php @@ -9,6 +9,7 @@ use Pimcore\Model\DataObject\Concrete; use Pimcore\Model\DataObject\Localizedfield; use Pimcore\Tool; +use Symfony\Contracts\Service\Attribute\Required; /** * Collection of helpers for normalizing a DataObject. @@ -19,11 +20,7 @@ trait DataObjectNormalizerTrait { protected LocaleService $localeService; - /** - * Injects the LocaleService using Symfony's DI. - * - * @required - */ + #[Required] public function setLocaleService(LocaleService $localeService): void { $this->localeService = $localeService;