Skip to content

[2.x] fix: PHPStan errors under phpstan 2.2.6 / illuminate 13.22#4842

Merged
imorland merged 1 commit into
2.xfrom
im/phpstan-illuminate-13-22
Jul 26, 2026
Merged

[2.x] fix: PHPStan errors under phpstan 2.2.6 / illuminate 13.22#4842
imorland merged 1 commit into
2.xfrom
im/phpstan-illuminate-13-22

Conversation

@imorland

Copy link
Copy Markdown
Member

phpstan 2.2.6 with illuminate/database 13.22.0 (both released after 2.x's last green run) flag the two when*/unless* database driver macros in DatabaseServiceProvider for accessing the protected $query property on the Builder|Query\Builder union — failing Static Analysis on every 2.x push.

The access was runtime-legal (macro closures are scope-bound to the builder via Closure::call()), but read the property directly. This switches to the public getQuery() accessor, which resolves the same connection on every supported illuminate version.

Unblocks 2.x CI. Verified: PHPStan clean and the database integration tests pass against phpstan 2.2.6 / illuminate 13.22.0 locally.

phpstan 2.2.6 with illuminate/database 13.22.0 flags the two when*/unless*
driver macros for accessing the protected $query property on the builder
union. The access was runtime-legal (macro closures are scope-bound to
the builder), but read the property directly. Switch to the public
getQuery() accessor, which resolves the same connection on every
supported illuminate version.
@imorland
imorland requested a review from a team as a code owner July 26, 2026 22:04
@imorland imorland added this to the 2.0.0-rc.6 milestone Jul 26, 2026
@imorland
imorland merged commit 5815b64 into 2.x Jul 26, 2026
25 checks passed
@imorland
imorland deleted the im/phpstan-illuminate-13-22 branch July 26, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant