diff --git a/test/ExceptionNamingTest.php b/test/ExceptionNamingTest.php index c4511a7..43b28bf 100644 --- a/test/ExceptionNamingTest.php +++ b/test/ExceptionNamingTest.php @@ -15,13 +15,18 @@ public function testNaming() : void { require_once $file; } - $classes = array_filter(get_declared_classes(), function ($class) { + $classes = array_filter(get_declared_classes(), function ( string $class ) { + // Skip anonymous classes + if( strpos($class, '@') !== false ) { + return false; + } + return is_subclass_of($class, AbstractHttpException::class); }); - foreach($classes as $className) { + foreach( $classes as $className ) { $reflect = new \ReflectionClass($className); - if($reflect->isAbstract()) { + if( $reflect->isAbstract() ) { continue; } @@ -37,7 +42,7 @@ public function testNaming() : void { $this->assertSame( constant(Status::class . '::' . $constName), - $inst->getHttpStatusCode() + $inst->getHttpStatusCode(), ); } }