Skip to content

Commit

Permalink
ClassReflection - do not execute properties extensions on PHP 8.2 if …
Browse files Browse the repository at this point in the history
…the class does not allow dynamic properties
  • Loading branch information
ondrejmirtes committed Sep 22, 2022
1 parent 2050df8 commit a628fb3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Reflection/ClassReflection.php
Expand Up @@ -365,7 +365,10 @@ public function hasProperty(string $propertyName): bool
return $this->hasNativeProperty($propertyName);
}

foreach ($this->propertiesClassReflectionExtensions as $extension) {
foreach ($this->propertiesClassReflectionExtensions as $i => $extension) {
if ($i > 0 && !$this->allowsDynamicProperties()) {
continue;
}
if ($extension->hasProperty($this, $propertyName)) {
return true;
}
Expand Down Expand Up @@ -514,7 +517,10 @@ public function getProperty(string $propertyName, ClassMemberAccessAnswerer $sco
$key = sprintf('%s-%s', $key, $scope->getClassReflection()->getCacheKey());
}
if (!isset($this->properties[$key])) {
foreach ($this->propertiesClassReflectionExtensions as $extension) {
foreach ($this->propertiesClassReflectionExtensions as $i => $extension) {
if ($i > 0 && !$this->allowsDynamicProperties()) {
continue;
}
if (!$extension->hasProperty($this, $propertyName)) {
continue;
}
Expand Down

0 comments on commit a628fb3

Please sign in to comment.