chore: Support 4.19.x versions of nikic/php-parser#1650
chore: Support 4.19.x versions of nikic/php-parser#1650acoulton merged 1 commit intoBehat:masterfrom
Conversation
Requiring ^5.2 was causing dependency conflicts that were preventing end-users from upgrading to newer Behat versions. We only actually *require* nikic/php-parser for running the convert-config command to generate PHP config from the old YAML files. I therefore explored making it a suggested dependency that was only used to run that command. The problem is that it is also required indirectly by many of our dev dependencies (including PHPUnit, which we use to run our assertions). This means we can't configure a CI run where it is **not** installed, so would not have confidence that Behat does indeed work as expected without it. The best compromise is to relax the constraint to ^4.19.2 (this version introduced enum support, which we need). That should resolve the conflict for the majority of users.
| ->withContexts( | ||
| 'MyContext', | ||
| 'App\AnotherContext' | ||
| 'AnotherContext' |
There was a problem hiding this comment.
The only slight issue is that the 4.x series includes a double backslash in strings e.g. it would produce App\\AnotherContext rather than the App\AnotherContext that we get from 5.x.
The "Class references for known extensions and contexts" scenario already covers behaviour with namespaced classes that are defined and can therefore be converted to imports. This proves we're reading the namespaced class names correctly from YAML and passing them around internally without issues.
Other aspects of that scenario and of these ones cover rendering the class name as a string if it is not a defined class.
IMO therefore we don't need to specifically cover the case where it's a string that contains a namespace separator, so the simplest fix is to just change these examples to ones where both versions of php-parser produce the same output.
Requiring ^5.2 was causing dependency conflicts that were preventing end-users from upgrading to newer Behat versions.
We only actually require nikic/php-parser for running the convert-config command to generate PHP config from the old YAML files. I therefore explored making it a suggested dependency that was only used to run that command.
The problem is that it is also required indirectly by many of our dev dependencies (including PHPUnit, which we use to run our assertions). This means we can't configure a CI run where it is not installed, so would not have confidence that Behat does indeed work as expected without it.
The best compromise is to relax the constraint to ^4.19.2 (this version introduced enum support, which we need). That should resolve the conflict for the majority of users.
Refs #1637