@@ -440,9 +440,7 @@ public function getClassAnnotation(string $className, string $annotationClassNam
440440 public function isClassImplementationOf (string $ className , string $ interfaceName ): bool
441441 {
442442 $ className = $ this ->prepareClassReflectionForUsage ($ className );
443-
444- $ interfaceName = $ this ->cleanClassName ($ interfaceName );
445- $ this ->loadOrReflectClassIfNecessary ($ interfaceName );
443+ $ this ->prepareClassReflectionForUsage ($ interfaceName );
446444
447445 return (isset ($ this ->classReflectionData [$ interfaceName ][self ::DATA_INTERFACE_IMPLEMENTATIONS ][$ className ]));
448446 }
@@ -1073,11 +1071,8 @@ protected function prepareClassReflectionForUsage(string $className): string
10731071 */
10741072 protected function reflectEmergedClasses (): void
10751073 {
1076- $ availableClassnames = [];
1077- foreach ($ this ->availableClassNames as $ classNamesInPackage ) {
1078- $ availableClassnames [] = $ classNamesInPackage ;
1079- }
1080- $ classNamesToReflect = array_merge ([], ...$ availableClassnames );
1074+ // flatten nested array structure to a list of classes
1075+ $ classNamesToReflect = array_merge (...array_values ($ this ->availableClassNames ));
10811076 $ reflectedClassNames = array_keys ($ this ->classReflectionData );
10821077 sort ($ classNamesToReflect );
10831078 sort ($ reflectedClassNames );
@@ -1087,33 +1082,31 @@ protected function reflectEmergedClasses(): void
10871082 }
10881083
10891084 $ this ->log ('Reflected class names did not match class names to reflect ' , LogLevel::DEBUG );
1090- $ count = 0 ;
10911085
1092- $ classNameFilterFunction = function ($ className ) use (&$ count ): bool {
1086+ $ classNamesToBuildSchemaFor = [];
1087+ foreach ($ newClassNames as $ className ) {
10931088 $ this ->loadOrReflectClassIfNecessary ($ className );
10941089 if (
10951090 !$ this ->isClassAnnotatedWith ($ className , Flow \Entity::class) &&
10961091 !$ this ->isClassAnnotatedWith ($ className , ORM \Entity::class) &&
10971092 !$ this ->isClassAnnotatedWith ($ className , ORM \Embeddable::class) &&
10981093 !$ this ->isClassAnnotatedWith ($ className , Flow \ValueObject::class)
10991094 ) {
1100- return false ;
1095+ continue ;
11011096 }
11021097
11031098 $ scopeAnnotation = $ this ->getClassAnnotation ($ className , Flow \Scope::class);
11041099 if ($ scopeAnnotation !== null && $ scopeAnnotation ->value !== 'prototype ' ) {
11051100 throw new Exception (sprintf ('Classes tagged as entity or value object must be of scope prototype, however, %s is declared as %s. ' , $ className , $ scopeAnnotation ->value ), 1264103349 );
11061101 }
11071102
1108- $ count ++;
1109- return true ;
1103+ $ classNamesToBuildSchemaFor [] = $ className ;
11101104 };
11111105
1112- $ classNamesToBuildSchemaFor = array_filter ($ newClassNames , $ classNameFilterFunction );
11131106 $ this ->buildClassSchemata ($ classNamesToBuildSchemaFor );
11141107
1115- if ($ count > 0 ) {
1116- $ this ->log (sprintf ('Reflected %s emerged classes. ' , $ count ), LogLevel::INFO , LogEnvironment::fromMethodName (__METHOD__ ));
1108+ if ($ classNamesToBuildSchemaFor !== [] ) {
1109+ $ this ->log (sprintf ('Reflected %s emerged classes. ' , count ( $ classNamesToBuildSchemaFor ) ), LogLevel::INFO , LogEnvironment::fromMethodName (__METHOD__ ));
11171110 }
11181111 }
11191112
@@ -1822,8 +1815,7 @@ protected function convertParameterReflectionToArray(ParameterReflection $parame
18221815 */
18231816 protected function forgetChangedClasses (): void
18241817 {
1825- $ classNames = array_keys ($ this ->classReflectionData );
1826- foreach ($ classNames as $ className ) {
1818+ foreach ($ this ->classReflectionData as $ className => $ _ ) {
18271819 if (is_string ($ className ) && !$ this ->reflectionDataRuntimeCache ->has ($ this ->produceCacheIdentifierFromClassName ($ className ))) {
18281820 $ this ->forgetClass ($ className );
18291821 }
@@ -1931,7 +1923,7 @@ private function loadOrReflectClassIfNecessary(string $className): void
19311923 */
19321924 public function saveToCache (): void
19331925 {
1934- if (empty ( $ this ->updatedReflectionData ) ) {
1926+ if ($ this ->updatedReflectionData === [] ) {
19351927 return ;
19361928 }
19371929
@@ -1956,7 +1948,7 @@ private function updateCacheEntries(): void
19561948 }
19571949 }
19581950
1959- foreach (array_keys ( $ this ->updatedReflectionData ) as $ className ) {
1951+ foreach ($ this ->updatedReflectionData as $ className => $ _ ) {
19601952 $ reflectionData = $ this ->classReflectionData [$ className ];
19611953 $ cacheIdentifier = $ this ->produceCacheIdentifierFromClassName ($ className );
19621954 $ this ->reflectionDataRuntimeCache ->set ($ cacheIdentifier , $ reflectionData );
0 commit comments