- Notifications
You must be signed in to change notification settings - Fork 13
Description
Problem
When running php vendor/bin/codecept build, multiple PHP deprecated warnings are displayed due to implicit nullable parameters in several methods within the Codeception Laravel module.
Example warning:
PHP Deprecated: Codeception\Module\Laravel\InteractsWithAuthentication::amActingAs(): Implicitly marking parameter $guardName as nullable is deprecated...
Affected files and methods include:
-
InteractsWithAuthentication.php
amActingAs()(line 21)amLoggedAs()(line 50)assertAuthenticatedAs()(line 72)assertCredentials()(line 100)assertInvalidCredentials()(line 118)dontSeeAuthentication()(line 133)seeAuthentication()(line 159)hasCredentials()(line 167)
-
InteractsWithConsole.php
callArtisan()(line 24)
-
InteractsWithViews.php
seeFormErrorMessage()(line 46)
Cause
Implicitly nullable parameters are deprecated as of PHP 8.4 (RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types). The explicit nullable type declaration (?type) must now be used.
For example:
- public function amActingAs($user, $guardName = null) + public function amActingAs($user, ?string $guardName = null)Possible solution
Update the method signatures by explicitly declaring nullable parameters with ?type notation for each affected method.
Environment
- PHP Version: 8.4
- Codeception/module-laravel
Contribution
Community contributions via Pull Requests to resolve this issue are welcome.