Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/Provider/NetteUsageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private function getMagicProperties(ClassReflection $reflection): array
}

preg_match_all(
'~^ [ \t*]* @property(|-read|-write|-deprecated) [ \t]+ [^\s$]+ [ \t]+ \$ (\w+) ()~mx',
'~^ [ \t*]* @property(|-read|-write|-deprecated) [ \t]+ (?:(?!@)[^\s$*]+[\s*]+)++ \$ (\w+) ()~mx',
(string) $rc->getDocComment(),
$matches,
PREG_SET_ORDER,
Expand Down
31 changes: 31 additions & 0 deletions tests/Rule/data/providers/nette.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public function HandleCaseInsensitive() { // upper-cased 'H': Nette resolves sig
/**
* @property float $radius
* @property-read bool $visible
* @property array<string, string> $labels
* @property array{
* x: float,
* y: float,
* } $center
*/
class Circle
{
Expand All @@ -56,9 +61,35 @@ protected function isVisible(): bool
{
return $this->radius > 0;
}

/**
* @return array<string, string>
*/
protected function getLabels(): array
{
return [];
}

/**
* @param array<string, string> $labels
*/
protected function setLabels(array $labels): void
{
}

/**
* @return array{x: float, y: float}
*/
protected function getCenter(): array
{
return ['x' => 0.0, 'y' => 0.0];
}
}

$circle = new Circle;
$circle->radius = 10; // actually calls setRadius(10)
echo $circle->radius; // calls getRadius()
echo $circle->visible; // calls isVisible()
$circle->labels = ['color' => 'red']; // calls setLabels()
print_r($circle->labels); // calls getLabels()
echo $circle->center['x']; // calls getCenter()
Loading