Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Rector\Tests\DeadCode\Rector\Property\RemoveDefaultValueFromAssignedPropertyRector\Fixture;

final class SkipStaticProperty
{
private static ?int $value = null;

public function __construct(int $value)
{
self::$value = $value;
}

public static function getValue(): ?int
{
return self::$value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public function refactor(Node $node): ?Node
continue;
}

// static property can be read before the constructor is called
if ($property->isStatic()) {
continue;
}

if (! $property->isPrivate() && ! $isFinal) {
continue;
}
Expand Down
Loading