Closed gbuckingham89 closed 2 years ago
Ah, I wasn't aware that people were using this trait in such a way, that's my bad.
PHP 8.1 made a change so that calling static methods on traits isn't possible anymore. I'll fix it!
@Gummibeer this is actually a difficult one to fix. We do want to support 8.1 with the current version to allow people for a more smooth upgrade path when we tag our new major. But PHP 8.1 disallowed static calls on traits.
I also don't want to tag a new major version…
Thinking about it: @gbuckingham89 why exactly are you using the trait in your test classes? These are all static methods and can't be called on the instance, so in my mind it didn't make any sense to ever use this trait?
Checking the README, it only shows examples of using this trait statically and not by importing it. That's why I don't think this should be considered a breaking change: it was never intended to work this way.
So the breaking change comes from PHP itself. Because of that I would also stick to the promoted usage in the README.
I've just checked the older versions of the README and as you say, it's always been documented that the assertions should be called statically.
It was obviously implemented wrong in our codebase - so apologies for any confusion!
No problem!
It seems that this commit changed the trait that provided PHPUnit assertions into an abstract class: https://github.com/spatie/enum/commit/45245a12d424d08b7191038f4ac7375afd4feb80
I've got a project on PHP 7.4 with
spatie/enum
v3.10.0. I ran acomposer update
this morning and was given v3.11.1. I'm now getting a fatal error when running my tests:I can obviously refactor my tests to use the static methods on what is now the class - but should this not have been documented as a breaking change and a new major version released?