Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dbcc6cb

Browse filesBrowse files
committed
[HttpKernel] Add more parameter types.
1 parent 90e3da4 commit dbcc6cb
Copy full SHA for dbcc6cb

File tree

12 files changed

+24
-16
lines changed
Filter options

12 files changed

+24
-16
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/CacheClearer/Psr6CacheClearer.php
+3-3Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/HttpCache/Store.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Profiler/Profile.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
+2-1Lines 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
});

‎src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/KernelTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ protected function getKernel(array $methods = [], array $bundles = [])
641641
return $kernel;
642642
}
643643

644-
protected function getKernelForTest(array $methods = [], $debug = false)
644+
protected function getKernelForTest(array $methods = [], bool $debug = false)
645645
{
646646
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest')
647647
->setConstructorArgs(['test', $debug])
@@ -661,7 +661,7 @@ public function terminate()
661661
$this->terminateCalled = true;
662662
}
663663

664-
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
664+
public function handle(Request $request, int $type = self::MASTER_REQUEST, bool $catch = true)
665665
{
666666
}
667667
}

‎src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ public function testChildren()
5353
$parentProfile->setIp('127.0.0.1');
5454
$parentProfile->setUrl('http://foo.bar/parent');
5555
$parentProfile->setStatusCode(200);
56+
$parentProfile->setMethod('GET');
5657

5758
$childProfile = new Profile('token_child');
5859
$childProfile->setIp('127.0.0.1');
5960
$childProfile->setUrl('http://foo.bar/child');
6061
$childProfile->setStatusCode(200);
62+
$childProfile->setMethod('GET');
6163

6264
$parentProfile->addChild($childProfile);
6365

@@ -86,6 +88,7 @@ public function testStoreSpecialCharsInUrl()
8688
$profile->setUrl('http://foo.bar/\'');
8789
$profile->setIp('127.0.0.1');
8890
$profile->setStatusCode(200);
91+
$profile->setMethod('GET');
8992

9093
$this->storage->write($profile);
9194
$this->assertNotFalse($this->storage->read('simple_quote'), '->write() accepts single quotes in URL');
@@ -94,6 +97,7 @@ public function testStoreSpecialCharsInUrl()
9497
$profile->setUrl('http://foo.bar/"');
9598
$profile->setIp('127.0.0.1');
9699
$profile->setStatusCode(200);
100+
$profile->setMethod('GET');
97101

98102
$this->storage->write($profile);
99103
$this->assertNotFalse($this->storage->read('double_quote'), '->write() accepts double quotes in URL');
@@ -102,6 +106,7 @@ public function testStoreSpecialCharsInUrl()
102106
$profile->setUrl('http://foo.bar/\\');
103107
$profile->setIp('127.0.0.1');
104108
$profile->setStatusCode(200);
109+
$profile->setMethod('GET');
105110

106111
$this->storage->write($profile);
107112
$this->assertNotFalse($this->storage->read('backslash'), '->write() accepts backslash in URL');
@@ -110,6 +115,7 @@ public function testStoreSpecialCharsInUrl()
110115
$profile->setUrl('http://foo.bar/,');
111116
$profile->setIp('127.0.0.1');
112117
$profile->setStatusCode(200);
118+
$profile->setMethod('GET');
113119

114120
$this->storage->write($profile);
115121
$this->assertNotFalse($this->storage->read('comma'), '->write() accepts comma in URL');
@@ -121,6 +127,7 @@ public function testStoreDuplicateToken()
121127
$profile->setUrl('http://example.com/');
122128
$profile->setIp('127.0.0.1');
123129
$profile->setStatusCode(200);
130+
$profile->setMethod('GET');
124131

125132
$this->assertTrue($this->storage->write($profile), '->write() returns true when the token is unique');
126133

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.