Oprava PHPStan chyby instanceof.alwaysTrue u Presenter::getRequest()#1296
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1296 +/- ##
==========================================
+ Coverage 48.77% 48.80% +0.03%
==========================================
Files 61 61
Lines 2901 2899 -2
==========================================
Hits 1415 1415
+ Misses 1486 1484 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Presenter::getRequest() je v aktuálních verzích nette/application non-nullable a uvnitř signal handleru není nikdy null, takže kontrola instanceof byla mrtvý kód způsobující PHPStan chybu instanceof.alwaysTrue. Odstraněn i nepoužitý import.
radimvaculik
force-pushed
the
fix/phpstan-instanceof-request
branch
from
July 14, 2026 08:10
da3cc76 to
88e0043
Compare
f3l1x
approved these changes
Jul 16, 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.
Problem
The PHPStan CI job (which runs
composer update→ latest dependencies) fails onmaster:Since nette/application v3.3.0,
Presenter::getRequest()returns a non-nullableNette\Application\Request(previously?Request). The defensiveinstanceof Requestguard inhandleEdit()therefore becomes always-true and PHPStan reports it.This is unrelated to any feature work — it is pure dependency drift and reproduces on a clean
master(verified locally withnette/applicationupgraded tov3.3.0).Fix
handleEdit()is a signal handler (handle*), sogetPresenterInstance()->getRequest()is always set while it runs — it can never benullthere. Theinstanceof Requestguard was dead defensive code left over from whengetRequest()was typed?Request. It is removed, along with the now-unuseduse Nette\Application\Request;import.Verification
make phpstanpasses withnette/application v3.3.0installed (the version CI resolves).