minor #27003 [PropertyInfo] Minor cleanup and perf improvement (dunglas)

This PR was squashed before being merged into the 2.8 branch (closes #27003).

Discussion
----------

[PropertyInfo] Minor cleanup and perf improvement

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

4a8306e [PropertyInfo] Minor cleanup and perf improvement
This commit is contained in:
Nicolas Grekas 2018-04-25 14:21:53 +02:00
commit 447ce8e416
4 changed files with 7 additions and 7 deletions

View File

@ -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);
}

View File

@ -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));
}
}

View File

@ -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>
*/

View File

@ -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;
}