Fix PropertyTag::setPropertyName() deprecation warning
ErrorException: Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated
#18 /vendor/laminas/laminas-code/src/Generator/DocBlock/Tag/ParamTag.php(55): Laminas\Code\Generator\DocBlock\Tag\ParamTag::setVariableName
#17 /vendor/laminas/laminas-code/src/Generator/DocBlock/TagManager.php(59): Laminas\Code\Generator\DocBlock\TagManager::createTagFromReflection
#16 /vendor/laminas/laminas-code/src/Generator/DocBlockGenerator.php(48): Laminas\Code\Generator\DocBlockGenerator::fromReflection
#15 /vendor/laminas/laminas-code/src/Generator/MethodGenerator.php(47): Laminas\Code\Generator\MethodGenerator::fromReflection
@alexmerlin
@Ocramius are you able to help to push that forward?
@gsteel
@lifinsky
nullis not an acceptable parameter here.Simply casting with
(string)because it might receive a null argument introduces the probability that someone will send an array and we'll have a PHP warning for array to string conversion.
Done
@gsteel The linter didn’t allow casting to (string) because it’s redundant — PHPDoc already defines it as a string. I replaced it with !empty, as done elsewhere.
@gsteel use cast is needed to keep existing behaviour, except it needs to go to 4.0.0
I am going to close this, this is expected, as signature is string, which not allow null, even docblock should be respected by the app that uses it.
The refactor will require major version.
Thank you for understanding.