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

ObjectStateMatcher prevails over ScalarMatcher since PHP 8.0 #1431

Open
bsod85 opened this issue Jun 22, 2022 · 2 comments
Open

ObjectStateMatcher prevails over ScalarMatcher since PHP 8.0 #1431

bsod85 opened this issue Jun 22, 2022 · 2 comments

Comments

@bsod85
Copy link
Contributor

bsod85 commented Jun 22, 2022

As pointed out in issue #1403 the matchers order changed since PHP 8.0.

In our case a problem arises because ObjectStateMatcher takes precedence now over ScalarMatcher when we use $object->shouldNotBeNull().

Then test breaks with the error method [array:2] not found. and phpspec prompts us to create a method with the message:

Do you want me to create                                                      
  `OurClass::isNull()` for you?

Our solution was simply to increment the ScalarMatcher priority to 51. If this is the best solution I can open a PR, otherwise depending of what the solution is I'l be glad if I can be of any help.

@Lehren
Copy link

Lehren commented Mar 23, 2023

+1, very annoying suddenly

@ciaranmcnulty
Copy link
Member

Yes please do open a PR if they're currently equal priority and PHP's sort order has changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants