Skip to content

Conversation

@mafftor
Copy link

@mafftor mafftor commented Jan 6, 2025

This dependency In PHP 8.4 now throws deprecation:

Fluent\Logger\FluentLogger::__construct(): Implicitly marking parameter $packer as nullable is deprecated, the explicit nullable type must be used instead

Recommendation from PHP 8.4: Implicitly nullable parameter declarations deprecated the solution is to explicitly mark the parameter as nullable, or avoid implicit nullability.

To maintain compatibility with PHP 5.6 while addressing this deprecation, I opted to:

  • Remove the type hint for the $packer parameter to avoid the nullable deprecation in PHP 8.4.
  • Manually check the $packer parameter type within the constructor, ensuring it either implements PackerInterface or is null. If it's not, an InvalidArgumentException is thrown.

This change ensures the code works as expected across all supported PHP versions, including PHP 5.6 and PHP 8.4.

Signed-off-by: Yevhenii Miniailenko <mafftor@gmail.com>
@mafftor mafftor force-pushed the fix-implicitly-nullable-parameter-declarations-deprecated branch from 12f14bc to d7f2850 Compare January 6, 2025 12:36
@brianlmoon
Copy link
Contributor

It would be nice to have this pulled in ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants