8000 minor #54790 [TypeInfo] end/current instead of array_pop (soyuka) · symfony/symfony@1119ab6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1119ab6

Browse files
committed
minor #54790 [TypeInfo] end/current instead of array_pop (soyuka)
This PR was merged into the 7.1 branch. Discussion ---------- [TypeInfo] end/current instead of array_pop | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT We don't need to modify the array here, I think it's a micro-optimization to use `end` and `current` instead of changing an array size. Commits ------- e36b82d [TypeInfo] end/current instead of array_pop
2 parents c168c2c + e36b82d commit 1119ab6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/TypeInfo/TypeContext/TypeContextFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public function createFromClassName(string $calledClassName, ?string $declaringC
5050
$calledClassPath = explode('\\', $calledClassName);
5151
$declaringClassPath = explode('\\', $declaringClassName);
5252

53-
$declaringClassReflection = (self::$reflectionClassCache[$declaringClassName] ??= new \ReflectionClass($declaringClassName));
53+
$declaringClassReflection = self::$reflectionClassCache[$declaringClassName] ??= new \ReflectionClass($declaringClassName);
5454

5555
$typeContext = new TypeContext(
56-
array_pop($calledClassPath),
57-
array_pop($declaringClassPath),
56+
end($calledClassPath),
57+
end($declaringClassPath),
5858
trim($declaringClassReflection->getNamespaceName(), '\\'),
5959
$this->collectUses($declaringClassReflection),
6060
);

0 commit comments

Comments
 (0)
0