4 ms·
Psalm is nice, however I would suggest PHPStan as an alternative for people that encounter a lot of friction with Psalm. For example, in a project using doctri
by mhitza 6y ago
Psalm is nice, however I would suggest PHPStan as an alternative for people that encounter a lot of friction with Psalm.
For example, in a project using doctrine I have to add a bunch of is null/@psal-mutation-free annotations. As all the methods can return null.
However, if Psalm had support for something like phantom types, maybe I could tag entities returned from the database for whom certain fields are guaranteed to have values.
- slifin 6y agoAdding Phan to this conversation initially created by the creator of a PHP, now in the hands of TysonAndre who does an insane amount of good work on it
- noir_lord 6y agoFor users of the intellij family (idea or phpstorm). https://plugins.jetbrains.com/plugin/10215-php-inspections-ea-ultimate- https://plugins.jetbrains.com/plugin/10215-php-inspections-e... is amazing and well worth the price. It has a free variant which is still amazing but lacks all the inspections of the paid variant. https://plugins.jetbrains.com/plugin/7622-php-inspections-ea-extended- https://plugins.jetbrains.com/plugin/7622-php-inspections-ea...
- muglug 6y agoPsalm has levels – higher levels show fewer warnings (just like in PHPStan). Maybe the `@psalm-ignore-nullable-return` annotation is more appropriate for those methods? Do you use the Doctrine plugin?
- mhitza 6y agoI set these kinds of tools up to the highest level possible. In my opinion that is where you get the highest value from them. I was not aware of the any psalm doctrine plugin and will definitely have a look at it. Thanks for the suggestion. In terms of @psalm-ignore-nullable-return annotation. That definitely sounds like a practical workaround, at the moment.