Skip to content

Commit

Permalink
minor #27003 [PropertyInfo] Minor cleanup and perf improvement (dunglas)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nicolas-grekas committed Apr 25, 2018
2 parents 0b68f34 + 01cfc50 commit aa6eb12
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Extractor/PhpDocExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getTypes($class, $property, array $context = array())
$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]);
}

Expand All @@ -127,7 +127,7 @@ public function getTypes($class, $property, array $context = array())
return;
}

if (!in_array($prefix, ReflectionExtractor::$arrayMutatorPrefixes)) {
if (!\in_array($prefix, ReflectionExtractor::$arrayMutatorPrefixes)) {
return $types;
}

Expand Down Expand Up @@ -386,7 +386,7 @@ private function normalizeType($docType)
*/
private function getPhpTypeAndClass($docType)
{
if (in_array($docType, Type::$builtinTypes)) {
if (\in_array($docType, Type::$builtinTypes)) {
return array($docType, null);
}

Expand Down
4 changes: 2 additions & 2 deletions Extractor/ReflectionExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private function extractFromMutator($class, $property)
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);
}

Expand All @@ -187,7 +187,7 @@ private function extractFromAccessor($class, $property)
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));
}
}
Expand Down
2 changes: 1 addition & 1 deletion PropertyDescriptionExtractorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
*/
Expand Down
2 changes: 1 addition & 1 deletion PropertyInfoExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function isWritable($class, $property, array $context = array())
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;
}
Expand Down

0 comments on commit aa6eb12

Please sign in to comment.