Open kernusr opened 11 months ago
Hey @kernusr, can you reproduce the issue on https://psalm.dev ?
Can you use a line annotation /* @psalm-suppress FalsableReturnStatement / ?
Abstract example code I'm using: https://psalm.dev/r/6cd6dc751a
ModelInterface
, ItemModel
, Table
is parts of Joomla CMS
I can't get rid of return false
, because this is a rule of the framework. All models must return item data object on success, false on failure.
I found these snippets:
Can you use a line annotation /* @psalm-suppress FalsableReturnStatement / ?
I could use this solution But similar code occurs 98 times in the project and I wanted to suppress the issue by config via XML file
Of course, it would be more correct to make changes in all places where a similar problem occurs, but now it is too expensive for us
I chose a different path First I want to suppress all not too critical issues and gradually solve them in the future
So what you're saying is that vendor-supplied ModelInterface
has an incorrect docblock? Then you should be able to override it with a stub.
In xsd config for
FalsableReturnStatement
issue set type isIssueHandlerType
https://github.com/vimeo/psalm/blob/f1fc9c4887e4d362b0455ef2ad56670550a492f2/config.xsd#L235C62-L235C78IssueHandlerType
only allows suppression for folder and file. https://github.com/vimeo/psalm/blob/f1fc9c4887e4d362b0455ef2ad56670550a492f2/config.xsd#L506C1-L519C23How to suppress this issue for just one method in a class or one function in a file?