phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

implement FunctionReflection->getDocComment()

Open staabm opened this issue 3 years ago • 2 comments

as discussed in https://github.com/phpstan/phpstan-src/pull/1804#discussion_r994404893

staabm avatar Oct 13 '22 14:10 staabm

the errors of the failled job also appear in other currently open PRs, therefore seem unrelated

staabm avatar Oct 13 '22 16:10 staabm

just applied and covered the cases mentioned in https://github.com/phpstan/phpstan-src/pull/1804#issuecomment-1277556907

staabm avatar Oct 15 '22 16:10 staabm

I just spent the morning working on this PR because I particularly didn't like the hasPhpDocString() approach... But I painfully realized that it has to work like this because of some mess in PhpDocInheritanceResolver / PhpDocBlock.

I wanted for docBlockToResolvedDocBlock() method to return null for non-existent docComments but it cannot work this way.

Turns out we have to call $oneResolvedDockBlock->merge even on an empty docblock because otherwise generics aren't correctly resolved...

ondrejmirtes avatar Oct 16 '22 08:10 ondrejmirtes

Thank you.

ondrejmirtes avatar Oct 16 '22 08:10 ondrejmirtes

Now you can get to the @param-out PR :)

ondrejmirtes avatar Oct 16 '22 08:10 ondrejmirtes

Thanks for finishing it.

I didn't like the hasPhpDoc-method either, but couldn't come up with something better which worked ;-)

staabm avatar Oct 16 '22 08:10 staabm

Now you can get to the @param-out PR

Yep, now I have a better idea on the cases beeing involved

staabm avatar Oct 16 '22 08:10 staabm

BTW looks like this PR broke several cases:

  • https://github.com/phpstan/phpstan/issues/7519#issuecomment-1279925958
  • https://github.com/phpstan/phpstan/issues/7317#issuecomment-1279925995
  • https://github.com/phpstan/phpstan/issues/6829#issuecomment-1279926099

Can you please reproduce that and investigate that? Thaks!

ondrejmirtes avatar Oct 16 '22 09:10 ondrejmirtes

opened a separate issue to handle the regressions with https://github.com/phpstan/phpstan/issues/8175

staabm avatar Oct 17 '22 11:10 staabm