@@ -150,7 +150,7 @@ private static function assertClassEquals(\ReflectionClass $native, \ReflectionC
150150 self ::assertSame ($ native ->__toString (), $ typhoon ->__toString (), 'class.__toString() ' );
151151 self ::assertGetAttributes ($ native , $ typhoon , 'c ' );
152152 self ::assertSame ($ native ->getConstructor ()?->name, $ typhoon ->getConstructor ()?->name, 'class.getConstructor().name ' );
153- self ::assertSame ($ native ->getDefaultProperties (), $ typhoon ->getDefaultProperties (), 'class.getDefaultProperties() ' );
153+ self ::assertArraysSameNoOrder ($ native ->getDefaultProperties (), $ typhoon ->getDefaultProperties (), 'class.getDefaultProperties() ' );
154154 self ::assertSame ($ native ->getDocComment (), $ typhoon ->getDocComment (), 'class.getDocComment() ' );
155155 self ::assertSame ($ native ->getEndLine (), $ typhoon ->getEndLine (), 'class.getEndLine() ' );
156156 self ::assertEquals ($ native ->getExtension (), $ typhoon ->getExtension (), 'class.getExtension() ' );
@@ -222,9 +222,12 @@ private static function assertClassEquals(\ReflectionClass $native, \ReflectionC
222222
223223 // CONSTANTS
224224
225- self ::assertSame ($ native ->getConstants (), $ typhoon ->getConstants (), 'class.getConstants().name ' );
226-
227- self ::assertReflectionsEqualNoOrder ($ native ->getReflectionConstants (), $ typhoon ->getReflectionConstants (), 'class.getReflectionConstants() ' );
225+ self ::assertArraysSameNoOrder ($ native ->getConstants (), $ typhoon ->getConstants (), 'class.getConstants().name ' );
226+ self ::assertArraysSameNoOrder ($ native ->getConstants (0 ), $ typhoon ->getConstants (0 ), 'class.getConstants(0).name ' );
227+ self ::assertArraysSameNoOrder ($ native ->getConstants (\ReflectionClassConstant::IS_PUBLIC ), $ typhoon ->getConstants (\ReflectionClassConstant::IS_PUBLIC ), 'class.getConstants(IS_PUBLIC).name ' );
228+ self ::assertArraysSameNoOrder ($ native ->getConstants (\ReflectionClassConstant::IS_PROTECTED ), $ typhoon ->getConstants (\ReflectionClassConstant::IS_PROTECTED ), 'class.getConstants(IS_PROTECTED).name ' );
229+ self ::assertArraysSameNoOrder ($ native ->getConstants (\ReflectionClassConstant::IS_PRIVATE ), $ typhoon ->getConstants (\ReflectionClassConstant::IS_PRIVATE ), 'class.getConstants(IS_PRIVATE).name ' );
230+ self ::assertArraysSameNoOrder ($ native ->getConstants (\ReflectionClassConstant::IS_FINAL ), $ typhoon ->getConstants (\ReflectionClassConstant::IS_FINAL ), 'class.getConstants(IS_FINAL).name ' );
228231
229232 foreach ($ native ->getReflectionConstants () as $ nativeConstant ) {
230233 self ::assertTrue ($ typhoon ->hasConstant ($ nativeConstant ->name ), "class.hasConstant( {$ nativeConstant ->name }) " );
@@ -234,12 +237,7 @@ private static function assertClassEquals(\ReflectionClass $native, \ReflectionC
234237 self ::assertConstantEquals ($ nativeConstant , $ typhoonConstant , "class.getReflectionConstant( {$ nativeConstant ->name }) " );
235238 }
236239
237- self ::assertSame ($ native ->getConstants (0 ), $ typhoon ->getConstants (0 ), 'class.getConstants(0).name ' );
238- self ::assertSame ($ native ->getConstants (\ReflectionClassConstant::IS_PUBLIC ), $ typhoon ->getConstants (\ReflectionClassConstant::IS_PUBLIC ), 'class.getConstants(IS_PUBLIC).name ' );
239- self ::assertSame ($ native ->getConstants (\ReflectionClassConstant::IS_PROTECTED ), $ typhoon ->getConstants (\ReflectionClassConstant::IS_PROTECTED ), 'class.getConstants(IS_PROTECTED).name ' );
240- self ::assertSame ($ native ->getConstants (\ReflectionClassConstant::IS_PRIVATE ), $ typhoon ->getConstants (\ReflectionClassConstant::IS_PRIVATE ), 'class.getConstants(IS_PRIVATE).name ' );
241- self ::assertSame ($ native ->getConstants (\ReflectionClassConstant::IS_FINAL ), $ typhoon ->getConstants (\ReflectionClassConstant::IS_FINAL ), 'class.getConstants(IS_FINAL).name ' );
242-
240+ self ::assertReflectionsEqualNoOrder ($ native ->getReflectionConstants (), $ typhoon ->getReflectionConstants (), 'class.getReflectionConstants() ' );
243241 self ::assertReflectionsEqualNoOrder ($ native ->getReflectionConstants (0 ), $ typhoon ->getReflectionConstants (0 ), 'class.getReflectionConstants(0) ' );
244242 self ::assertReflectionsEqualNoOrder ($ native ->getReflectionConstants (\ReflectionClassConstant::IS_PUBLIC ), $ typhoon ->getReflectionConstants (\ReflectionClassConstant::IS_PUBLIC ), 'class.getReflectionConstants(IS_PUBLIC) ' );
245243 self ::assertReflectionsEqualNoOrder ($ native ->getReflectionConstants (\ReflectionClassConstant::IS_PROTECTED ), $ typhoon ->getReflectionConstants (\ReflectionClassConstant::IS_PROTECTED ), 'class.getReflectionConstants(IS_PROTECTED) ' );
@@ -249,35 +247,33 @@ private static function assertClassEquals(\ReflectionClass $native, \ReflectionC
249247 // PROPERTIES
250248
251249 self ::assertReflectionsEqualNoOrder ($ native ->getProperties (), $ typhoon ->getProperties (), 'class.getProperties() ' );
252-
253- foreach ($ native ->getProperties () as $ nativeProperty ) {
254- self ::assertTrue ($ typhoon ->hasProperty ($ nativeProperty ->name ), "class.hasProperty( {$ nativeProperty ->name }) " );
255- self ::assertPropertyEquals ($ nativeProperty , $ typhoon ->getProperty ($ nativeProperty ->name ), "class.getProperty( {$ nativeProperty ->name }) " );
256- }
257-
258250 self ::assertReflectionsEqualNoOrder ($ native ->getProperties (0 ), $ typhoon ->getProperties (0 ), 'class.getProperties(0) ' );
259251 self ::assertReflectionsEqualNoOrder ($ native ->getProperties (\ReflectionProperty::IS_PUBLIC ), $ typhoon ->getProperties (\ReflectionProperty::IS_PUBLIC ), 'class.getProperties(IS_PUBLIC) ' );
260252 self ::assertReflectionsEqualNoOrder ($ native ->getProperties (\ReflectionProperty::IS_PROTECTED ), $ typhoon ->getProperties (\ReflectionProperty::IS_PROTECTED ), 'class.getProperties(IS_PROTECTED) ' );
261253 self ::assertReflectionsEqualNoOrder ($ native ->getProperties (\ReflectionProperty::IS_PRIVATE ), $ typhoon ->getProperties (\ReflectionProperty::IS_PRIVATE ), 'class.getProperties(IS_PRIVATE) ' );
262254 self ::assertReflectionsEqualNoOrder ($ native ->getProperties (\ReflectionProperty::IS_STATIC ), $ typhoon ->getProperties (\ReflectionProperty::IS_STATIC ), 'class.getProperties(IS_STATIC) ' );
263255 self ::assertReflectionsEqualNoOrder ($ native ->getProperties (\ReflectionProperty::IS_READONLY ), $ typhoon ->getProperties (\ReflectionProperty::IS_READONLY ), 'class.getProperties(IS_READONLY) ' );
264256
257+ foreach ($ native ->getProperties () as $ nativeProperty ) {
258+ self ::assertTrue ($ typhoon ->hasProperty ($ nativeProperty ->name ), "class.hasProperty( {$ nativeProperty ->name }) " );
259+ self ::assertPropertyEquals ($ nativeProperty , $ typhoon ->getProperty ($ nativeProperty ->name ), "class.getProperty( {$ nativeProperty ->name }) " );
260+ }
261+
265262 // METHODS
266263
267264 self ::assertReflectionsEqualNoOrder ($ native ->getMethods (), $ typhoon ->getMethods (), 'class.getMethods() ' );
268-
269- foreach ($ native ->getMethods () as $ nativeMethod ) {
270- self ::assertTrue ($ typhoon ->hasMethod ($ nativeMethod ->name ), "hasMethod( {$ nativeMethod ->name }) " );
271- self ::assertMethodEquals ($ nativeMethod , $ typhoon ->getMethod ($ nativeMethod ->name ), "getMethod( {$ nativeMethod ->name }) " );
272- }
273-
274265 self ::assertReflectionsEqualNoOrder ($ native ->getMethods (0 ), $ typhoon ->getMethods (0 ), 'class.getMethods(0) ' );
275266 self ::assertReflectionsEqualNoOrder ($ native ->getMethods (\ReflectionMethod::IS_FINAL ), $ typhoon ->getMethods (\ReflectionMethod::IS_FINAL ), 'class.getMethods(IS_FINAL) ' );
276267 self ::assertReflectionsEqualNoOrder ($ native ->getMethods (\ReflectionMethod::IS_ABSTRACT ), $ typhoon ->getMethods (\ReflectionMethod::IS_ABSTRACT ), 'class.getMethods(IS_ABSTRACT) ' );
277268 self ::assertReflectionsEqualNoOrder ($ native ->getMethods (\ReflectionMethod::IS_PUBLIC ), $ typhoon ->getMethods (\ReflectionMethod::IS_PUBLIC ), 'class.getMethods(IS_PUBLIC) ' );
278269 self ::assertReflectionsEqualNoOrder ($ native ->getMethods (\ReflectionMethod::IS_PROTECTED ), $ typhoon ->getMethods (\ReflectionMethod::IS_PROTECTED ), 'class.getMethods(IS_PROTECTED) ' );
279270 self ::assertReflectionsEqualNoOrder ($ native ->getMethods (\ReflectionMethod::IS_PRIVATE ), $ typhoon ->getMethods (\ReflectionMethod::IS_PRIVATE ), 'class.getMethods(IS_PRIVATE) ' );
280271 self ::assertReflectionsEqualNoOrder ($ native ->getMethods (\ReflectionMethod::IS_STATIC ), $ typhoon ->getMethods (\ReflectionMethod::IS_STATIC ), 'class.getMethods(IS_STATIC) ' );
272+
273+ foreach ($ native ->getMethods () as $ nativeMethod ) {
274+ self ::assertTrue ($ typhoon ->hasMethod ($ nativeMethod ->name ), "hasMethod( {$ nativeMethod ->name }) " );
275+ self ::assertMethodEquals ($ nativeMethod , $ typhoon ->getMethod ($ nativeMethod ->name ), "getMethod( {$ nativeMethod ->name }) " );
276+ }
281277 }
282278
283279 private static function assertConstantEquals (\ReflectionClassConstant $ native , \ReflectionClassConstant $ typhoon , string $ messagePrefix ): void
@@ -522,6 +518,13 @@ private static function assertReflectionsEqual(array $nativeReflections, array $
522518 );
523519 }
524520
521+ private static function assertArraysSameNoOrder (array $ expected , array $ actual , string $ message = '' ): void
522+ {
523+ ksort ($ expected );
524+ ksort ($ actual );
525+ self ::assertSame ($ expected , $ actual , $ message );
526+ }
527+
525528 /**
526529 * @param array<\ReflectionFunctionAbstract|\ReflectionClass|\ReflectionClassConstant|\ReflectionProperty|\ReflectionParameter> $nativeReflections
527530 * @param array<\ReflectionFunctionAbstract|\ReflectionClass|\ReflectionClassConstant|\ReflectionProperty|\ReflectionParameter> $typhoonReflections
0 commit comments