Fix 2914: Merge PHPDoc block tags when inheriting#193
Fix 2914: Merge PHPDoc block tags when inheriting#193alexeyinkin wants to merge 7 commits intophpstan:masterfrom
Conversation
# Conflicts: # src/PhpDoc/ResolvedPhpDocBlock.php
|
Hi, the build failure means that somewhere in your changes there's an infinite recursion. You can run PHPUnit with Try running Some of the changes in tests seem unnecessary and unrelated, like: -namespace ForeachWithComplexValueType;
+namespace ForeachIterableWithComplexValueType;Please get rid of them. Otherwise, this PR seems promising, although it needs some work :) Thank you and I hope we can sucessfully bring this over the finish line. |
| <arg value="--tab-width=4"/> | ||
| <arg value="--cache=tmp/cache/phpcs"/> | ||
| <arg value="--ignore=tests/*/data,tests/*/traits,tests/notAutoloaded,src/Reflection/SignatureMap/functionMap.php"/> | ||
| <arg value="--ignore=tests/*/data,tests/*/traits,tests/notAutoloaded,tests/*/cache,src/Reflection/SignatureMap/functionMap.php"/> |
There was a problem hiding this comment.
Otherwise it checks local generated files.
| * @param array<int, self> $parents | ||
| * @param array<int, PhpDocBlock> $parentPhpDocBlocks | ||
| */ | ||
| private function mergeTags(array $parents, array $parentPhpDocBlocks): void // phpcs:disable |
There was a problem hiding this comment.
I haven't seed phpcs:disable in your code but not detecting clones is a known issue with phpcs:
slevomat/coding-standard#642
There was a problem hiding this comment.
I don't want to use clone anyway. I always want to call constructor explicitly. Thanks.
|
Please rebase the branch so that it's on top of master and there are now merge commits :) Thanks. |
This merges var, param, return, throws, and deprecated tags for now.
I resorted to a quicker solution keeping PhpDocBlock and also improved it by storing parent blocks. The problem with getting rid of PhpDocBlock is that is stores the param name mapping. It cannot be stored in ResolvedPhpDocBlock because the mapping describes a unit of inheritance and not a ResolvedPhpDocBlock itself (which could be a result of a merge).
I could not write a test to merge 'deprecated' tags because deprecation rules are in a separate repository and the easiest test would be to break a rule. You may add a test in a more complicated way.
I could not run all the existing tests because:
-- 'vendor/bin/phing tests' hangs at 85% for some reason.
-- 'vendor/bin/phpunit --bootstrap=tests/bootstrap.php tests' for some reason attempts to run phpunit recursively at 62% and dies with 'Cannot open file "tests/bootstrap.php"'
Other that that all tests before the '85%' are green.