spryker / code-sniffer

Spryker Code Sniffer
https://spryker.com
MIT License
36 stars 11 forks source link

Fix WrongNullable false positive #369

Open hemberger opened 1 year ago

hemberger commented 1 year ago

The nullable field returned from SignatureTrait::getMethodSignature is used by DocBlockParamAllowDefaultValueSniff assuming that it means whether or not the parameter accepts null, so we need to also check if an explicit null is part of the typehint. This is because in the arrays returned by File::getMethodParameters, the nullable_type field only indicates if the typehint is prefixed with "?".

Fixes #368.

Checklist

dereuromark commented 1 year ago

Looks good to me! Cc @gechetspr

dereuromark commented 1 year ago

ping @gechetspr