Code Modernizing / Config, does not behave as expected #8823
-
Assuming the following config: ->withPhpSets(
//Max Optimized PHP Version, with all new features/optimizations enabled, but limited to withPhpVersion features
php84: true
)
//Max PHP Verision we want to be compatible with, rector will not use any features above this version
->withPhpVersion(PhpVersion::PHP_81); I would expect: Do i misunderstand the configurations? (see comments) Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
For that, it is better to you need to use php 8.4 runtime, otherwise, it may cause unexpected error, eg on required after optional, see https://3v4l.org/5jms6, without nullable, it is working https://3v4l.org/4O5MK, that's why upgrade php step by step is better, to ensure per-feature applied correctly in order. But if you want it so hard, you can do something like: <?php
return \Rector\Config\RectorConfig::configure()
->withPaths([__DIR__ . '/src'])
->withPhpSets(php83: true)
->withPhpVersion(\Rector\ValueObject\PhpVersion::PHP_84)
->withRules([
\Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector::class,
]); with the risk is on yours, see answer at issue #8761 (comment) |
Beta Was this translation helpful? Give feedback.
For that, it is better to you need to use php 8.4 runtime, otherwise, it may cause unexpected error, eg on required after optional, see https://3v4l.org/5jms6, without nullable, it is working https://3v4l.org/4O5MK, that's why upgrade php step by step is better, to ensure per-feature applied correctly in order.
But if you want it so hard, you can do something like:
with the risk is on yours, see answer at issue