<?php use Hshn\ClassMatcher\ClassMatcher; $builder = ClassMatcher::createBuilder(); $matcher = $builder->logicalOr([ $builder->equalsTo('Foo'), $builder->implemented('FooInterface'), $builder->extended('Foo'), $builder->logicalAnd([ $builder->anything() ]), ]); if ($matcher->matches('FooExtended')) { } else { }