-
Notifications
You must be signed in to change notification settings - Fork 58
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
Incompatibilty with Winzou state machine #44
Comments
Thanks for reporting this! Could you provide a stack trace for this error? Which PHP version are you using? |
I'm having the same issue with PHP 7.2.22 and PHP 7.3.20, it's triggering the Fatal error as specified by petermein. The StateMachine class and interface of winzou declares the method Your StateMachine class declares it as This is incompatible and causes the Fatal error. Digging deeper I found out I'm on version 0.4.0 of winzou/state-machine. If I clone this repo and run Edit: Creating an empty project with a composer.json that only requires version 3.0.1 of your package will also provide me with version 0.4.0 of winzou/state-machine. |
@robvanaarle I think I understand your issue. When I added support for Laravel 7 and Symfony 5, I had to fork I did send a PR to the original repository then, and the changes were tagged just a few days ago: https://github.com/winzou/state-machine/releases/tag/0.4.0 So if you didn't add the following repository to your composer.json, composer will install + "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/sebdesign/state-machine"
+ }
+ ] It's strange that the tests are passing in all PHP versions in Travis, and there's no such error. |
The tag you're referring to is for commit da3ef73. In that commit the apply() method was changed from to which does not match your definition of apply(): That is the reason it's not working. I solved it temporarily by adding the following dependency: |
You're right! I didn't notice that the original package added the I have to think for a strategy to fix this in a BC way, without breaking applications that are relying on non-string |
Actually the Fatal Error is caused due to your interface WinzouStateMachineInterface {
public function apply(string $transition, $soft = false): bool;
}
class WinzouStateMachine implements WinzouStateMachineInterface {
public function apply(string $transition, $soft = false): bool {
return false;
}
}
// This will cause the fatal
class SebdesignStateMachine extends WinzouStateMachine {
public function apply($transition, bool $soft = false, array $context = []): bool {
return true;
}
}
// This works
class SebdesignStateMachine extends WinzouStateMachine {
public function apply($transition, $soft = false, array $context = []): bool {
return true;
}
} |
@robvanaarle I've pushed your suggestion to master. Could please try it before I tag this as a new release? |
Yes. The code change is as expected and using master in my project let my unit tests pass again. Thanks! |
I've tagged v3.0.2. Thanks for your help with this! |
The interface declaration doesn't match with the implemenation in this package
Declaration of Sebdesign\SM\StateMachine\StateMachine::apply($transition, bool $soft = false, array $context = Array): bool must be compatible with SM\StateMachine\StateMachine::apply(string $transition, $soft = false): bool
The text was updated successfully, but these errors were encountered: