Skip to content

Commit

Permalink
Remove HttpKernelInterface::MASTER_REQUEST references
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Dec 3, 2023
1 parent 892f208 commit 7fd2127
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 32 deletions.
18 changes: 0 additions & 18 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,3 @@ parameters:
count: 1
path: tests/DependencyInjection/ConfigurationTest.php

-
message: """
#^Fetching deprecated class constant MASTER_REQUEST of class Symfony\\\\Component\\\\HttpKernel\\\\HttpKernelInterface\\:
since symfony/http\\-kernel 5\\.3, use MAIN_REQUEST instead\\.
To ease the migration, this constant won't be removed until Symfony 7\\.0\\.$#
"""
count: 1
path: tests/Listener/ListenerTestCase.php

-
message: """
#^Fetching deprecated class constant MASTER_REQUEST of class Symfony\\\\Component\\\\HttpKernel\\\\HttpKernelInterface\\:
since symfony/http\\-kernel 5\\.3, use MAIN_REQUEST instead\\.
To ease the migration, this constant won't be removed until Symfony 7\\.0\\.$#
"""
count: 1
path: tests/Twig/IntegrationTest.php

5 changes: 1 addition & 4 deletions tests/Listener/ListenerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ private function getRequestType(bool $mainRequest): int
return HttpKernelInterface::SUB_REQUEST;
}

return \defined(HttpKernelInterface::class.'::MAIN_REQUEST')
? HttpKernelInterface::MAIN_REQUEST
: HttpKernelInterface::MASTER_REQUEST
;
return HttpKernelInterface::MAIN_REQUEST;
}
}
12 changes: 2 additions & 10 deletions tests/Twig/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testItWorksDynamically(): void
$listener->onKernelRequest(new RequestEvent(
$this->createStub(HttpKernelInterface::class),
Request::create('/'),
$this->getMasterRequestType()
HttpKernelInterface::MAIN_REQUEST
));

$this->assertSame('<script type="text/javascript">console.log(\'123456\');</script>
Expand Down Expand Up @@ -113,7 +113,7 @@ public function testItWorksStatically(): void
$listener->onKernelRequest(new RequestEvent(
$this->createStub(HttpKernelInterface::class),
Request::create('/'),
$this->getMasterRequestType()
HttpKernelInterface::MAIN_REQUEST
));

$this->assertSame('<script type="text/javascript">console.log(\'Hello\');</script>
Expand All @@ -127,12 +127,4 @@ public function testItWorksStatically(): void

$this->assertSame(['script-src' => ['sha-script'], 'style-src' => ['sha-style']], $getSha($listener));
}

private function getMasterRequestType(): int
{
return \defined(HttpKernelInterface::class.'::MAIN_REQUEST')
? HttpKernelInterface::MAIN_REQUEST
: HttpKernelInterface::MASTER_REQUEST
;
}
}

0 comments on commit 7fd2127

Please sign in to comment.