Skip to content

Commit 46c4bcd

Browse files
Add missing @return annotations to fix deprecations on PHP 8
1 parent 3860f64 commit 46c4bcd

27 files changed

+78
-2
lines changed

Argument/ServiceLocator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function __construct(\Closure $factory, array $serviceMap, array $service
3434

3535
/**
3636
* {@inheritdoc}
37+
*
38+
* @return mixed
3739
*/
3840
public function get($id)
3941
{

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getParameterBag()
109109
*
110110
* @param string $name The parameter name
111111
*
112-
* @return mixed The parameter value
112+
* @return array|bool|float|int|string|null The parameter value
113113
*
114114
* @throws InvalidArgumentException if the parameter is not defined
115115
*/

ContainerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function initialized($id);
7676
*
7777
* @param string $name The parameter name
7878
*
79-
* @return mixed The parameter value
79+
* @return array|bool|float|int|string|null The parameter value
8080
*
8181
* @throws InvalidArgumentException if the parameter is not defined
8282
*/

Dumper/PhpDumper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,9 @@ private function addDefaultParametersMethod(): string
14491449

14501450
$code = <<<'EOF'
14511451
1452+
/**
1453+
* @return array|bool|float|int|string|null
1454+
*/
14521455
public function getParameter($name)
14531456
{
14541457
$name = (string) $name;

ServiceLocator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class ServiceLocator implements ServiceProviderInterface
3333
private $externalId;
3434
private $container;
3535

36+
/**
37+
* {@inheritdoc}
38+
*
39+
* @return mixed
40+
*/
3641
public function get($id)
3742
{
3843
if (!$this->externalId) {

Tests/Compiler/IntegrationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@ public function __construct(ServiceLocator $locator)
537537
$this->locator = $locator;
538538
}
539539

540+
/**
541+
* @return mixed
542+
*/
540543
public function get($id)
541544
{
542545
return $this->locator->get($id);

Tests/Fixtures/php/services10.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ protected function getTestService()
5959
return $this->services['test'] = new \stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line']);
6060
}
6161

62+
/**
63+
* @return array|bool|float|int|string|null
64+
*/
6265
public function getParameter($name)
6366
{
6467
$name = (string) $name;

Tests/Fixtures/php/services12.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ protected function getTestService()
5959
return $this->services['test'] = new \stdClass(('file://'.\dirname(__DIR__, 1)), [('file://'.\dirname(__DIR__, 1)) => (\dirname(__DIR__, 2).'/')]);
6060
}
6161

62+
/**
63+
* @return array|bool|float|int|string|null
64+
*/
6265
public function getParameter($name)
6366
{
6467
$name = (string) $name;

Tests/Fixtures/php/services19.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ protected function getServiceWithMethodCallAndFactoryService()
7474
return $instance;
7575
}
7676

77+
/**
78+
* @return array|bool|float|int|string|null
79+
*/
7780
public function getParameter($name)
7881
{
7982
$name = (string) $name;

Tests/Fixtures/php/services26.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ protected function getTestService()
7070
return $this->services['test'] = new ${($_ = $this->getEnv('FOO')) && false ?: "_"}($this->getEnv('Bar'), 'foo'.$this->getEnv('string:FOO').'baz', $this->getEnv('int:Baz'));
7171
}
7272

73+
/**
74+
* @return array|bool|float|int|string|null
75+
*/
7376
public function getParameter($name)
7477
{
7578
$name = (string) $name;

0 commit comments

Comments
 (0)