mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
Merge remote-tracking branch 'origin/support/3.2' into develop
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user