mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 03:40:50 +00:00
[Php81] Skip static property on ReadOnlyPropertyRector (#1939)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
906f038f42
commit
f7e1035828
4
ecs.php
4
ecs.php
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PhpCsFixer\Fixer\Basic\BracesFixer;
|
||||
use PhpCsFixer\Fixer\FunctionNotation\FunctionTypehintSpaceFixer;
|
||||
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
|
||||
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
|
||||
|
@ -76,6 +77,9 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
__DIR__ . '/src/DependencyInjection/Loader/Configurator/RectorServiceConfigurator.php',
|
||||
__DIR__ . '/rules/Php70/EregToPcreTransformer.php',
|
||||
],
|
||||
|
||||
// buggy - cause { inlined
|
||||
BracesFixer::class,
|
||||
]);
|
||||
|
||||
// import SetList here in the end of ecs. is on purpose
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
use stdClass;
|
||||
|
||||
final class SkipStaticProperty
|
||||
{
|
||||
private static stdClass $x;
|
||||
|
||||
public function __construct(stdClass $x)
|
||||
{
|
||||
self::$x = $x;
|
||||
}
|
||||
|
||||
public static function x(): stdClass
|
||||
{
|
||||
return self::$x;
|
||||
}
|
||||
}
|
|
@ -117,6 +117,10 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if ($property->isStatic()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->visibilityManipulator->makeReadonly($property);
|
||||
|
||||
$attributeGroups = $property->attrGroups;
|
||||
|
|
|
@ -17,7 +17,7 @@ abstract class AbstractProcessCommand extends Command
|
|||
protected ConfigurationFactory $configurationFactory;
|
||||
|
||||
#[Required]
|
||||
public function autowire(ConfigurationFactory $configurationFactory,): void
|
||||
public function autowire(ConfigurationFactory $configurationFactory): void
|
||||
{
|
||||
$this->configurationFactory = $configurationFactory;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user