8000 minor #58241 [HttpKernel] allow narrow type of not nullable getRespon… · symfony/symfony@52f1436 · GitHub
[go: up one dir, main page]

Skip to content

Commit 52f1436

Browse files
minor #58241 [HttpKernel] allow narrow type of not nullable getResponse when hasResponse has been called (shyim)
This PR was submitted for the 5.4 branch but it was squashed and merged into the 7.2 branch instead. Discussion ---------- [HttpKernel] allow narrow type of not nullable getResponse when hasResponse has been called | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT ```php if ($event->hasResponse()) { return $event->getResponse(); } ``` PHPStan understands now inside the if that Response is not nullable anymore Commits ------- 69f2f48 [HttpKernel] allow narrow type of not nullable getResponse when hasResponse has been called
2 parents 5cabe45 + 69f2f48 commit 52f1436

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Symfony/Component/HttpKernel/Event/RequestEvent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public function setResponse(Response $response): void
4646

4747
/**
4848
* Returns whether a response was set.
49+
*
50+
* @psalm-assert-if-true !null $this->getResponse()
4951
*/
5052
public function hasResponse(): bool
5153
{

0 commit comments

Comments
 (0)
0