phpat icon indicating copy to clipboard operation
phpat copied to clipboard

Parameter #1 ...$selectors of method PHPat\Test\Builder\SubjectStep::classes() expects PHPat\Selector\SelectorInterface, PHPat\Selector\Modifier\AndModifier given

Open erikvanderschaaf opened this issue 4 months ago • 1 comments

Bug Description I'm not sure if this is a phpat bug or a phpstan bug. I've written the following test, but I'm getting an error, but IMHO this is not a valid error since AndModifier implements SelectorInterface

 Line   test/PHPat/Process.php
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
   7     Parameter #1 ...$selectors of method PHPat\Test\Builder\SubjectStep::classes() expects PHPat\Selector\SelectorInterface, PHPat\Selector\Modifier\AndModifier given.
final class Process
{
    public function testImplementsInterface(): Rule
    {
        return PHPat::rule()
            ->classes(
                Selector::AND(
                    Selector::inNamespace('Process'),
                    Selector::NOT(
                        Selector::isInterface()
                    )
                )
            )
            ->shouldImplement()
            ->classes(
                Selector::classname(ProcessInterface::class)
            )
            ->because('Each process should implement ProcessInterface');
    }
}

erikvanderschaaf avatar Oct 08 '24 06:10 erikvanderschaaf