Merge remote-tracking branch 'origin/support/3.2' into develop

This commit is contained in:
lenaick.moreira
2026-03-02 10:56:31 +01:00
123 changed files with 2898 additions and 2149 deletions

View File

@@ -138,7 +138,8 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
return $fromMutator;
}
if ($fromAccessor = $this->extractFromAccessor($class, $property)) {
$allowedPrefixes = array_diff($this->accessorPrefixes, ['is', 'can', 'has']);
if ($fromAccessor = $this->extractFromAccessor($class, $property, $allowedPrefixes)) {
return $fromAccessor;
}
@@ -153,6 +154,11 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
return $fromPropertyDeclaration;
}
$allowedPrefixes = array_diff($this->accessorPrefixes, $allowedPrefixes);
if ($fromAccessor = $this->extractFromAccessor($class, $property, $allowedPrefixes)) {
return $fromAccessor;
}
return null;
}
@@ -460,13 +466,17 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
*
* @return Type[]|null
*/
private function extractFromAccessor(string $class, string $property): ?array
private function extractFromAccessor(string $class, string $property, array $allowedPrefixes): ?array
{
[$reflectionMethod, $prefix] = $this->getAccessorMethod($class, $property);
if (null === $reflectionMethod) {
return null;
}
if (!\in_array($prefix, $allowedPrefixes, true)) {
return null;
}
if ($reflectionType = $reflectionMethod->getReturnType()) {
return $this->extractFromReflectionType($reflectionType, $reflectionMethod->getDeclaringClass());
}