Skip to content

[TypeDeclaration] Add NarrowBoolDocblockReturnTypeRector#8127

Merged
TomasVotruba merged 2 commits into
mainfrom
narrow-bool-docblock-return-type
Jun 30, 2026
Merged

[TypeDeclaration] Add NarrowBoolDocblockReturnTypeRector#8127
TomasVotruba merged 2 commits into
mainfrom
narrow-bool-docblock-return-type

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Add NarrowBoolDocblockReturnTypeRector: narrows @return docblock bool to false or true when the native return type only allows one of them.

 /**
- * @return bool|string[]
+ * @return false|string[]
  */
 public function run(): false|array
  • Native return type must be a union containing exactly one of false/true (not both, not bool).
  • Docblock @return must be a union containing bool.
  • Swaps the bool node in-place, preserving the rest of the union.
  • Docblock-only change, no PHP version bump.

@TomasVotruba TomasVotruba force-pushed the narrow-bool-docblock-return-type branch from efec3d1 to 7413a5d Compare June 30, 2026 15:31
@TomasVotruba TomasVotruba force-pushed the narrow-bool-docblock-return-type branch from 647220d to 3b31e56 Compare June 30, 2026 16:43
@TomasVotruba TomasVotruba merged commit cdddd9d into main Jun 30, 2026
65 checks passed
@TomasVotruba TomasVotruba deleted the narrow-bool-docblock-return-type branch June 30, 2026 16:49
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.

1 participant