Skip to content

Conversation

@williamjallen
Copy link
Collaborator

PHP type annotations improve static analysis because static analysis tools can make stronger guarantees about types further down the AST. These type hints are immensely useful for developers using PHP-specific IDEs such as myself. This PR adds type annotations to many functions throughout the codebase where the return type is immediately clear from a brief inspection of the implementation. In addition to clearing nuisance warnings in my IDE, PHPStan analysis is improved as can be seen from some of the more specific errors changed in the PHPStan baseline.

Copy link
Member

@josephsnyder josephsnyder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Didn't read every line but spot-checking seemed reasonable.

@josephsnyder josephsnyder added this pull request to the merge queue Jul 31, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 31, 2025
@williamjallen williamjallen added this pull request to the merge queue Jul 31, 2025
Merged via the queue into Kitware:master with commit 06cc8e8 Jul 31, 2025
7 checks passed
@williamjallen williamjallen deleted the return-type-annotations branch July 31, 2025 18:34
github-merge-queue bot pushed a commit that referenced this pull request Aug 6, 2025
The `void_return` rule was previously disabled due to other broken type
annotations trickling through the inheritance hierarchy and causing it
to choose the wrong annotations. Now that
#3011 is complete, this is no
longer an issue and the `void_return` fixer can be re-enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants