Since phpstan 1.6 it is possible to use conditional return statements, phpstorm supports parsing this type of phpdoc since 2022.3.1 but it seems that the inspection provided by this plugin does not and returns some false positives in the inspection results.
As seen in the screenshots, if the parameter $required is set to true the function will return a non nullable value so the null pointer exception will not happen later:


Not sure that this change is possible/easy to do but it would be great if someone can have a look at it and see if it is possible to handle this case. (Currently I add a phpdoc comment to silence this inspection but it does not seem to be ideal)

Since phpstan 1.6 it is possible to use conditional return statements, phpstorm supports parsing this type of phpdoc since 2022.3.1 but it seems that the inspection provided by this plugin does not and returns some false positives in the inspection results.
As seen in the screenshots, if the parameter


$requiredis set totruethe function will return a non nullable value so the null pointer exception will not happen later:Not sure that this change is possible/easy to do but it would be great if someone can have a look at it and see if it is possible to handle this case. (Currently I add a phpdoc comment to silence this inspection but it does not seem to be ideal)
