diff --git a/.github/workflows/composer-root-version.yaml b/.github/workflows/composer-root-version.yaml index 1e4388ccc..02315d636 100644 --- a/.github/workflows/composer-root-version.yaml +++ b/.github/workflows/composer-root-version.yaml @@ -24,7 +24,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' tools: composer coverage: none @@ -54,7 +54,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.1', '8.2' ] + php: [ '8.2' ] steps: - name: Checkout @@ -108,7 +108,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' tools: composer coverage: none diff --git a/.github/workflows/e2e-tests.yaml b/.github/workflows/e2e-tests.yaml index daee4a513..2dfb50cb2 100644 --- a/.github/workflows/e2e-tests.yaml +++ b/.github/workflows/e2e-tests.yaml @@ -23,7 +23,6 @@ jobs: fail-fast: false matrix: php: - - '8.1' - '8.2' steps: - name: Checkout @@ -88,14 +87,13 @@ jobs: - 'e2e_036' - 'e2e_037' php: - - '8.1' - '8.2' composer: - 'composer:2.2' - 'composer' include: - e2e: 'e2e_039' - php: '8.1' + php: '8.2' composer: 'composer:2.2' steps: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ee0c79b14..a4dbe4feb 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -24,7 +24,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' tools: composer coverage: none @@ -48,7 +48,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' tools: composer coverage: none @@ -72,7 +72,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' tools: composer coverage: none diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2df379852..f86ff1f43 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -32,7 +32,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' ini-values: phar.readonly=0 tools: composer coverage: none @@ -105,6 +105,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + - uses: actions/download-artifact@v3 with: name: php-scoper-phar diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4d5d75f6b..414c61add 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -67,7 +67,6 @@ jobs: fail-fast: false matrix: php: - - '8.1' - '8.2' steps: - name: Checkout diff --git a/.gitignore b/.gitignore index b8b62a56c..d14abc9e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ +!/bin/infection.sh +!/bin/php-scoper /.box_dump/ /.php-cs-fixer.cache /.phpcs-cache /.phpunit* /bin/* -!/bin/infection.sh -!/bin/php-scoper /box.json /clover.xml /fixtures/*/.box_dump/ diff --git a/Dockerfile b/Dockerfile index 99a65b147..c1dc31a33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-cli-alpine +FROM php:8.2-cli-alpine COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions zlib phar sodium tokenizer filter diff --git a/composer-root-version-checker/composer.json b/composer-root-version-checker/composer.json index 375da6508..f8e94bf8e 100644 --- a/composer-root-version-checker/composer.json +++ b/composer-root-version-checker/composer.json @@ -3,7 +3,7 @@ "description": "Small utility to manipulate the Composer root version.", "license": "proprietary", "require": { - "php": "^8.1", + "php": "^8.2", "psr/log": "^3.0", "thecodingmachine/safe": "^2.4" }, diff --git a/composer-root-version-checker/composer.lock b/composer-root-version-checker/composer.lock index 64360bf53..670e68faa 100644 --- a/composer-root-version-checker/composer.lock +++ b/composer-root-version-checker/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8f5e81836ccdeb10f5b67efeb8f94470", + "content-hash": "96355037b11a6c7f48a80dc1f0b58249", "packages": [ { "name": "psr/log", @@ -2558,8 +2558,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.1" + "php": "^8.2" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/composer.json b/composer.json index b335abd4c..cd7f62a02 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "fidry/console": "^0.5.0", "fidry/filesystem": "^1.1", "jetbrains/phpstorm-stubs": "^v2022.2", @@ -67,7 +67,7 @@ }, "bin-dir": "bin", "platform": { - "php": "8.1.0" + "php": "8.2.0" }, "sort-packages": true }, diff --git a/composer.lock b/composer.lock index f8a78631c..e7cbee4cb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "23f592be2a5824006d8de3026549f1f6", + "content-hash": "7a5cea95235ea68753cb46c0b74459d9", "packages": [ { "name": "fidry/console", @@ -5631,11 +5631,11 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.1" + "php": "^8.2" }, "platform-dev": [], "platform-overrides": { - "php": "8.1.0" + "php": "8.2.0" }, "plugin-api-version": "2.6.0" } diff --git a/rector.php b/rector.php index b431e10bd..d127eeed6 100644 --- a/rector.php +++ b/rector.php @@ -21,9 +21,27 @@ $rectorConfig->sets([ LevelSetList::UP_TO_PHP_81, + LevelSetList::UP_TO_PHP_82, ]); $rectorConfig->skip([ - 'NullToStrictStringFuncCallArgRector' + __DIR__.'/src/PhpParser/TraverserFactory.php', + __DIR__.'/tests/PhpParser/UseStmtNameTest.php', + __DIR__.'/src/PhpParser/NodeVisitor/AttributeAppender/ParentNodeAppender.php', + + \Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector::class, + \Rector\Php73\Rector\String_\SensitiveHereNowDocRector::class, + \Rector\Php81\Rector\ClassMethod\NewInInitializerRector::class => [ + __DIR__.'/src/Configuration/Configuration.php', + ], + \Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class => [ + __DIR__.'/src/Configuration/Configuration.php', + ], + \Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class => [ + __DIR__.'/tests/Symbol/NamespaceRegistryTest.php', + __DIR__.'/tests/Symbol/Reflector/UserSymbolsReflectorTest.php', + __DIR__.'/tests/Symbol/SymbolRegistryTest.php', + __DIR__.'/tests/Symbol/SymbolsRegistryTest.php', + ], ]); }; diff --git a/src/Autoload/ComposerFileHasher.php b/src/Autoload/ComposerFileHasher.php index ea8a24b67..c44940672 100644 --- a/src/Autoload/ComposerFileHasher.php +++ b/src/Autoload/ComposerFileHasher.php @@ -20,7 +20,7 @@ use function preg_match; use function sprintf; -final class ComposerFileHasher +final readonly class ComposerFileHasher { private const ROOT_PACKAGE_NAME = '__root__'; private const PACKAGE_PATH_REGEX = '~^%s/(?[^/]+?/[^/]+?)/(?.+?)$~'; diff --git a/src/Configuration/ConfigurationFactory.php b/src/Configuration/ConfigurationFactory.php index 38ffcdf39..5a0da2fb3 100644 --- a/src/Configuration/ConfigurationFactory.php +++ b/src/Configuration/ConfigurationFactory.php @@ -51,13 +51,13 @@ use function trim; use const DIRECTORY_SEPARATOR; -final class ConfigurationFactory +final readonly class ConfigurationFactory { public const DEFAULT_FILE_NAME = 'scoper.inc.php'; public function __construct( - private readonly Filesystem $fileSystem, - private readonly SymbolsConfigurationFactory $symbolsConfigurationFactory, + private Filesystem $fileSystem, + private SymbolsConfigurationFactory $symbolsConfigurationFactory, ) { } diff --git a/src/Configuration/SymbolsConfiguration.php b/src/Configuration/SymbolsConfiguration.php index dec9e8540..7d63f2bb8 100644 --- a/src/Configuration/SymbolsConfiguration.php +++ b/src/Configuration/SymbolsConfiguration.php @@ -18,7 +18,7 @@ use Humbug\PhpScoper\Symbol\NamespaceRegistry; use Humbug\PhpScoper\Symbol\SymbolRegistry; -final class SymbolsConfiguration +final readonly class SymbolsConfiguration { use NotInstantiable; diff --git a/src/Configuration/SymbolsConfigurationFactory.php b/src/Configuration/SymbolsConfigurationFactory.php index 7ef3040ee..0a9e33807 100644 --- a/src/Configuration/SymbolsConfigurationFactory.php +++ b/src/Configuration/SymbolsConfigurationFactory.php @@ -29,9 +29,9 @@ use function strrpos; use function substr; -final class SymbolsConfigurationFactory +final readonly class SymbolsConfigurationFactory { - public function __construct(private readonly RegexChecker $regexChecker) + public function __construct(private RegexChecker $regexChecker) { } diff --git a/src/Console/Application.php b/src/Console/Application.php index f652c6f20..91251057d 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -30,7 +30,7 @@ * @private * @codeCoverageIgnore */ -final class Application implements FidryApplication +final readonly class Application implements FidryApplication { private const LOGO = <<<'ASCII' @@ -60,11 +60,11 @@ public static function create(): self } public function __construct( - private readonly Container $container, - private readonly string $version, - private readonly string $releaseDate, - private readonly bool $isAutoExitEnabled, - private readonly bool $areExceptionsCaught, + private Container $container, + private string $version, + private string $releaseDate, + private bool $isAutoExitEnabled, + private bool $areExceptionsCaught, ) { } diff --git a/src/Console/Command/InitCommand.php b/src/Console/Command/InitCommand.php index f82434a6b..cc759fcbb 100644 --- a/src/Console/Command/InitCommand.php +++ b/src/Console/Command/InitCommand.php @@ -15,7 +15,6 @@ namespace Humbug\PhpScoper\Console\Command; use Fidry\Console\Command\Command; -use Fidry\Console\Command\Configuration; use Fidry\Console\Command\Configuration as CommandConfiguration; use Fidry\Console\Input\IO; use Symfony\Component\Console\Helper\FormatterHelper; @@ -30,21 +29,21 @@ * @private * @codeCoverageIgnore */ -final class InitCommand implements Command +final readonly class InitCommand implements Command { private const CONFIG_FILE_OPT = 'config'; private const CONFIG_FILE_TEMPLATE = __DIR__.'/../../scoper.inc.php.tpl'; private const CONFIG_FILE_DEFAULT = 'scoper.inc.php'; public function __construct( - private readonly Filesystem $fileSystem, - private readonly FormatterHelper $formatterHelper, + private Filesystem $fileSystem, + private FormatterHelper $formatterHelper, ) { } public function getConfiguration(): CommandConfiguration { - return new Configuration( + return new CommandConfiguration( 'init', 'Generates a configuration file.', '', diff --git a/src/Console/Command/InspectSymbolCommand.php b/src/Console/Command/InspectSymbolCommand.php index f46172807..5c3e16eb9 100644 --- a/src/Console/Command/InspectSymbolCommand.php +++ b/src/Console/Command/InspectSymbolCommand.php @@ -41,7 +41,7 @@ /** * @private */ -final class InspectSymbolCommand implements Command +final readonly class InspectSymbolCommand implements Command { private const SYMBOL_ARG = 'symbol'; private const SYMBOL_TYPE_ARG = 'type'; @@ -49,9 +49,9 @@ final class InspectSymbolCommand implements Command private const NO_CONFIG_OPT = 'no-config'; public function __construct( - private readonly Filesystem $fileSystem, - private readonly ConfigurationFactory $configFactory, - private readonly EnrichedReflectorFactory $enrichedReflectorFactory, + private Filesystem $fileSystem, + private ConfigurationFactory $configFactory, + private EnrichedReflectorFactory $enrichedReflectorFactory, ) { } diff --git a/src/Console/ConfigLoader.php b/src/Console/ConfigLoader.php index ff3c7883d..7fc14d5a0 100644 --- a/src/Console/ConfigLoader.php +++ b/src/Console/ConfigLoader.php @@ -33,12 +33,12 @@ /** * @private */ -final class ConfigLoader +final readonly class ConfigLoader { public function __construct( - private readonly CommandRegistry $commandRegistry, - private readonly Filesystem $fileSystem, - private readonly ConfigurationFactory $configFactory, + private CommandRegistry $commandRegistry, + private Filesystem $fileSystem, + private ConfigurationFactory $configFactory, ) { } diff --git a/src/Console/ConsoleScoper.php b/src/Console/ConsoleScoper.php index bdc8d922f..5e484a05e 100644 --- a/src/Console/ConsoleScoper.php +++ b/src/Console/ConsoleScoper.php @@ -43,14 +43,14 @@ /** * @private */ -final class ConsoleScoper +final readonly class ConsoleScoper { private const VENDOR_DIR_PATTERN = '~((?:.*)\\'.DIRECTORY_SEPARATOR.'vendor)\\'.DIRECTORY_SEPARATOR.'.*~'; public function __construct( - private readonly Filesystem $fileSystem, - private readonly Application $application, - private readonly ScoperFactory $scoperFactory, + private Filesystem $fileSystem, + private Application $application, + private ScoperFactory $scoperFactory, ) { } diff --git a/src/Patcher/PatcherChain.php b/src/Patcher/PatcherChain.php index 4d7f99a9a..27806bae4 100644 --- a/src/Patcher/PatcherChain.php +++ b/src/Patcher/PatcherChain.php @@ -16,7 +16,7 @@ use function array_reduce; -final class PatcherChain implements Patcher +final readonly class PatcherChain implements Patcher { /** * @param array<(callable(string, string, string): string)|Patcher> $patchers diff --git a/src/PhpParser/NodeTraverser.php b/src/PhpParser/NodeTraverser.php index 0e7efdd4b..666e58072 100644 --- a/src/PhpParser/NodeTraverser.php +++ b/src/PhpParser/NodeTraverser.php @@ -35,9 +35,9 @@ /** * @private */ -final class NodeTraverser implements NodeTraverserInterface +final readonly class NodeTraverser implements NodeTraverserInterface { - public function __construct(private readonly NodeTraverserInterface $decoratedTraverser) + public function __construct(private NodeTraverserInterface $decoratedTraverser) { } diff --git a/src/PhpParser/NodeVisitor/Resolver/IdentifierResolver.php b/src/PhpParser/NodeVisitor/Resolver/IdentifierResolver.php index 9547769f3..e5c912c33 100644 --- a/src/PhpParser/NodeVisitor/Resolver/IdentifierResolver.php +++ b/src/PhpParser/NodeVisitor/Resolver/IdentifierResolver.php @@ -32,9 +32,9 @@ * * @private */ -final class IdentifierResolver +final readonly class IdentifierResolver { - public function __construct(private readonly NameResolver $nameResolver) + public function __construct(private NameResolver $nameResolver) { } diff --git a/src/PhpParser/Printer/StandardPrinter.php b/src/PhpParser/Printer/StandardPrinter.php index d0d6aae66..07e3b6cd4 100644 --- a/src/PhpParser/Printer/StandardPrinter.php +++ b/src/PhpParser/Printer/StandardPrinter.php @@ -16,9 +16,9 @@ use PhpParser\PrettyPrinterAbstract; -final class StandardPrinter implements Printer +final readonly class StandardPrinter implements Printer { - public function __construct(private readonly PrettyPrinterAbstract $decoratedPrinter) + public function __construct(private PrettyPrinterAbstract $decoratedPrinter) { } diff --git a/src/PhpParser/StringNodePrefixer.php b/src/PhpParser/StringNodePrefixer.php index c2c68084c..d70cda0ab 100644 --- a/src/PhpParser/StringNodePrefixer.php +++ b/src/PhpParser/StringNodePrefixer.php @@ -22,9 +22,9 @@ /** * @private */ -final class StringNodePrefixer +final readonly class StringNodePrefixer { - public function __construct(private readonly PhpScoper $scoper) + public function __construct(private PhpScoper $scoper) { } @@ -40,7 +40,7 @@ public function prefixStringValue(String_ $node): void } $node->value = $newValue; - } catch (PhpParserError $error) { + } catch (PhpParserError) { // Continue without scoping the heredoc which for some reasons contains invalid PHP code } } diff --git a/src/PhpParser/UseStmtName.php b/src/PhpParser/UseStmtName.php index 6739c8703..fab0b1ca9 100644 --- a/src/PhpParser/UseStmtName.php +++ b/src/PhpParser/UseStmtName.php @@ -21,9 +21,9 @@ use function count; use function sprintf; -final class UseStmtName +final readonly class UseStmtName { - public function __construct(private readonly Name $name) + public function __construct(private Name $name) { } diff --git a/src/Scoper/Composer/AutoloadPrefixer.php b/src/Scoper/Composer/AutoloadPrefixer.php index 74afc85b6..a5e57a841 100644 --- a/src/Scoper/Composer/AutoloadPrefixer.php +++ b/src/Scoper/Composer/AutoloadPrefixer.php @@ -29,11 +29,11 @@ /** * @private */ -final class AutoloadPrefixer +final readonly class AutoloadPrefixer { public function __construct( - private readonly string $prefix, - private readonly EnrichedReflector $enrichedReflector, + private string $prefix, + private EnrichedReflector $enrichedReflector, ) { } diff --git a/src/Scoper/Composer/InstalledPackagesScoper.php b/src/Scoper/Composer/InstalledPackagesScoper.php index 2ec8160e1..17b8f3ad2 100644 --- a/src/Scoper/Composer/InstalledPackagesScoper.php +++ b/src/Scoper/Composer/InstalledPackagesScoper.php @@ -27,13 +27,13 @@ use const JSON_PRETTY_PRINT; use const JSON_THROW_ON_ERROR; -final class InstalledPackagesScoper implements Scoper +final readonly class InstalledPackagesScoper implements Scoper { private const COMPOSER_INSTALLED_FILE_PATTERN = '/composer(\/|\\\\)installed\.json$/'; public function __construct( - private readonly Scoper $decoratedScoper, - private readonly AutoloadPrefixer $autoloadPrefixer, + private Scoper $decoratedScoper, + private AutoloadPrefixer $autoloadPrefixer, ) { } diff --git a/src/Scoper/Composer/JsonFileScoper.php b/src/Scoper/Composer/JsonFileScoper.php index ba6023587..13081cbfc 100644 --- a/src/Scoper/Composer/JsonFileScoper.php +++ b/src/Scoper/Composer/JsonFileScoper.php @@ -25,11 +25,11 @@ use const JSON_PRETTY_PRINT; use const JSON_THROW_ON_ERROR; -final class JsonFileScoper implements Scoper +final readonly class JsonFileScoper implements Scoper { public function __construct( - private readonly Scoper $decoratedScoper, - private readonly AutoloadPrefixer $autoloadPrefixer, + private Scoper $decoratedScoper, + private AutoloadPrefixer $autoloadPrefixer, ) { } diff --git a/src/Scoper/PatchScoper.php b/src/Scoper/PatchScoper.php index c0fad5af3..9ccd9d045 100644 --- a/src/Scoper/PatchScoper.php +++ b/src/Scoper/PatchScoper.php @@ -17,12 +17,12 @@ use Humbug\PhpScoper\Patcher\Patcher; use function func_get_args; -final class PatchScoper implements Scoper +final readonly class PatchScoper implements Scoper { public function __construct( - private readonly Scoper $decoratedScoper, - private readonly string $prefix, - private readonly Patcher $patcher, + private Scoper $decoratedScoper, + private string $prefix, + private Patcher $patcher, ) { } diff --git a/src/Scoper/PhpScoper.php b/src/Scoper/PhpScoper.php index 3d5b48d13..c7366202e 100644 --- a/src/Scoper/PhpScoper.php +++ b/src/Scoper/PhpScoper.php @@ -25,7 +25,7 @@ use function ltrim; use function preg_match as native_preg_match; -final class PhpScoper implements Scoper +final readonly class PhpScoper implements Scoper { private const FILE_PATH_PATTERN = '/\.php$/'; private const NOT_FILE_BINARY = '/\..+?$/'; @@ -33,11 +33,11 @@ final class PhpScoper implements Scoper private const PHP_BINARY = '/^#!.+?php.*\n{1,}<\?php/'; public function __construct( - private readonly Parser $parser, - private readonly Scoper $decoratedScoper, - private readonly TraverserFactory $traverserFactory, - private readonly Printer $printer, - private readonly Lexer $lexer, + private Parser $parser, + private Scoper $decoratedScoper, + private TraverserFactory $traverserFactory, + private Printer $printer, + private Lexer $lexer, ) { } diff --git a/src/Scoper/Symfony/XmlScoper.php b/src/Scoper/Symfony/XmlScoper.php index ba836e0fe..e15dd2fdc 100644 --- a/src/Scoper/Symfony/XmlScoper.php +++ b/src/Scoper/Symfony/XmlScoper.php @@ -31,17 +31,17 @@ /** * Scopes the Symfony XML configuration files. */ -final class XmlScoper implements Scoper +final readonly class XmlScoper implements Scoper { private const XML_EXTENSION_REGEX = '/\.xml$/i'; private const NAMESPACE_PATTERN = '/(?:[^\\\\]+(?\\\\(?:\\\\)?))))"/'; private const SINGLE_CLASS_PATTERN = '/(?:(?(?:[\p{L}_\d]+(?\\\\(?:\\\\)?))):)|(?(?:[\p{L}_\d]+(?\\\\(?:\\\\)?)+)+[\p{L}_\d]+)/u'; public function __construct( - private readonly Scoper $decoratedScoper, - private readonly string $prefix, - private readonly EnrichedReflector $enrichedReflector, - private readonly SymbolsRegistry $symbolsRegistry, + private Scoper $decoratedScoper, + private string $prefix, + private EnrichedReflector $enrichedReflector, + private SymbolsRegistry $symbolsRegistry, ) { } diff --git a/src/Scoper/Symfony/YamlScoper.php b/src/Scoper/Symfony/YamlScoper.php index d9d0e898c..8d703bacc 100644 --- a/src/Scoper/Symfony/YamlScoper.php +++ b/src/Scoper/Symfony/YamlScoper.php @@ -31,16 +31,16 @@ /** * Scopes the Symfony YAML configuration files. */ -final class YamlScoper implements Scoper +final readonly class YamlScoper implements Scoper { private const YAML_EXTENSION_REGEX = '/\.ya?ml$/i'; private const CLASS_PATTERN = '/(?:(?(?:[\p{L}_\d]+(?\\\\(?:\\\\)?))):)|(?(?:[\p{L}_\d]+(?\\\\(?:\\\\)?)+)+[\p{L}_\d]+)/u'; public function __construct( - private readonly Scoper $decoratedScoper, - private readonly string $prefix, - private readonly EnrichedReflector $enrichedReflector, - private readonly SymbolsRegistry $symbolsRegistry, + private Scoper $decoratedScoper, + private string $prefix, + private EnrichedReflector $enrichedReflector, + private SymbolsRegistry $symbolsRegistry, ) { } diff --git a/src/Symbol/EnrichedReflector.php b/src/Symbol/EnrichedReflector.php index 96eb7b096..815b34887 100644 --- a/src/Symbol/EnrichedReflector.php +++ b/src/Symbol/EnrichedReflector.php @@ -29,7 +29,7 @@ * - exposed symbols * - whether symbols from the global namespace should be exposed or not */ -final class EnrichedReflector +final readonly class EnrichedReflector { public function __construct( private Reflector $reflector, diff --git a/src/Symbol/EnrichedReflectorFactory.php b/src/Symbol/EnrichedReflectorFactory.php index d83f5aa6c..00d4794b4 100644 --- a/src/Symbol/EnrichedReflectorFactory.php +++ b/src/Symbol/EnrichedReflectorFactory.php @@ -16,7 +16,7 @@ use Humbug\PhpScoper\Configuration\SymbolsConfiguration; -final class EnrichedReflectorFactory +final readonly class EnrichedReflectorFactory { public function __construct(private Reflector $reflector) { diff --git a/src/Symbol/NamespaceRegistry.php b/src/Symbol/NamespaceRegistry.php index c9cda0e41..31674bec9 100644 --- a/src/Symbol/NamespaceRegistry.php +++ b/src/Symbol/NamespaceRegistry.php @@ -28,7 +28,7 @@ use function trim; use const SORT_STRING; -final class NamespaceRegistry +final readonly class NamespaceRegistry { private bool $containsGlobalNamespace; diff --git a/src/Symbol/Reflector.php b/src/Symbol/Reflector.php index e57cf04e1..4b9be499b 100644 --- a/src/Symbol/Reflector.php +++ b/src/Symbol/Reflector.php @@ -23,7 +23,7 @@ /** * @private */ -final class Reflector +final readonly class Reflector { private const MISSING_CLASSES = [ // https://youtrack.jetbrains.com/issue/WI-29503 diff --git a/src/Symbol/SymbolRegistry.php b/src/Symbol/SymbolRegistry.php index bdf9048fd..c89dfa7ac 100644 --- a/src/Symbol/SymbolRegistry.php +++ b/src/Symbol/SymbolRegistry.php @@ -33,7 +33,7 @@ final class SymbolRegistry /** * @var array */ - private array $names; + private readonly array $names; /** * @param string[] $names @@ -74,8 +74,8 @@ public static function createForConstants( */ private function __construct( array $names, - private array $regexes, - private bool $constants + private readonly array $regexes, + private readonly bool $constants ) { $this->names = array_flip($names);