Tried using psalter
vendor/bin/psalter --php-version=7.1 --debug --dry-run --issues=MissingReturnType,MissingClosureReturnType,InvalidReturnType,InvalidNullableReturnType,InvalidFalsableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,LessSpecificReturnType,PossiblyUndefinedVariable
on 4.x branch of cakephp/cakephp, ended up with following error.
......
Analyzing /mypath/cakephp/src/I18n/TranslatorRegistry.php
PHP Fatal error: Uncaught UnexpectedValueException: Param type must not be null in /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Atomic/CallableTrait.php:76
Stack trace:
#0 [internal function]: Psalm\Type\Atomic\Fn->Psalm\Type\Atomic\{closure}(Object(Psalm\Storage\FunctionLikeParameter))
#1 /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Atomic/CallableTrait.php(88): array_map(Object(Closure), Array)
#2 /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Atomic/TNamedObject.php(120): Psalm\Type\Atomic\Fn->toNamespacedString('Cake\\I18n', Array, 'Cake\\I18n\\Trans...', false)
#3 /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Union.php(344): Psalm\Type\Atomic\TNamedObject->toPhpString('Cake\\I18n', Array, 'Cake\\I18n\\Trans...', 7, 1)
#4 /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Checker/FunctionLike/ReturnTypeChecker.php(676): Psalm\Type\Union->toPhpString('Cake\\I18n', Array, 'Cake\\I18n\\Trans...', 7, 1)
#5 /mypath/cakephp/vendor/vimeo/psa in /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Atomic/CallableTrait.php on line 76
Fatal error: Uncaught UnexpectedValueException: Param type must not be null in /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Atomic/CallableTrait.php:76
Stack trace:
#0 [internal function]: Psalm\Type\Atomic\Fn->Psalm\Type\Atomic\{closure}(Object(Psalm\Storage\FunctionLikeParameter))
#1 /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Atomic/CallableTrait.php(88): array_map(Object(Closure), Array)
#2 /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Atomic/TNamedObject.php(120): Psalm\Type\Atomic\Fn->toNamespacedString('Cake\\I18n', Array, 'Cake\\I18n\\Trans...', false)
#3 /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Union.php(344): Psalm\Type\Atomic\TNamedObject->toPhpString('Cake\\I18n', Array, 'Cake\\I18n\\Trans...', 7, 1)
#4 /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Checker/FunctionLike/ReturnTypeChecker.php(676): Psalm\Type\Union->toPhpString('Cake\\I18n', Array, 'Cake\\I18n\\Trans...', 7, 1)
#5 /mypath/cakephp/vendor/vimeo/psa in /mypath/cakephp/vendor/vimeo/psalm/src/Psalm/Type/Atomic/CallableTrait.php on line 76
Thanks!
I noticed https://github.com/vimeo/psalm/issues/996, while fixing which reflects a certain paucity of documentation in the codebase that Psalter was tested on.
Thanks for the quick fix. BTW can psalter be used without installing it through composer?
at the moment, no
No problem, I can live with that for now :)
And latest master has the fix for return type comment killing
Most helpful comment
And latest master has the fix for return type comment killing