Skip to content

Commit

Permalink
Property isAlwaysWritten calls isInitialized as it's same check. Drop…
Browse files Browse the repository at this point in the history
… IPresenter implements requirement.
  • Loading branch information
rattuscz authored and ondrejmirtes committed Dec 3, 2020
1 parent 7fc88eb commit 348cb61
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Rule/Nette/PresenterInjectedPropertiesExtension.php
Expand Up @@ -15,13 +15,12 @@ public function isAlwaysRead(PropertyReflection $property, string $propertyName)

public function isAlwaysWritten(PropertyReflection $property, string $propertyName): bool
{
return false;
return $this->isInitialized($property, $propertyName);
}

public function isInitialized(PropertyReflection $property, string $propertyName): bool
{
return $property->isPublic() &&
$property->getDeclaringClass()->implementsInterface('Nette\Application\IPresenter') &&
strpos($property->getDocComment() ?? '', '@inject') !== false;
}

Expand Down

0 comments on commit 348cb61

Please sign in to comment.