From cb5de6115db99b2c567aa3befdcce96b98254caa Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:16:02 +0100 Subject: [PATCH] TASK: Remove obsolete sorting after reflecting each class we sort classReflectionData which can also not be done instead :D but we still ensure that getAllClassNames returns all classes sorted. For using `array_diff` to get the $newClassNames we dont need sorting --- Neos.Flow/Classes/Reflection/ReflectionService.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Neos.Flow/Classes/Reflection/ReflectionService.php b/Neos.Flow/Classes/Reflection/ReflectionService.php index 4f5707daf2..0060d0ad4a 100644 --- a/Neos.Flow/Classes/Reflection/ReflectionService.php +++ b/Neos.Flow/Classes/Reflection/ReflectionService.php @@ -265,8 +265,9 @@ public function getAllClassNames(): array if (!$this->initialized) { $this->initialize(); } - - return array_keys($this->classReflectionData); + $classNames = array_keys($this->classReflectionData); + sort($classNames); + return $classNames; } /** @@ -1093,8 +1094,6 @@ protected function reflectEmergedClasses(): void } $classNamesToReflect = array_merge([], ...$availableClassnames); $reflectedClassNames = array_keys($this->classReflectionData); - sort($classNamesToReflect); - sort($reflectedClassNames); $newClassNames = array_diff($classNamesToReflect, $reflectedClassNames); if ($newClassNames === []) { return; @@ -1213,10 +1212,6 @@ protected function reflectClass(string $className): void foreach ($class->getMethods() as $method) { $this->reflectClassMethod($className, $method); } - // Sort reflection data so that the cache data is deterministic. This is - // important for comparisons when checking if classes have changed in a - // Development context. - ksort($this->classReflectionData); $this->updatedReflectionData[$className] = true; }