Skip to content

Commit 05fe553

Browse files
[HttpKernel] Fix return type declarations
1 parent e0d79f7 commit 05fe553

File tree

19 files changed

+42
-39
lines changed

19 files changed

+42
-39
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ public function testProfilerIsDisabled($insulate)
2424
}
2525

2626
$client->request('GET', '/profiler');
27-
$this->assertFalse($client->getProfile());
27+
$this->assertNull($client->getProfile());
2828

2929
// enable the profiler for the next request
3030
$client->enableProfiler();
31-
$this->assertFalse($client->getProfile());
31+
$this->assertNull($client->getProfile());
3232
$client->request('GET', '/profiler');
3333
$this->assertIsObject($client->getProfile());
3434

3535
$client->request('GET', '/profiler');
36-
$this->assertFalse($client->getProfile());
36+
$this->assertNull($client->getProfile());
3737
}
3838

3939
public function getConfigs()

src/Symfony/Component/BrowserKit/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function getServer()
107107
/**
108108
* Gets the request raw body data.
109109
*
110-
* @return string The request raw body data
110+
* @return string|null The request raw body data
111111
*/
112112
public function getContent()
113113
{

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ public static function underscore($id)
444444

445445
/**
446446
* Creates a service by requiring its factory file.
447-
*
448-
* @return object The service created by the file
449447
*/
450448
protected function load($file)
451449
{

src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ interface DumperInterface
2121
/**
2222
* Dumps the service container.
2323
*
24-
* @param array $options An array of options
25-
*
26-
* @return string The representation of the service container
24+
* @return string|array The representation of the service container
2725
*/
2826
public function dump(array $options = []);
2927
}

src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ public function getController(Request $request)
8585
}
8686
}
8787

88-
$callable = $this->createController($controller);
89-
90-
if (!\is_callable($callable)) {
91-
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $this->getControllerError($callable)));
88+
try {
89+
$callable = $this->createController($controller);
90+
} catch (\InvalidArgumentException $e) {
91+
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()));
9292
}
9393

9494
return $callable;
@@ -165,7 +165,7 @@ protected function doGetArguments(Request $request, $controller, array $paramete
165165
*
166166
* @return callable A PHP callable
167167
*
168-
* @throws \InvalidArgumentException
168+
* @throws \InvalidArgumentException When the controller cannot be created
169169
*/
170170
protected function createController($controller)
171171
{
@@ -179,7 +179,13 @@ protected function createController($controller)
179179
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
180180
}
181181

182-
return [$this->instantiateController($class), $method];
182+
$controller = [$this->instantiateController($class), $method];
183+
184+
if (!\is_callable($controller)) {
185+
throw new \InvalidArgumentException($this->getControllerError($controller));
186+
}
187+
188+
return $controller;
183189
}
184190

185191
/**

src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function getApplicationVersion()
119119
/**
120120
* Gets the token.
121121
*
122-
* @return string The token
122+
* @return string|null The token
123123
*/
124124
public function getToken()
125125
{

src/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function hasException()
5555
/**
5656
* Gets the exception.
5757
*
58-
* @return \Exception The exception
58+
* @return \Exception|FlattenException
5959
*/
6060
public function getException()
6161
{

src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ public function lateCollect()
7272
}
7373
}
7474

75-
/**
76-
* Gets the logs.
77-
*
78-
* @return array An array of logs
79-
*/
8075
public function getLogs()
8176
{
8277
return isset($this->data['logs']) ? $this->data['logs'] : [];

src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function getInitTime()
132132
/**
133133
* Gets the request time.
134134
*
135-
* @return int The time
135+
* @return float
136136
*/
137137
public function getStartTime()
138138
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors)
110110
}
111111
}
112112

113-
return null;
113+
return '';
114114
}
115115

116116
/**

0 commit comments

Comments
 (0)