diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 5c958b4..7c56860 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -44,7 +44,7 @@ jobs: # see https://github.com/shivammathur/setup-php - uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 coverage: none # composer install cache - https://github.com/ramsey/composer-install diff --git a/composer.json b/composer.json index 2e02131..2662b55 100644 --- a/composer.json +++ b/composer.json @@ -3,20 +3,21 @@ "description": "Print Symfony services array with configuration to to plain PHP file format thanks to this simple php-parser wrapper", "license": "MIT", "require": { - "php": ">=8.1", + "php": ">=8.2", "nette/utils": "^3.2", - "nikic/php-parser": "^4.18", + "nikic/php-parser": "^5.3", "symfony/yaml": "^6.4" }, "require-dev": { "myclabs/php-enum": "^1.8", - "phpstan/extension-installer": "^1.3", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", "phpunit/phpunit": "^10.5", - "rector/rector": "^0.18.12", - "symplify/easy-coding-standard": "^12.0", + "rector/rector": "^2.0", + "phpecs/phpecs": "^2.0", "symplify/easy-testing": "^11.1", - "symplify/phpstan-extensions": "^11.2", - "tomasvotruba/class-leak": "^0.2" + "symplify/phpstan-extensions": "^12.0", + "tomasvotruba/class-leak": "^2.0" }, "autoload": { "psr-4": { @@ -32,20 +33,14 @@ "tests/Printer/SmartPhpConfigPrinter/Source/custom_inline_object_function.php" ] }, - "extra": { - "branch-alias": { - "dev-main": "11.2-dev" - } - }, "scripts": { "check-cs": "vendor/bin/ecs check --ansi", "fix-cs": "vendor/bin/ecs check --fix --ansi", - "phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify", + "phpstan": "vendor/bin/phpstan analyse --ansi", "rector": "vendor/bin/rector process --dry-run --ansi" }, "config": { "sort-packages": true, - "platform-check": false, "allow-plugins": { "cweagans/composer-patches": true, "phpstan/extension-installer": true diff --git a/ecs.php b/ecs.php index 862b15d..a727014 100644 --- a/ecs.php +++ b/ecs.php @@ -3,18 +3,11 @@ declare(strict_types=1); use Symplify\EasyCodingStandard\Config\ECSConfig; -use Symplify\EasyCodingStandard\ValueObject\Set\SetList; -return static function (ECSConfig $ecsConfig): void { - $ecsConfig->paths([ - __DIR__ . '/ecs.php', - __DIR__ . '/rector.php', +return ECSConfig::configure() + ->withPaths([ __DIR__ . '/src', __DIR__ . '/tests', - ]); - - $ecsConfig->sets([ - SetList::COMMON, - SetList::PSR_12, - ]); -}; + ]) + ->withRootFiles() + ->withPreparedSets(common: true, psr12: true); diff --git a/phpstan.neon b/phpstan.neon index 6cf6292..9cb986b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,8 @@ parameters: - level: 6 + level: 8 + + errorFormat: symplify + treatPhpDocTypesAsCertain: false paths: - src @@ -11,4 +14,11 @@ parameters: - '*/tests/**/data/*' ignoreErrors: - - '#Parameter \#1 \$items of class PhpParser\\Node\\Expr\\Array_ constructor expects array, array given#' + + # php version depends on runtime + - + message: '#Comparison operation ">=" between int<(.*?), 80499> and 80000 is always true#' + path: src/NodeFactory/ArgsNodeFactory.php + + # unclear what to do + - '#Parameter \#1 \$items of class PhpParser\\Node\\Expr\\Array_ constructor expects array, array given#' diff --git a/rector.php b/rector.php index 491c857..ccd4af5 100644 --- a/rector.php +++ b/rector.php @@ -4,32 +4,16 @@ use Rector\Config\RectorConfig; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; -use Rector\PHPUnit\Set\PHPUnitSetList; -use Rector\Set\ValueObject\LevelSetList; -use Rector\Set\ValueObject\SetList; -return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([ - PHPUnitSetList::PHPUNIT_100, - SetList::CODE_QUALITY, - SetList::DEAD_CODE, - LevelSetList::UP_TO_PHP_81, - SetList::CODING_STYLE, - SetList::TYPE_DECLARATION, - SetList::NAMING, - SetList::PRIVATIZATION, - SetList::EARLY_RETURN, - PHPUnitSetList::PHPUNIT_CODE_QUALITY, - ]); - - $rectorConfig->paths([ +return RectorConfig::configure() + ->withPreparedSets(deadCode: true, codeQuality: true, codingStyle: true, typeDeclarations: true, naming: true, privatization: true) + ->withRootFiles() + ->withPhpSets() + ->withPaths([ __DIR__ . '/src', __DIR__ . '/tests', - ]); - - $rectorConfig->importNames(); - - $rectorConfig->skip([ + ]) + ->withSkip([ '*/Source/*', '*/Fixture/*', // keep prefix @@ -38,7 +22,7 @@ __DIR__ . '/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php', ], - // preference - \Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector::class, + // old value is needed + \Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector::class, + ]); -}; diff --git a/src/CaseConverter/AliasCaseConverter.php b/src/CaseConverter/AliasCaseConverter.php index fcf60bf..ecdeb83 100644 --- a/src/CaseConverter/AliasCaseConverter.php +++ b/src/CaseConverter/AliasCaseConverter.php @@ -21,7 +21,7 @@ use Symplify\PhpConfigPrinter\ValueObject\VariableName; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class AliasCaseConverter implements CaseConverterInterface +final readonly class AliasCaseConverter implements CaseConverterInterface { /** * @see https://regex101.com/r/BwXkfO/2/ @@ -36,9 +36,9 @@ final class AliasCaseConverter implements CaseConverterInterface private const NAMED_ALIAS_REGEX = '#\w+\s+\$\w+#'; public function __construct( - private readonly CommonNodeFactory $commonNodeFactory, - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly ServiceOptionNodeFactory $serviceOptionNodeFactory, + private CommonNodeFactory $commonNodeFactory, + private ArgsNodeFactory $argsNodeFactory, + private ServiceOptionNodeFactory $serviceOptionNodeFactory, ) { } diff --git a/src/CaseConverter/ClassServiceCaseConverter.php b/src/CaseConverter/ClassServiceCaseConverter.php index 6dca0f1..9a578f3 100644 --- a/src/CaseConverter/ClassServiceCaseConverter.php +++ b/src/CaseConverter/ClassServiceCaseConverter.php @@ -15,11 +15,11 @@ use Symplify\PhpConfigPrinter\ValueObject\VariableName; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class ClassServiceCaseConverter implements CaseConverterInterface +final readonly class ClassServiceCaseConverter implements CaseConverterInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly ServiceOptionNodeFactory $serviceOptionNodeFactory + private ArgsNodeFactory $argsNodeFactory, + private ServiceOptionNodeFactory $serviceOptionNodeFactory ) { } diff --git a/src/CaseConverter/ConfiguredServiceCaseConverter.php b/src/CaseConverter/ConfiguredServiceCaseConverter.php index 1df5d5c..a857503 100644 --- a/src/CaseConverter/ConfiguredServiceCaseConverter.php +++ b/src/CaseConverter/ConfiguredServiceCaseConverter.php @@ -15,11 +15,11 @@ use Symplify\PhpConfigPrinter\ValueObject\VariableName; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class ConfiguredServiceCaseConverter implements CaseConverterInterface +final readonly class ConfiguredServiceCaseConverter implements CaseConverterInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly ServiceOptionNodeFactory $serviceOptionNodeFactory + private ArgsNodeFactory $argsNodeFactory, + private ServiceOptionNodeFactory $serviceOptionNodeFactory ) { } diff --git a/src/CaseConverter/ImportCaseConverter.php b/src/CaseConverter/ImportCaseConverter.php index 7d08d56..10cb285 100644 --- a/src/CaseConverter/ImportCaseConverter.php +++ b/src/CaseConverter/ImportCaseConverter.php @@ -27,7 +27,7 @@ * * imports: <--- */ -final class ImportCaseConverter implements CaseConverterInterface +final readonly class ImportCaseConverter implements CaseConverterInterface { /** * @see https://regex101.com/r/hOTdIE/1 @@ -36,8 +36,8 @@ final class ImportCaseConverter implements CaseConverterInterface private const INPUT_SUFFIX_REGEX = '#\.(yml|yaml|xml)$#'; public function __construct( - private readonly YamlArgumentSorter $yamlArgumentSorter, - private readonly CommonNodeFactory $commonNodeFactory + private YamlArgumentSorter $yamlArgumentSorter, + private CommonNodeFactory $commonNodeFactory ) { } diff --git a/src/CaseConverter/NameOnlyServiceCaseConverter.php b/src/CaseConverter/NameOnlyServiceCaseConverter.php index eab57f9..001dbeb 100644 --- a/src/CaseConverter/NameOnlyServiceCaseConverter.php +++ b/src/CaseConverter/NameOnlyServiceCaseConverter.php @@ -14,10 +14,10 @@ use Symplify\PhpConfigPrinter\ValueObject\VariableName; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class NameOnlyServiceCaseConverter implements CaseConverterInterface +final readonly class NameOnlyServiceCaseConverter implements CaseConverterInterface { public function __construct( - private readonly CommonNodeFactory $commonNodeFactory + private CommonNodeFactory $commonNodeFactory ) { } diff --git a/src/CaseConverter/NestedCaseConverter/InstanceOfNestedCaseConverter.php b/src/CaseConverter/NestedCaseConverter/InstanceOfNestedCaseConverter.php index b33bd45..d84245d 100644 --- a/src/CaseConverter/NestedCaseConverter/InstanceOfNestedCaseConverter.php +++ b/src/CaseConverter/NestedCaseConverter/InstanceOfNestedCaseConverter.php @@ -15,11 +15,11 @@ use Symplify\PhpConfigPrinter\ValueObject\VariableName; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class InstanceOfNestedCaseConverter +final readonly class InstanceOfNestedCaseConverter { public function __construct( - private readonly CommonNodeFactory $commonNodeFactory, - private readonly ServiceOptionNodeFactory $serviceOptionNodeFactory + private CommonNodeFactory $commonNodeFactory, + private ServiceOptionNodeFactory $serviceOptionNodeFactory ) { } diff --git a/src/CaseConverter/ParameterCaseConverter.php b/src/CaseConverter/ParameterCaseConverter.php index d571ed2..b747a85 100644 --- a/src/CaseConverter/ParameterCaseConverter.php +++ b/src/CaseConverter/ParameterCaseConverter.php @@ -22,12 +22,12 @@ * * parameters: <--- */ -final class ParameterCaseConverter implements CaseConverterInterface +final readonly class ParameterCaseConverter implements CaseConverterInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly CurrentFilePathProvider $currentFilePathProvider, - private readonly CommonNodeFactory $commonNodeFactory + private ArgsNodeFactory $argsNodeFactory, + private CurrentFilePathProvider $currentFilePathProvider, + private CommonNodeFactory $commonNodeFactory ) { } diff --git a/src/CaseConverter/ResourceCaseConverter.php b/src/CaseConverter/ResourceCaseConverter.php index 1219e55..8b1c8bb 100644 --- a/src/CaseConverter/ResourceCaseConverter.php +++ b/src/CaseConverter/ResourceCaseConverter.php @@ -9,10 +9,10 @@ use Symplify\PhpConfigPrinter\NodeFactory\Service\ServicesPhpNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class ResourceCaseConverter implements CaseConverterInterface +final readonly class ResourceCaseConverter implements CaseConverterInterface { public function __construct( - private readonly ServicesPhpNodeFactory $servicesPhpNodeFactory + private ServicesPhpNodeFactory $servicesPhpNodeFactory ) { } diff --git a/src/CaseConverter/ServicesDefaultsCaseConverter.php b/src/CaseConverter/ServicesDefaultsCaseConverter.php index 0995ef6..20195d7 100644 --- a/src/CaseConverter/ServicesDefaultsCaseConverter.php +++ b/src/CaseConverter/ServicesDefaultsCaseConverter.php @@ -14,10 +14,10 @@ use Symplify\PhpConfigPrinter\ValueObject\VariableName; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class ServicesDefaultsCaseConverter implements CaseConverterInterface +final readonly class ServicesDefaultsCaseConverter implements CaseConverterInterface { public function __construct( - private readonly AutoBindNodeFactory $autoBindNodeFactory + private AutoBindNodeFactory $autoBindNodeFactory ) { } diff --git a/src/ExprResolver/ServiceReferenceExprResolver.php b/src/ExprResolver/ServiceReferenceExprResolver.php index 515ff02..b7948ab 100644 --- a/src/ExprResolver/ServiceReferenceExprResolver.php +++ b/src/ExprResolver/ServiceReferenceExprResolver.php @@ -10,10 +10,10 @@ use PhpParser\Node\Name\FullyQualified; use Symplify\PhpConfigPrinter\ValueObject\FunctionName; -final class ServiceReferenceExprResolver +final readonly class ServiceReferenceExprResolver { public function __construct( - private readonly StringExprResolver $stringExprResolver + private StringExprResolver $stringExprResolver ) { } diff --git a/src/ExprResolver/StringExprResolver.php b/src/ExprResolver/StringExprResolver.php index 47546a3..26f271a 100644 --- a/src/ExprResolver/StringExprResolver.php +++ b/src/ExprResolver/StringExprResolver.php @@ -16,7 +16,7 @@ use Symplify\PhpConfigPrinter\NodeFactory\ConstantNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\FunctionName; -final class StringExprResolver +final readonly class StringExprResolver { /** * @see https://regex101.com/r/laf2wR/1 @@ -25,8 +25,8 @@ final class StringExprResolver private const TWIG_HTML_XML_SUFFIX_REGEX = '#\.(twig|html|xml)$#'; public function __construct( - private readonly ConstantNodeFactory $constantNodeFactory, - private readonly CommonNodeFactory $commonNodeFactory + private ConstantNodeFactory $constantNodeFactory, + private CommonNodeFactory $commonNodeFactory ) { } diff --git a/src/ExprResolver/TaggedReturnsCloneResolver.php b/src/ExprResolver/TaggedReturnsCloneResolver.php index ec50a0c..78d45e1 100644 --- a/src/ExprResolver/TaggedReturnsCloneResolver.php +++ b/src/ExprResolver/TaggedReturnsCloneResolver.php @@ -4,15 +4,15 @@ namespace Symplify\PhpConfigPrinter\ExprResolver; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use Symfony\Component\Yaml\Tag\TaggedValue; use Symplify\PhpConfigPrinter\ValueObject\FunctionName; -final class TaggedReturnsCloneResolver +final readonly class TaggedReturnsCloneResolver { public function __construct( - private readonly ServiceReferenceExprResolver $serviceReferenceExprResolver + private ServiceReferenceExprResolver $serviceReferenceExprResolver ) { } diff --git a/src/ExprResolver/TaggedServiceResolver.php b/src/ExprResolver/TaggedServiceResolver.php index e4820d9..e591903 100644 --- a/src/ExprResolver/TaggedServiceResolver.php +++ b/src/ExprResolver/TaggedServiceResolver.php @@ -8,10 +8,10 @@ use Symfony\Component\Yaml\Tag\TaggedValue; use Symplify\PhpConfigPrinter\ValueObject\FunctionName; -final class TaggedServiceResolver +final readonly class TaggedServiceResolver { public function __construct( - private readonly ServiceReferenceExprResolver $serviceReferenceExprResolver + private ServiceReferenceExprResolver $serviceReferenceExprResolver ) { } diff --git a/src/NodeFactory/ArgsNodeFactory.php b/src/NodeFactory/ArgsNodeFactory.php index 244958f..7672102 100644 --- a/src/NodeFactory/ArgsNodeFactory.php +++ b/src/NodeFactory/ArgsNodeFactory.php @@ -7,9 +7,9 @@ use PhpParser\BuilderHelpers; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Identifier; use PhpParser\Node\Name; @@ -21,7 +21,7 @@ use Symplify\PhpConfigPrinter\ExprResolver\TaggedServiceResolver; use Symplify\PhpConfigPrinter\ValueObject\FunctionName; -final class ArgsNodeFactory +final readonly class ArgsNodeFactory { /** * @var string @@ -33,13 +33,13 @@ final class ArgsNodeFactory */ private const TAG_RETURNS_CLONE = 'returns_clone'; - private readonly bool $isPhpNamedArguments; + private bool $isPhpNamedArguments; public function __construct( - private readonly StringExprResolver $stringExprResolver, - private readonly TaggedReturnsCloneResolver $taggedReturnsCloneResolver, - private readonly TaggedServiceResolver $taggedServiceResolver, - private readonly NewValueObjectFactory $newValueObjectFactory, + private StringExprResolver $stringExprResolver, + private TaggedReturnsCloneResolver $taggedReturnsCloneResolver, + private TaggedServiceResolver $taggedServiceResolver, + private NewValueObjectFactory $newValueObjectFactory, ) { $this->isPhpNamedArguments = PHP_VERSION_ID >= 80000; } @@ -171,7 +171,7 @@ private function resolveArgs(array $args, mixed $key, Expr $expr, bool $isForCon { if (is_string($key) && $isForConfig) { $key = $this->resolveExpr($key); - $args[] = new Arg(new ArrayItem($expr, $key)); + $args[] = new Arg(new Array_([new ArrayItem($expr, $key)])); return $args; } diff --git a/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php b/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php index aab7118..5233fa2 100644 --- a/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php +++ b/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php @@ -6,9 +6,9 @@ use Nette\Utils\Json; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\MethodCall; @@ -25,15 +25,15 @@ use Symplify\PhpConfigPrinter\ValueObject\VariableName; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class ContainerConfiguratorReturnClosureFactory +final readonly class ContainerConfiguratorReturnClosureFactory { /** * @param CaseConverterInterface[] $caseConverters */ public function __construct( - private readonly ConfiguratorClosureNodeFactory $configuratorClosureNodeFactory, - private readonly iterable $caseConverters, - private readonly ContainerNestedNodesFactory $containerNestedNodesFactory + private ConfiguratorClosureNodeFactory $configuratorClosureNodeFactory, + private iterable $caseConverters, + private ContainerNestedNodesFactory $containerNestedNodesFactory ) { } @@ -66,7 +66,7 @@ private function createClosureStmts(array $yamlData): array } /** - * @param array $yamlData + * @param array $yamlData * @return Stmt[] */ private function createStmtsFromCaseConverters(array $yamlData): array diff --git a/src/NodeFactory/ContainerNestedNodesFactory.php b/src/NodeFactory/ContainerNestedNodesFactory.php index c7b6f06..c815186 100644 --- a/src/NodeFactory/ContainerNestedNodesFactory.php +++ b/src/NodeFactory/ContainerNestedNodesFactory.php @@ -7,10 +7,10 @@ use PhpParser\Node\Stmt; use Symplify\PhpConfigPrinter\CaseConverter\NestedCaseConverter\InstanceOfNestedCaseConverter; -final class ContainerNestedNodesFactory +final readonly class ContainerNestedNodesFactory { public function __construct( - private readonly InstanceOfNestedCaseConverter $instanceOfNestedCaseConverter + private InstanceOfNestedCaseConverter $instanceOfNestedCaseConverter ) { } diff --git a/src/NodeFactory/NewValueObjectFactory.php b/src/NodeFactory/NewValueObjectFactory.php index 8118a04..aad89a7 100644 --- a/src/NodeFactory/NewValueObjectFactory.php +++ b/src/NodeFactory/NewValueObjectFactory.php @@ -31,6 +31,7 @@ public function create(object $valueObject): New_ | StaticCall } /** + * @param class-string $valueObjectClass * @return mixed[] */ private function resolvePropertyValuesFromValueObject(string $valueObjectClass, object $valueObject): array diff --git a/src/NodeFactory/RoutingConfiguratorReturnClosureFactory.php b/src/NodeFactory/RoutingConfiguratorReturnClosureFactory.php index c5070b9..a6dddd7 100644 --- a/src/NodeFactory/RoutingConfiguratorReturnClosureFactory.php +++ b/src/NodeFactory/RoutingConfiguratorReturnClosureFactory.php @@ -9,14 +9,14 @@ use Symplify\PhpConfigPrinter\Contract\RoutingCaseConverterInterface; use Symplify\PhpConfigPrinter\PhpParser\NodeFactory\ConfiguratorClosureNodeFactory; -final class RoutingConfiguratorReturnClosureFactory +final readonly class RoutingConfiguratorReturnClosureFactory { /** * @param RoutingCaseConverterInterface[] $routingCaseConverters */ public function __construct( - private readonly ConfiguratorClosureNodeFactory $containerConfiguratorClosureNodeFactory, - private readonly iterable $routingCaseConverters + private ConfiguratorClosureNodeFactory $containerConfiguratorClosureNodeFactory, + private iterable $routingCaseConverters ) { } diff --git a/src/NodeFactory/Service/AutoBindNodeFactory.php b/src/NodeFactory/Service/AutoBindNodeFactory.php index 93b3779..f64bd00 100644 --- a/src/NodeFactory/Service/AutoBindNodeFactory.php +++ b/src/NodeFactory/Service/AutoBindNodeFactory.php @@ -9,11 +9,11 @@ use Symplify\PhpConfigPrinter\ServiceOptionConverter\TagsServiceOptionKeyYamlToPhpFactory; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class AutoBindNodeFactory +final readonly class AutoBindNodeFactory { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly TagsServiceOptionKeyYamlToPhpFactory $tagsServiceOptionKeyYamlToPhpFactory + private ArgsNodeFactory $argsNodeFactory, + private TagsServiceOptionKeyYamlToPhpFactory $tagsServiceOptionKeyYamlToPhpFactory ) { } diff --git a/src/NodeFactory/Service/ServiceOptionNodeFactory.php b/src/NodeFactory/Service/ServiceOptionNodeFactory.php index 3898e74..e98b947 100644 --- a/src/NodeFactory/Service/ServiceOptionNodeFactory.php +++ b/src/NodeFactory/Service/ServiceOptionNodeFactory.php @@ -10,14 +10,14 @@ use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; use Webmozart\Assert\Assert; -final class ServiceOptionNodeFactory +final readonly class ServiceOptionNodeFactory { /** * @param ServiceOptionsKeyYamlToPhpFactoryInterface[] $serviceOptionKeyYamlToPhpFactories */ public function __construct( - private readonly ServiceOptionAnalyzer $serviceOptionAnalyzer, - private readonly iterable $serviceOptionKeyYamlToPhpFactories + private ServiceOptionAnalyzer $serviceOptionAnalyzer, + private iterable $serviceOptionKeyYamlToPhpFactories ) { Assert::notEmpty($serviceOptionKeyYamlToPhpFactories); Assert::allIsInstanceOf($serviceOptionKeyYamlToPhpFactories, ServiceOptionsKeyYamlToPhpFactoryInterface::class); diff --git a/src/NodeFactory/Service/ServicesPhpNodeFactory.php b/src/NodeFactory/Service/ServicesPhpNodeFactory.php index 6748a23..28b8046 100644 --- a/src/NodeFactory/Service/ServicesPhpNodeFactory.php +++ b/src/NodeFactory/Service/ServicesPhpNodeFactory.php @@ -14,7 +14,7 @@ use Symplify\PhpConfigPrinter\NodeFactory\CommonNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\VariableName; -final class ServicesPhpNodeFactory +final readonly class ServicesPhpNodeFactory { /** * @var string @@ -22,9 +22,9 @@ final class ServicesPhpNodeFactory private const EXCLUDE = 'exclude'; public function __construct( - private readonly CommonNodeFactory $commonNodeFactory, - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly ServiceOptionNodeFactory $serviceOptionNodeFactory, + private CommonNodeFactory $commonNodeFactory, + private ArgsNodeFactory $argsNodeFactory, + private ServiceOptionNodeFactory $serviceOptionNodeFactory, ) { } diff --git a/src/NodeFactory/Service/SingleServicePhpNodeFactory.php b/src/NodeFactory/Service/SingleServicePhpNodeFactory.php index 05d8326..e5365c2 100644 --- a/src/NodeFactory/Service/SingleServicePhpNodeFactory.php +++ b/src/NodeFactory/Service/SingleServicePhpNodeFactory.php @@ -12,10 +12,10 @@ use Symfony\Component\Yaml\Tag\TaggedValue; use Symplify\PhpConfigPrinter\NodeFactory\ArgsNodeFactory; -final class SingleServicePhpNodeFactory +final readonly class SingleServicePhpNodeFactory { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory + private ArgsNodeFactory $argsNodeFactory ) { } diff --git a/src/NodeFinder/TypeAwareNodeFinder.php b/src/NodeFinder/TypeAwareNodeFinder.php index b93441c..d68af43 100644 --- a/src/NodeFinder/TypeAwareNodeFinder.php +++ b/src/NodeFinder/TypeAwareNodeFinder.php @@ -11,10 +11,10 @@ * @api * @todo remove after https://github.com/nikic/PHP-Parser/pull/869 is released */ -final class TypeAwareNodeFinder +final readonly class TypeAwareNodeFinder { public function __construct( - private readonly NodeFinder $nodeFinder + private NodeFinder $nodeFinder ) { } diff --git a/src/NodeModifier/SingleFactoryReferenceNodeModifier.php b/src/NodeModifier/SingleFactoryReferenceNodeModifier.php index 8c8f840..acbc905 100644 --- a/src/NodeModifier/SingleFactoryReferenceNodeModifier.php +++ b/src/NodeModifier/SingleFactoryReferenceNodeModifier.php @@ -6,15 +6,15 @@ use Nette\Utils\Strings; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Scalar\String_; use Symplify\PhpConfigPrinter\NodeFactory\ArgsNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\FunctionName; -final class SingleFactoryReferenceNodeModifier +final readonly class SingleFactoryReferenceNodeModifier { /** * @see https://regex101.com/r/Smydt1/2 @@ -23,7 +23,7 @@ final class SingleFactoryReferenceNodeModifier private const FACTORY_REGEX = '#(?.*?)(?\:{1,2})(?\w+)#'; public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory + private ArgsNodeFactory $argsNodeFactory ) { } @@ -47,10 +47,6 @@ public function modifyArgs(array $args): void } $singleArrayItem = $singleArgValue->items[0]; - if (! $singleArrayItem instanceof ArrayItem) { - return; - } - if (! $singleArrayItem->value instanceof String_) { return; } diff --git a/src/NodeTraverser/ImportFullyQualifiedNamesNodeTraverser.php b/src/NodeTraverser/ImportFullyQualifiedNamesNodeTraverser.php index 0bc30e6..5f51848 100644 --- a/src/NodeTraverser/ImportFullyQualifiedNamesNodeTraverser.php +++ b/src/NodeTraverser/ImportFullyQualifiedNamesNodeTraverser.php @@ -16,13 +16,13 @@ use Symplify\PhpConfigPrinter\ValueObject\FullyQualifiedImport; use Symplify\PhpConfigPrinter\ValueObject\ImportType; -final class ImportFullyQualifiedNamesNodeTraverser +final readonly class ImportFullyQualifiedNamesNodeTraverser { public function __construct( - private readonly ParentConnectingVisitor $parentConnectingVisitor, - private readonly ImportFullyQualifiedNamesNodeVisitor $importFullyQualifiedNamesNodeVisitor, - private readonly FullyQualifiedImportSorter $fullyQualifiedImportSorter, - private readonly BuilderFactory $builderFactory + private ParentConnectingVisitor $parentConnectingVisitor, + private ImportFullyQualifiedNamesNodeVisitor $importFullyQualifiedNamesNodeVisitor, + private FullyQualifiedImportSorter $fullyQualifiedImportSorter, + private BuilderFactory $builderFactory ) { } diff --git a/src/PhpParser/NodeFactory/ConfiguratorClosureNodeFactory.php b/src/PhpParser/NodeFactory/ConfiguratorClosureNodeFactory.php index c926883..2507ae4 100644 --- a/src/PhpParser/NodeFactory/ConfiguratorClosureNodeFactory.php +++ b/src/PhpParser/NodeFactory/ConfiguratorClosureNodeFactory.php @@ -5,9 +5,9 @@ namespace Symplify\PhpConfigPrinter\PhpParser\NodeFactory; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; @@ -21,10 +21,10 @@ use Symplify\PhpConfigPrinter\Naming\VariableNameResolver; use Symplify\PhpConfigPrinter\ValueObject\VariableName; -final class ConfiguratorClosureNodeFactory +final readonly class ConfiguratorClosureNodeFactory { public function __construct( - private readonly VariableNameResolver $variableNameResolver, + private VariableNameResolver $variableNameResolver, ) { } @@ -167,7 +167,7 @@ private function replaceArrayArgWithMergedArrayItems(array $extensionNodesByExte /** * @param Expr[][] $extensionExprs - * @return array + * @return array */ private function resolveMergedArrayItems(array $extensionExprs): array { diff --git a/src/Printer/ArrayDecorator/ServiceConfigurationDecorator.php b/src/Printer/ArrayDecorator/ServiceConfigurationDecorator.php index 5dc7d1a..cf27fb3 100644 --- a/src/Printer/ArrayDecorator/ServiceConfigurationDecorator.php +++ b/src/Printer/ArrayDecorator/ServiceConfigurationDecorator.php @@ -6,13 +6,16 @@ use Symplify\PhpConfigPrinter\Reflection\ConstantNameFromValueResolver; -final class ServiceConfigurationDecorator +final readonly class ServiceConfigurationDecorator { public function __construct( - private readonly ConstantNameFromValueResolver $constantNameFromValueResolver, + private ConstantNameFromValueResolver $constantNameFromValueResolver, ) { } + /** + * @param class-string $class + */ public function decorate(mixed $configuration, string $class): mixed { if (! is_array($configuration)) { @@ -24,6 +27,8 @@ public function decorate(mixed $configuration, string $class): mixed /** * @param array $configuration + * @param class-string $class + * * @return mixed[] */ private function decorateClassConstantKeys(array $configuration, string $class): array diff --git a/src/Printer/NodeDecorator/EmptyLineNodeDecorator.php b/src/Printer/NodeDecorator/EmptyLineNodeDecorator.php index a564c7c..2a0e246 100644 --- a/src/Printer/NodeDecorator/EmptyLineNodeDecorator.php +++ b/src/Printer/NodeDecorator/EmptyLineNodeDecorator.php @@ -14,10 +14,10 @@ use Symplify\PhpConfigPrinter\Exception\ShouldNotHappenException; use Symplify\PhpConfigPrinter\NodeFinder\TypeAwareNodeFinder; -final class EmptyLineNodeDecorator +final readonly class EmptyLineNodeDecorator { public function __construct( - private readonly TypeAwareNodeFinder $typeAwareNodeFinder + private TypeAwareNodeFinder $typeAwareNodeFinder ) { } diff --git a/src/Printer/SmartPhpConfigPrinter.php b/src/Printer/SmartPhpConfigPrinter.php index 1d69615..85d520a 100644 --- a/src/Printer/SmartPhpConfigPrinter.php +++ b/src/Printer/SmartPhpConfigPrinter.php @@ -12,17 +12,17 @@ * @api * @see \Symplify\PhpConfigPrinter\Tests\Printer\SmartPhpConfigPrinter\SmartPhpConfigPrinterTest */ -final class SmartPhpConfigPrinter +final readonly class SmartPhpConfigPrinter { public function __construct( - private readonly ContainerConfiguratorReturnClosureFactory $configuratorReturnClosureFactory, - private readonly PhpParserPhpConfigPrinter $phpParserPhpConfigPrinter, - private readonly ServiceConfigurationDecorator $serviceConfigurationDecorator + private ContainerConfiguratorReturnClosureFactory $configuratorReturnClosureFactory, + private PhpParserPhpConfigPrinter $phpParserPhpConfigPrinter, + private ServiceConfigurationDecorator $serviceConfigurationDecorator ) { } /** - * @param array $configuredServices + * @param array $configuredServices */ public function printConfiguredServices(array $configuredServices): string { @@ -44,6 +44,8 @@ public function printConfiguredServices(array $configuredServices): string /** * @param mixed[] $configuration + * @param class-string $class + * * @return array{calls: mixed[]} */ private function createServiceConfiguration(array $configuration, string $class): array diff --git a/src/Reflection/ConstantNameFromValueResolver.php b/src/Reflection/ConstantNameFromValueResolver.php index 1defc19..3fc03f4 100644 --- a/src/Reflection/ConstantNameFromValueResolver.php +++ b/src/Reflection/ConstantNameFromValueResolver.php @@ -8,6 +8,9 @@ final class ConstantNameFromValueResolver { + /** + * @param class-string $class + */ public function resolveFromValueAndClass(int|string $constantValue, string $class): ?string { $reflectionClass = new ReflectionClass($class); diff --git a/src/RoutingCaseConverter/ImportRoutingCaseConverter.php b/src/RoutingCaseConverter/ImportRoutingCaseConverter.php index 8ae84c7..19b1fc8 100644 --- a/src/RoutingCaseConverter/ImportRoutingCaseConverter.php +++ b/src/RoutingCaseConverter/ImportRoutingCaseConverter.php @@ -16,7 +16,7 @@ use Symplify\PhpConfigPrinter\StringFormatConverter; use Symplify\PhpConfigPrinter\ValueObject\VariableName; -final class ImportRoutingCaseConverter implements RoutingCaseConverterInterface +final readonly class ImportRoutingCaseConverter implements RoutingCaseConverterInterface { /** * @var string[] @@ -77,8 +77,8 @@ final class ImportRoutingCaseConverter implements RoutingCaseConverterInterface private const METHODS = 'methods'; public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly ControllerSplitter $controllerSplitter + private ArgsNodeFactory $argsNodeFactory, + private ControllerSplitter $controllerSplitter ) { } diff --git a/src/RoutingCaseConverter/PathRoutingCaseConverter.php b/src/RoutingCaseConverter/PathRoutingCaseConverter.php index 373df0a..b86a01f 100644 --- a/src/RoutingCaseConverter/PathRoutingCaseConverter.php +++ b/src/RoutingCaseConverter/PathRoutingCaseConverter.php @@ -16,11 +16,11 @@ use Symplify\PhpConfigPrinter\ValueObject\Routing\RouteDefaults; use Symplify\PhpConfigPrinter\ValueObject\VariableName; -final class PathRoutingCaseConverter implements RoutingCaseConverterInterface +final readonly class PathRoutingCaseConverter implements RoutingCaseConverterInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly ControllerSplitter $controllerSplitter + private ArgsNodeFactory $argsNodeFactory, + private ControllerSplitter $controllerSplitter ) { } @@ -62,7 +62,7 @@ public function convertToMethodCall(string $key, mixed $values): Stmt unset($nestedValues[RouteDefaults::CONTROLLER]); } - if (! is_array($nestedValues) || (is_array($nestedValues) && $nestedValues !== [])) { + if (! is_array($nestedValues) || ($nestedValues !== [])) { $args = $this->argsNodeFactory->createFromValues([$nestedValues]); $methodCall = new MethodCall($methodCall, $nestedKey, $args); } diff --git a/src/ServiceOptionConverter/AbstractServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/AbstractServiceOptionKeyYamlToPhpFactory.php index 28d8f56..781a453 100644 --- a/src/ServiceOptionConverter/AbstractServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/AbstractServiceOptionKeyYamlToPhpFactory.php @@ -10,10 +10,10 @@ use Symplify\PhpConfigPrinter\NodeFactory\ArgsNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; -final class AbstractServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class AbstractServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, + private ArgsNodeFactory $argsNodeFactory, ) { } diff --git a/src/ServiceOptionConverter/ArgumentsServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/ArgumentsServiceOptionKeyYamlToPhpFactory.php index 6e82ba9..6d347ad 100644 --- a/src/ServiceOptionConverter/ArgumentsServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/ArgumentsServiceOptionKeyYamlToPhpFactory.php @@ -10,11 +10,11 @@ use Symplify\PhpConfigPrinter\ServiceOptionAnalyzer\ServiceOptionAnalyzer; use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; -final class ArgumentsServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class ArgumentsServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly ServiceOptionAnalyzer $serviceOptionAnalyzer + private ArgsNodeFactory $argsNodeFactory, + private ServiceOptionAnalyzer $serviceOptionAnalyzer ) { } diff --git a/src/ServiceOptionConverter/AutowiringTypesOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/AutowiringTypesOptionKeyYamlToPhpFactory.php index e724d4b..e327d7a 100644 --- a/src/ServiceOptionConverter/AutowiringTypesOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/AutowiringTypesOptionKeyYamlToPhpFactory.php @@ -8,10 +8,10 @@ use Symplify\PhpConfigPrinter\Contract\Converter\ServiceOptionsKeyYamlToPhpFactoryInterface; use Symplify\PhpConfigPrinter\NodeFactory\ArgsNodeFactory; -final class AutowiringTypesOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class AutowiringTypesOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, + private ArgsNodeFactory $argsNodeFactory, ) { } diff --git a/src/ServiceOptionConverter/BindAutowireAutoconfigureServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/BindAutowireAutoconfigureServiceOptionKeyYamlToPhpFactory.php index 6a508c9..13b4911 100644 --- a/src/ServiceOptionConverter/BindAutowireAutoconfigureServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/BindAutowireAutoconfigureServiceOptionKeyYamlToPhpFactory.php @@ -13,12 +13,12 @@ use Symplify\PhpConfigPrinter\ValueObject\YamlKey; use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; -final class BindAutowireAutoconfigureServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class BindAutowireAutoconfigureServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly CommonNodeFactory $commonNodeFactory, - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly ServiceOptionAnalyzer $serviceOptionAnalyzer + private CommonNodeFactory $commonNodeFactory, + private ArgsNodeFactory $argsNodeFactory, + private ServiceOptionAnalyzer $serviceOptionAnalyzer ) { } diff --git a/src/ServiceOptionConverter/CallsServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/CallsServiceOptionKeyYamlToPhpFactory.php index 49a78af..6787f60 100644 --- a/src/ServiceOptionConverter/CallsServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/CallsServiceOptionKeyYamlToPhpFactory.php @@ -9,10 +9,10 @@ use Symplify\PhpConfigPrinter\NodeFactory\Service\SingleServicePhpNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; -final class CallsServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class CallsServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly SingleServicePhpNodeFactory $singleServicePhpNodeFactory + private SingleServicePhpNodeFactory $singleServicePhpNodeFactory ) { } diff --git a/src/ServiceOptionConverter/DecoratesServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/DecoratesServiceOptionKeyYamlToPhpFactory.php index 72ec737..8bbe8f0 100644 --- a/src/ServiceOptionConverter/DecoratesServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/DecoratesServiceOptionKeyYamlToPhpFactory.php @@ -12,7 +12,7 @@ use Symplify\PhpConfigPrinter\Sorter\YamlArgumentSorter; use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; -final class DecoratesServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class DecoratesServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { /** * @var string @@ -30,9 +30,9 @@ final class DecoratesServiceOptionKeyYamlToPhpFactory implements ServiceOptionsK private const DECORATION_PRIORITY = 'decoration_priority'; public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly YamlArgumentSorter $yamlArgumentSorter, - private readonly CommonNodeFactory $commonNodeFactory + private ArgsNodeFactory $argsNodeFactory, + private YamlArgumentSorter $yamlArgumentSorter, + private CommonNodeFactory $commonNodeFactory ) { } diff --git a/src/ServiceOptionConverter/DeprecatedServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/DeprecatedServiceOptionKeyYamlToPhpFactory.php index 13e425c..e8f21e8 100644 --- a/src/ServiceOptionConverter/DeprecatedServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/DeprecatedServiceOptionKeyYamlToPhpFactory.php @@ -9,10 +9,10 @@ use Symplify\PhpConfigPrinter\NodeFactory\ArgsNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; -final class DeprecatedServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class DeprecatedServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory + private ArgsNodeFactory $argsNodeFactory ) { } diff --git a/src/ServiceOptionConverter/FactoryConfiguratorServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/FactoryConfiguratorServiceOptionKeyYamlToPhpFactory.php index c73ca46..a86701b 100644 --- a/src/ServiceOptionConverter/FactoryConfiguratorServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/FactoryConfiguratorServiceOptionKeyYamlToPhpFactory.php @@ -10,11 +10,11 @@ use Symplify\PhpConfigPrinter\NodeModifier\SingleFactoryReferenceNodeModifier; use Symplify\PhpConfigPrinter\ValueObject\YamlKey; -final class FactoryConfiguratorServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class FactoryConfiguratorServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory, - private readonly SingleFactoryReferenceNodeModifier $singleFactoryReferenceNodeModifier + private ArgsNodeFactory $argsNodeFactory, + private SingleFactoryReferenceNodeModifier $singleFactoryReferenceNodeModifier ) { } diff --git a/src/ServiceOptionConverter/PropertiesServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/PropertiesServiceOptionKeyYamlToPhpFactory.php index 5177288..f978315 100644 --- a/src/ServiceOptionConverter/PropertiesServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/PropertiesServiceOptionKeyYamlToPhpFactory.php @@ -9,10 +9,10 @@ use Symplify\PhpConfigPrinter\NodeFactory\Service\SingleServicePhpNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; -final class PropertiesServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class PropertiesServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly SingleServicePhpNodeFactory $singleServicePhpNodeFactory + private SingleServicePhpNodeFactory $singleServicePhpNodeFactory ) { } diff --git a/src/ServiceOptionConverter/SharedPublicServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/SharedPublicServiceOptionKeyYamlToPhpFactory.php index eeee5b4..16d4415 100644 --- a/src/ServiceOptionConverter/SharedPublicServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/SharedPublicServiceOptionKeyYamlToPhpFactory.php @@ -10,10 +10,10 @@ use Symplify\PhpConfigPrinter\Exception\NotImplementedYetException; use Symplify\PhpConfigPrinter\NodeFactory\CommonNodeFactory; -final class SharedPublicServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class SharedPublicServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { public function __construct( - private readonly CommonNodeFactory $commonNodeFactory, + private CommonNodeFactory $commonNodeFactory, ) { } diff --git a/src/ServiceOptionConverter/TagsServiceOptionKeyYamlToPhpFactory.php b/src/ServiceOptionConverter/TagsServiceOptionKeyYamlToPhpFactory.php index 7761866..9e38a15 100644 --- a/src/ServiceOptionConverter/TagsServiceOptionKeyYamlToPhpFactory.php +++ b/src/ServiceOptionConverter/TagsServiceOptionKeyYamlToPhpFactory.php @@ -14,7 +14,7 @@ use Symplify\PhpConfigPrinter\NodeFactory\ArgsNodeFactory; use Symplify\PhpConfigPrinter\ValueObject\YamlServiceKey; -final class TagsServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface +final readonly class TagsServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYamlToPhpFactoryInterface { /** * @var string @@ -22,7 +22,7 @@ final class TagsServiceOptionKeyYamlToPhpFactory implements ServiceOptionsKeyYam private const TAG = 'tag'; public function __construct( - private readonly ArgsNodeFactory $argsNodeFactory + private ArgsNodeFactory $argsNodeFactory ) { } diff --git a/src/ValueObject/FullyQualifiedImport.php b/src/ValueObject/FullyQualifiedImport.php index 8df84f4..7553b74 100644 --- a/src/ValueObject/FullyQualifiedImport.php +++ b/src/ValueObject/FullyQualifiedImport.php @@ -6,15 +6,15 @@ use Stringable; -final class FullyQualifiedImport implements Stringable +final readonly class FullyQualifiedImport implements Stringable { /** * @param ImportType::* $type */ public function __construct( - private readonly string $type, - private readonly string $fullyQualified, - private readonly string $shortClassName + private string $type, + private string $fullyQualified, + private string $shortClassName ) { } diff --git a/tests/Printer/SmartPhpConfigPrinter/SmartPhpConfigPrinterTest.php b/tests/Printer/SmartPhpConfigPrinter/SmartPhpConfigPrinterTest.php index 9e83653..d7343b1 100644 --- a/tests/Printer/SmartPhpConfigPrinter/SmartPhpConfigPrinterTest.php +++ b/tests/Printer/SmartPhpConfigPrinter/SmartPhpConfigPrinterTest.php @@ -24,7 +24,7 @@ protected function setUp(): void } /** - * @param array $services + * @param array $services */ #[DataProvider('provideData')] public function test(array $services, string $expectedContentFilePath): void