Skip to content

Commit 1daa23a

Browse files
ondrejmirtesclaude
andcommitted
Add the neon2attributes command migrating NEON service registrations to attributes
Deterministically converts services:/rules: entries into #[AutowiredService], #[NonAutowiredService], #[RegisteredRule(level: 0)], #[RegisteredCollector] and #[AutowiredParameter] on the classes, declares the edited directories in attributeServicesDirectories, and leaves everything it cannot express (setup, literal arguments, underivable tags, multi-registration, vendor classes) in place with the reason reported. PHP edits are position-guided line insertions (php-parser locates, plain text edits), NEON edits are order-mapped line surgery that aborts on any layout it cannot map. Before keeping the changes the command compiles the original and the converted configuration in fresh subprocesses (the current process has the classes loaded without the new attributes) and requires an identical tagged-services fingerprint, rolling everything back otherwise. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vw4RxhEifXdnTPw57hG3Vw
1 parent 4403454 commit 1daa23a

20 files changed

Lines changed: 1874 additions & 8 deletions

‎bin/phpstan‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use PHPStan\Command\ClearResultCacheCommand;
77
use PHPStan\Command\DiagnoseCommand;
88
use PHPStan\Command\DumpParametersCommand;
99
use PHPStan\Command\FixerWorkerCommand;
10+
use PHPStan\Command\Neon2AttributesCommand;
1011
use PHPStan\Command\WorkerCommand;
1112
use PHPStan\Internal\ComposerHelper;
1213
use PHPStan\Turbo\TurboExtensionEnabler;
@@ -127,5 +128,6 @@ use Symfony\Component\Console\Helper\ProgressBar;
127128
$application->add(new FixerWorkerCommand($reversedComposerAutoloaderProjectPaths));
128129
$application->add(new DumpParametersCommand($reversedComposerAutoloaderProjectPaths));
129130
$application->add(new DiagnoseCommand($reversedComposerAutoloaderProjectPaths));
131+
$application->add(new Neon2AttributesCommand());
130132
$application->run();
131133
})();

0 commit comments

Comments
 (0)