-
-
Notifications
You must be signed in to change notification settings - Fork 739
Incorrect behavior of StrictStringParamConcatRector #9691
Copy link
Copy link
Closed
rectorphp/rector-src
#7927Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/d26470d6-7392-4e21-ad13-c3b5106408ac
Code:
<?php
final class DemoFile
{
public function resolve($item)
{
return $item . ' world';
}
}Config:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictStringParamConcatRector;
use Rector\ValueObject\PhpVersion;
return RectorConfig::configure()
->withRules([
// 'string' type declaration is not available in PHP version 5.6 or earlier
StrictStringParamConcatRector::class
])
// specific PHP version
->withPhpVersion(PhpVersion::PHP_54);Result:
final class DemoFile
{
- public function resolve($item)
+ public function resolve(string $item)
{
return $item . ' world';
}
}Responsible rules
StrictStringParamConcatRector
Expected Behavior
string type declaration is not available in PHP version 5.6 or earlier
Reactions are currently unavailable