Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ObjectStateMatcher prevails over ScalarMatcher since PHP 8.0 #1431

@bsod85

Description

@bsod85

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions