Issue #340 identified an issue in resolving classes in PHP 8. The error is caused by a breaking change in PHP 8.1 which disallows optional parameters before required parameters.
Changes
I've reordered the parameter list for Route::resolveClass and updated the two locations where it's been called.
Side Effects
Since this is within protected functionality it should only cause an issue for anyone who is customizing the Route class.
Testing
I set up a container with PHP 7.4.33 and ran the existing tests, since the current tests in RouteTest already handle Container resolution:
$ ./vendor/bin/phpunit
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Runtime: PHP 7.4.33 with Xdebug 3.1.6
Configuration: /workspaces/Route/phpunit.xml
................................................................ 64 / 64 (100%)
Time: 187 ms, Memory: 10.00 MB
OK (64 tests, 257 assertions)
Generating code coverage report in Clover XML format ... done
Generating code coverage report in HTML format ... done
For posterity I attempted to test with 8.0+ but there were dependency issues outside the scope of this change.
Issue
Issue #340 identified an issue in resolving classes in PHP 8. The error is caused by a breaking change in PHP 8.1 which disallows optional parameters before required parameters.
Changes
I've reordered the parameter list for
Route::resolveClass
and updated the two locations where it's been called.Side Effects
Since this is within
protected
functionality it should only cause an issue for anyone who is customizing theRoute
class.Testing
I set up a container with PHP 7.4.33 and ran the existing tests, since the current tests in
RouteTest
already handle Container resolution:For posterity I attempted to test with 8.0+ but there were dependency issues outside the scope of this change.