Leaner PHPDoc stack and a fluent composer-based config 🚀
This release leans on phpstan/phpdoc-parser directly: Rector drops its own forked parser, printer, token iterator and type-node subclasses, and reuses the upstream parser, format-preserving printer, node traverser and type nodes. Fewer moving parts, one source of truth for PHPDoc handling, and it rides the PHPStan 2.3.3 bump. Thanks @ondrejmirtes.
On the config side, withComposerBased() now auto-detects installed packages when called with no argument, and a fluent withComposerBasedRule() builder lands across core and the rector-* sets.
New features 🥳
- Add
withComposerBasedRule()to the fluentRectorConfig::configure()builder (#8875) - [Configuration] Auto-detect installed packages in
withComposerBased()called with no argument (#8748) Thanks @MadBox-99 - [TypeDeclaration] Prefer same-namespace classes over global PHPDoc types (#8869) Thanks @MohannadElemary
- [dx] Report rule-scoped skips that matched a file but never changed it (#8853)
Performance Improvements 🚀
- Reduce memory usage on the LPT bucket by recycling workers and keeping files in discovery order (#8867) Thanks @samsonasik
- Cache skip-filtered rules per node class for the current file in
RectorRegistry::forNodeAndFile()(#8860) Thanks @samsonasik - Remove unneeded
array_values()when arrays are already lists or called too early (#8857) Thanks @samsonasik
Bugfixes 🐛
- [Php80]
TernaryToNullsafeCoalesceRector: fix a redundant nullsafe property access under coalesce (#8864) - [Php71]
BinaryOpBetweenNumberAndStringRector: skip an array dim fetch (#8862) - Resolve the item type of a union of arrays in
ArrayCallbackParamTypeResolver(#8874) Thanks @SanderMuller - Sort root files in
withRootFiles()to keep the cache hash stable (#8870) Thanks @M-arcus - Keep fixture lock files out of fixture directories (#8873) Thanks @localheinz
- Check the configuration cache only in the main process (#8851) Thanks @SanderMuller
- Restore
preload-split-package.phpto fix a PHPStan Turbo notice onrector-*packages (#8865) Thanks @samsonasik - Fix Windows CI tests under PHPStan Turbo (#8866, #8868) Thanks @samsonasik
Internals ⚙️
- Use the
phpstan/phpdoc-parserstack directly: parser without subclass, format-preserving printer,NodeTraverser, and move union dedup/array printing into type mappers (#8871, #8863, #8855, #8858) Thanks @ondrejmirtes - Remove the forked
BetterTokenIterator, theBracketsAwareIntersectionTypeNode, and type-node subclasses that only changed__toString()(#8856, #8876, #8872) Thanks @ondrejmirtes - Bump to PHPStan 2.3.3 and remove stale workarounds (#8859) Thanks @ondrejmirtes
- [cs] Apply the no-slash rule (#8852)
rector-doctrine 🟠
- Collapse an intersection with a single type, like a union (#541) Thanks @ondrejmirtes
- Use the fluent
withComposerBasedRule()in the composer-based set (#542)
rector-symfony 🎵
- Support converting
EventSubscriberInterfacetoAsEventListenerattributes (#1094) - Add
RequestQueryToMapQueryParameterRector(#1089) Thanks @Rajekevin - [Symfony34]
ContainerGetNameToTypeInTestsRector: skip when the FQCN service is not the named service (#1093) Thanks @jdreesen - Remove deprecated rules from the Rector
withSkip(#1096) - Use
PhpVersionconstants directly instead of the deprecatedPhpVersionFeature(#1095) - Use the new
Class_namespace forChangeMethodVisibilityRector(#1092) - Use the fluent
withComposerBasedRule()in the composer-based sets (#1098)
rector-phpunit 🟢
- Use
IntersectionTypeNodefromphpstan/phpdoc-parserand update fixtures for the new printer (#815, #814) Thanks @ondrejmirtes - Use the fluent
withComposerBasedRule()in the composer-based set (#816)
rector-downgrade-php ⬇️
- Update fixtures for the
phpstan/phpdoc-parserprinter, printing intersections without redundant brackets (#420) Thanks @ondrejmirtes