Skip to content

feat: Add PHPStan and fix static analysis issues - #10

Merged
acoulton merged 17 commits into
1.x-code-stylefrom
feat-phpstan
Nov 4, 2026
Merged

acoulton merged 17 commits into
1.x-code-stylefrom
feat-phpstan

Conversation

@acoulton

@acoulton acoulton commented Nov 4, 2026

Copy link
Copy Markdown
Member

No description provided.

@acoulton
acoulton added this pull request to stack #8 November 4, 2026 13:00
@acoulton
acoulton removed this pull request from stack #8 November 4, 2026 13:07
@acoulton
acoulton added this pull request to stack #11 November 4, 2026 13:08
@acoulton
acoulton requested a review from craig410 November 4, 2026 13:21
There is currently no way to tell phpstan how to type a callable that
accepts any set of arguments, in the pattern that we previously used.

Rather than trying to jump through hoops to support this, it is both
cleaner and safer to have FactoryFunction take a plain callable with no
args. If there's a user-supplied callable that needs args, it can be
wrapped in another callable closer to the original scope - this means
that phpstan will be able to analyse it, and runtime TypeError etc will
appear nearer to the place where the actual problem arises.
Basically only adds declare strict types where possible.
Adds method return types where these are fully known.
Including to the error handler function.
@acoulton
acoulton merged commit 63c83b1 into 2.x Nov 4, 2026
3 checks passed
@acoulton
acoulton deleted the feat-phpstan branch November 4, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants