[TASK] Add PHPStan extension to allow assertions#1594
Merged
Conversation
7e5ccfa to
6f316fa
Compare
Suppress warnings for `assert()`s that, according to the DocBlock, can never fail, but in reality could, due to programmer error, since the DocBlock types are not enforced by PHP. This allows us to restore `treatPhpDocTypesAsCertain:true` for stricter static analysis, whilst also using assertions for runtime checks in a development environment, without cluttering up the code with `@phpstan-ignore` comments. The change parallels MyIntervals/emogrifier#1624. It may be possible in future to move the extension to a separate package.
6f316fa to
1ae8385
Compare
oliverklee
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Suppress warnings for
assert()s that, according to the DocBlock, can never fail, but in reality could, due to programmer error, since the DocBlock types are not enforced by PHP.This allows us to restore
treatPhpDocTypesAsCertain:truefor stricter static analysis, whilst also using assertions for runtime checks in a development environment, without cluttering up the code with@phpstan-ignorecomments.The change parallels MyIntervals/emogrifier#1624. It may be possible in future to move the extension to a separate package.