Skip to content

PHP 8.4 Deprecated warnings due to implicit nullable parameters #55

@themaric

Description

@themaric

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy