Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
erikvanderschaaf opened this issue Oct 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@erikvanderschaaf
Copy link

erikvanderschaaf commented Oct 8, 2024

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 erikvanderschaaf added the bug Something isn't working label Oct 8, 2024
@carlosas
Copy link
Owner

Hi. Did you figure out what was happening?
I just run your code and it works properly. Which PHPStan/PHPat version are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants