final protected function assertClassesAreAbstractOrFinal(string $directory, array $excludeClassNames = []): void
    {
        $this->assertClassyConstructsSatisfySpecification(
            static function (string $className): bool {
                $reflection = new \ReflectionClass($className);

                return $reflection->isAbstract()
                    || $reflection->isFinal()
                    || $reflection->isInterface()
                    || $reflection->isTrait();
            },
            $directory,
            $excludeClassNames,
            "Failed asserting that the classes\n\n%s\n\nare abstract or final."
        );
    }
final protected function assertClassesAreAbstractOrFinal(string $directory, array $excludeClassNames = []): void
    {
        $this->assertClassyConstructsSatisfySpecification(
            static function (string $className): bool {
                $reflection = new \ReflectionClass($className);

                return $reflection->isAbstract()
                    || $reflection->isFinal()
                    || $reflection->isInterface()
                    || $reflection->isTrait();
            },
            $directory,
            $excludeClassNames,
            "Failed asserting that the classes\n\n%s\n\nare abstract or final."
        );
    }
final protected function assertClassesAreAbstractOrFinal ( string $ directory , array $ excludeClassNames = [ ] ) : void { $ this -> assertClassyConstructsSatisfySpecification ( static function ( string $ className ) : bool { $ reflection = new \ ReflectionClass ( $ className ) ; return $ reflection -> isAbstract ( ) || $ reflection -> isFinal ( ) || $ reflection -> isInterface ( ) || $ reflection -> isTrait ( ) ; } , $ directory , $ excludeClassNames , "Failed asserting that the classes\n\n%s\n\nare abstract or final." ) ; }
Asserts that classes in a directory are either abstract or final.

Useful to prevent long inheritance chains.

@param string   $directory
@param string[] $excludeClassNames

@throws Exception\NonExistentDirectory
@throws Exception\InvalidExcludeClassName
@throws Exception\NonExistentExcludeClass
@throws Classy\Exception\MultipleDefinitionsFound
Asserts that classes in a directory are either abstract or final .