Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the nullable parameter declarations for compatibility with PHP 8.4 #144

Closed
martio opened this issue Dec 25, 2024 · 1 comment
Closed
Labels

Comments

@martio
Copy link
Contributor

martio commented Dec 25, 2024

Hi! 😃

I have prepared a small fix that resolves the following issue:

DEPRECATED  Yiisoft\Translator\TranslatorInterface::translate(): Implicitly marking parameter $locale as nullable is deprecated, the explicit nullable type must be used instead in vendor/yiisoft/translator/src/TranslatorInterface.php on line 46.

Yiisoft\Translator\TranslatorInterface

   public function translate(
       string|Stringable $id,
       array $parameters = [],
       string $category = null,
       string $locale = null
   ): string;

What steps will reproduce the problem?

Attempt to use the Yiisoft\Translator\TranslatorInterface::translate method in a PHP 8.4 environment without explicitly declaring nullable types for parameters like $locale.

What is the expected result?

The translate method should function without deprecation warnings, and the application should remain compatible with PHP 8.4.

What do you get instead?

A deprecation warning is triggered:
DEPRECATED: Yiisoft\Translator\TranslatorInterface::translate(): Implicitly marking parameter $locale as nullable is deprecated, the explicit nullable type must be used instead in vendor/yiisoft/translator/src/TranslatorInterface.php on line 46.`

Additional info

Q A
Version 2.1.0
PHP version 8.4.1
Operating system Unix
@samdark samdark added the type:bug Bug label Dec 25, 2024
@vjik
Copy link
Member

vjik commented Dec 25, 2024

Done by #148

@vjik vjik closed this as completed Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants