-
-
Notifications
You must be signed in to change notification settings - Fork 738
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | 1.2.2 |
| PHP runtime | 8.3.8 |
I want to make sure my code base is compatible with php 8.4 - although there is just the first RC for it. So I thought I'll enable the php set "php8.4: True" and all rules will be running turning my code php 8.4 compatible ... well as far as rules are already in rector. I was especially interested in the ExplicitNullableParamTypeRector because I suspected a lot of needed changes...
Minimal PHP Code Causing Issue
Use this rector.php:
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPaths(
[
__DIR__ . '/src',
]
)
->withPhpSets(
php84: True
);
With this class:
<?php
declare(strict_types=1);
class MyTest
{
protected static string $suffix = '';
public static function setSuffix(string $suffix = null): void
{
self::$suffix = $suffix ?? '';
}
}
Expected Behaviour
I'd expect rector to refactor the function to something this:
public static function setSuffix(?string $suffix = null): void
Alas ... it didnt. It just let it through and said everything is OK.
Debugging the code I found that provideMinPhpVersion() of this rector rule returns 80400 and since my php runtime version is 8.3.8 it didnt enable this rule.
I suspect provideMinPhpVersion() is meant to provide the minimum php version the refactored code of this rule will run. This should not be 8.4, but 8.0 I think?