Skip to content

Commit dbcc6cb

Browse files
committed
[HttpKernel] Add more parameter types.
1 parent 90e3da4 commit dbcc6cb

File tree

12 files changed

+24
-16
lines changed

12 files changed

+24
-16
lines changed

src/Symfony/Component/HttpKernel/CacheClearer/Psr6CacheClearer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ public function __construct(array $pools = [])
2323
$this->pools = $pools;
2424
}
2525

26-
public function hasPool($name)
26+
public function hasPool(string $name)
2727
{
2828
return isset($this->pools[$name]);
2929
}
3030

31-
public function getPool($name)
31+
public function getPool(string $name)
3232
{
3333
if (!$this->hasPool($name)) {
3434
throw new \InvalidArgumentException(sprintf('Cache pool not found: %s.', $name));
@@ -37,7 +37,7 @@ public function getPool($name)
3737
return $this->pools[$name];
3838
}
3939

40-
public function clearPool($name)
40+
public function clearPool(string $name)
4141
{
4242
if (!isset($this->pools[$name])) {
4343
throw new \InvalidArgumentException(sprintf('Cache pool not found: %s.', $name));

src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
abstract class CacheWarmer implements CacheWarmerInterface
2020
{
21-
protected function writeCacheFile($file, $content)
21+
protected function writeCacheFile(string $file, $content)
2222
{
2323
$tmpFile = @tempnam(\dirname($file), basename($file));
2424
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {

src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function __sleep(): array
7676
/**
7777
* @internal
7878
*/
79-
public static function generateUrlFormat(UrlGeneratorInterface $router, $routeName, $queryString): ?string
79+
public static function generateUrlFormat(UrlGeneratorInterface $router, string $routeName, string $queryString): ?string
8080
{
8181
try {
8282
return $router->generate($routeName).$queryString;

src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ExceptionListener implements EventSubscriberInterface
3333
protected $logger;
3434
protected $debug;
3535

36-
public function __construct($controller, LoggerInterface $logger = null, $debug = false)
36+
public function __construct($controller, LoggerInterface $logger = null, bool $debug = false)
3737
{
3838
$this->controller = $controller;
3939
$this->logger = $logger;

src/Symfony/Component/HttpKernel/HttpCache/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ private function save(string $key, string $data): bool
390390
return true;
391391
}
392392

393-
public function getPath($key)
393+
public function getPath(string $key)
394394
{
395395
return $this->root.\DIRECTORY_SEPARATOR.substr($key, 0, 2).\DIRECTORY_SEPARATOR.substr($key, 2, 2).\DIRECTORY_SEPARATOR.substr($key, 4, 2).\DIRECTORY_SEPARATOR.substr($key, 6);
396396
}

src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
class SubRequestHandler
2525
{
26-
public static function handle(HttpKernelInterface $kernel, Request $request, $type, $catch): Response
26+
public static function handle(HttpKernelInterface $kernel, Request $request, int $type, bool $catch): Response
2727
{
2828
// save global state related to trusted headers and proxies
2929
$trustedProxies = Request::getTrustedProxies();

src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function purge()
113113
/**
114114
* {@inheritdoc}
115115
*/
116-
public function read($token)
116+
public function read(string $token)
117117
{
118118
if (!$token || !file_exists($file = $this->getFilename($token))) {
119119
return null;
@@ -257,7 +257,7 @@ protected function readLineFromFile($file)
257257
return '' === $line ? null : $line;
258258
}
259259

260-
protected function createProfileFromData($token, $data, $parent = null)
260+
protected function createProfileFromData(string $token, array $data, Profile $parent = null)
261261
{
262262
$profile = new Profile($token);
263263
$profile->setIp($data['ip']);

src/Symfony/Component/HttpKernel/Profiler/Profile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function getMethod()
114114
return $this->method;
115115
}
116116

117-
public function setMethod($method)
117+
public function setMethod(string $method)
118118
{
119119
$this->method = $method;
120120
}

src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ class TestCacheWarmer extends CacheWarmer
4949
{
5050
protected $file;
5151

52-
public function __construct($file)
52+
public function __construct(string $file)
5353
{
5454
$this->file = $file;
5555
}
5656

57-
public function warmUp($cacheDir)
57+
public function warmUp(string $cacheDir)
5858
{
5959
$this->writeCacheFile($this->file, 'content');
6060
}

src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\HttpFoundation\Response;
2121
use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface;
2222
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
23+
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
2324
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
2425
use Symfony\Component\HttpKernel\Exception\ControllerDoesNotReturnResponseException;
2526
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
@@ -122,7 +123,7 @@ public function getStatusCodes()
122123
public function testHandleWhenAnExceptionIsHandledWithASpecificStatusCode($expectedStatusCode)
123124
{
124125
$dispatcher = new EventDispatcher();
125-
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) use ($expectedStatusCode) {
126+
$dispatcher->addListener(KernelEvents::EXCEPTION, function (ExceptionEvent $event) use ($expectedStatusCode) {
126127
$event->allowCustomResponseCode();
127128
$event->setResponse(new Response('', $expectedStatusCode));
128129
});

0 commit comments

Comments
 (0)