spatie / laravel-translatable

Making Eloquent models translatable
https://spatie.be/docs/laravel-translatable
MIT License
2.26k stars 281 forks source link

fix: PHPDoc block in Translatable facade #448

Closed kyryl-bogach closed 6 months ago

kyryl-bogach commented 6 months ago

Fix fallback method definition that is lacking "void", occasioning code analyzers like PHPStan to fail. This was recently introduced here.

The previous PHPdoc is not a valid php-doc comment and causes issues on, for example, PHPStan when analyzing the code:

image

freekmurze commented 6 months ago

Thanks!

Muetze42 commented 6 months ago

Oh. I've just looked again.

If the intended method is static, the static keyword can be placed before the return type to communicate that. In that case, a return type MUST be provided, as static on its own would mean that the method returns an instance of the child class which the method is called on.

https://docs.phpdoc.org/latest/guide/references/phpdoc/tags/method.html

PhpStorm did not show me an error either. I actually didn't know that it had to be specified for static methods. Now I know and it no longer occurs.