Skip to content

[TypeDeclarationDocblocks] Skip overridden methods in DocblockReturnArrayFromDirectArrayInstanceRector#7995

Merged
TomasVotruba merged 1 commit into
mainfrom
fix/9599-docblock-skip-overridden
May 18, 2026
Merged

[TypeDeclarationDocblocks] Skip overridden methods in DocblockReturnArrayFromDirectArrayInstanceRector#7995
TomasVotruba merged 1 commit into
mainfrom
fix/9599-docblock-skip-overridden

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

Summary

  • Skip @return docblock generation in DocblockReturnArrayFromDirectArrayInstanceRector when the ClassMethod overrides a parent class or interface method
  • Follows the existing pattern used by AddParamArrayDocblockFromDimFetchAccessRector (same guard, same call-site shape)
  • Adds skip_overridden_method.php.inc fixture covering the interface + abstract-parent repro from the issue

Fixes rectorphp/rector#9599

Test plan

  • vendor/bin/phpunit rules-tests/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockReturnArrayFromDirectArrayInstanceRector/ — 24 tests pass
  • Verified the new fixture fails when the guard is removed (proves it exercises the new code path)

…rrayFromDirectArrayInstanceRector

Skip @return docblock generation when the ClassMethod overrides a
parent/interface method, to avoid conflicting with the existing
parent docblock contract.

Fixes rectorphp/rector#9599
@TomasVotruba TomasVotruba merged commit 27c0087 into main May 18, 2026
77 checks passed
@TomasVotruba TomasVotruba deleted the fix/9599-docblock-skip-overridden branch May 18, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect behavior of DocblockReturnArrayFromDirectArrayInstanceRector

1 participant