[PropertyInfo] Minor cleanup and perf improvement
This commit is contained in:
parent
80e63e4146
commit
4a8306e7be
@ -111,7 +111,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
|
||||
$nullable = false !== $nullKey;
|
||||
|
||||
// Remove the null type from the type if other types are defined
|
||||
if ($nullable && count($varTypes) > 1) {
|
||||
if ($nullable && \count($varTypes) > 1) {
|
||||
unset($varTypes[$nullKey]);
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array($prefix, ReflectionExtractor::$arrayMutatorPrefixes)) {
|
||||
if (!\in_array($prefix, ReflectionExtractor::$arrayMutatorPrefixes)) {
|
||||
return $types;
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
|
||||
*/
|
||||
private function getPhpTypeAndClass($docType)
|
||||
{
|
||||
if (in_array($docType, Type::$builtinTypes)) {
|
||||
if (\in_array($docType, Type::$builtinTypes)) {
|
||||
return array($docType, null);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||
return;
|
||||
}
|
||||
|
||||
if (in_array($prefix, self::$arrayMutatorPrefixes)) {
|
||||
if (\in_array($prefix, self::$arrayMutatorPrefixes)) {
|
||||
$type = new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $type);
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||
return array($this->extractFromReflectionType($reflectionType));
|
||||
}
|
||||
|
||||
if (in_array($prefix, array('is', 'can'))) {
|
||||
if (\in_array($prefix, array('is', 'can'))) {
|
||||
return array(new Type(Type::BUILTIN_TYPE_BOOL));
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
namespace Symfony\Component\PropertyInfo;
|
||||
|
||||
/**
|
||||
* Description extractor Interface.
|
||||
* Guesses the property's human readable description.
|
||||
*
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
*/
|
||||
|
@ -112,7 +112,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface
|
||||
private function extract(array $extractors, $method, array $arguments)
|
||||
{
|
||||
foreach ($extractors as $extractor) {
|
||||
$value = call_user_func_array(array($extractor, $method), $arguments);
|
||||
$value = \call_user_func_array(array($extractor, $method), $arguments);
|
||||
if (null !== $value) {
|
||||
return $value;
|
||||
}
|
||||
|
Reference in New Issue
Block a user