Skip to content

Commit

Permalink
Skip anonymous classes
Browse files Browse the repository at this point in the history
  • Loading branch information
donatj committed Sep 10, 2024
1 parent 29ec9b5 commit 8c976a5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/ExceptionNamingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -37,7 +42,7 @@ public function testNaming() : void {

$this->assertSame(
constant(Status::class . '::' . $constName),
$inst->getHttpStatusCode()
$inst->getHttpStatusCode(),
);
}
}
Expand Down

0 comments on commit 8c976a5

Please sign in to comment.