Skip to content

Commit daa3604

Browse files
Backport type fixes
1 parent 39c1a84 commit daa3604

File tree

7 files changed

+14
-56
lines changed

7 files changed

+14
-56
lines changed

ChildDefinition.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ public function getParent()
4444
/**
4545
* Sets the Definition to inherit from.
4646
*
47-
* @param string $parent
48-
*
4947
* @return $this
5048
*/
51-
public function setParent($parent)
49+
public function setParent(string $parent)
5250
{
5351
$this->parent = $parent;
5452

Compiler/ServiceReferenceGraph.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Compiler;
1313

1414
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
15+
use Symfony\Component\DependencyInjection\Reference;
1516

1617
/**
1718
* This is a directed graph of your services.
@@ -73,7 +74,7 @@ public function clear()
7374
/**
7475
* Connects 2 nodes together in the Graph.
7576
*/
76-
public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false)
77+
public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false)
7778
{
7879
if (null === $sourceId || null === $destId) {
7980
return;

Container.php

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ public function getParameterBag()
107107
/**
108108
* Gets a parameter.
109109
*
110-
* @param string $name The parameter name
111-
*
112110
* @return mixed
113111
*
114112
* @throws InvalidArgumentException if the parameter is not defined
@@ -119,10 +117,6 @@ public function getParameter(string $name)
119117
}
120118

121119
/**
122-
* Checks if a parameter exists.
123-
*
124-
* @param string $name The parameter name
125-
*
126120
* @return bool The presence of parameter in container
127121
*/
128122
public function hasParameter(string $name)
@@ -210,9 +204,6 @@ public function has($id)
210204
/**
211205
* Gets a service.
212206
*
213-
* @param string $id The service identifier
214-
* @param int $invalidBehavior The behavior when the service does not exist
215-
*
216207
* @return object|null The associated service
217208
*
218209
* @throws ServiceCircularReferenceException When a circular reference is detected
@@ -286,8 +277,6 @@ private function make(string $id, int $invalidBehavior)
286277
/**
287278
* Returns true if the given service has actually been initialized.
288279
*
289-
* @param string $id The service identifier
290-
*
291280
* @return bool true if service has already been initialized, false otherwise
292281
*/
293282
public function initialized(string $id)
@@ -345,45 +334,39 @@ public function getRemovedIds()
345334
/**
346335
* Camelizes a string.
347336
*
348-
* @param string $id A string to camelize
349-
*
350337
* @return string The camelized string
351338
*/
352-
public static function camelize($id)
339+
public static function camelize(string $id)
353340
{
354341
return strtr(ucwords(strtr($id, ['_' => ' ', '.' => '_ ', '\\' => '_ '])), [' ' => '']);
355342
}
356343

357344
/**
358345
* A string to underscore.
359346
*
360-
* @param string $id The string to underscore
361-
*
362347
* @return string The underscored string
363348
*/
364-
public static function underscore($id)
349+
public static function underscore(string $id)
365350
{
366351
return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], str_replace('_', '.', $id)));
367352
}
368353

369354
/**
370355
* Creates a service by requiring its factory file.
371356
*/
372-
protected function load($file)
357+
protected function load(string $file)
373358
{
374359
return require $file;
375360
}
376361

377362
/**
378363
* Fetches a variable from the environment.
379364
*
380-
* @param string $name The name of the environment variable
381-
*
382365
* @return mixed The value to use for the provided environment variable name
383366
*
384367
* @throws EnvNotFoundException When the environment variable is not found and has no default value
385368
*/
386-
protected function getEnv($name)
369+
protected function getEnv(string $name)
387370
{
388371
if (isset($this->resolving[$envName = "env($name)"])) {
389372
throw new ParameterCircularReferenceException(array_keys($this->resolving));

ContainerBuilder.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,6 @@ public function has($id)
519519
}
520520

521521
/**
522-
* Gets a service.
523-
*
524-
* @param string $id The service identifier
525-
* @param int $invalidBehavior The behavior when the service does not exist
526-
*
527522
* @return object|null The associated service
528523
*
529524
* @throws InvalidArgumentException when no definitions are available
@@ -829,11 +824,6 @@ public function setAlias(string $alias, $id)
829824
return $this->aliasDefinitions[$alias] = $id;
830825
}
831826

832-
/**
833-
* Removes an alias.
834-
*
835-
* @param string $alias The alias to remove
836-
*/
837827
public function removeAlias(string $alias)
838828
{
839829
if (isset($this->aliasDefinitions[$alias])) {
@@ -843,8 +833,6 @@ public function removeAlias(string $alias)
843833
}
844834

845835
/**
846-
* Returns true if an alias exists under the given identifier.
847-
*
848836
* @return bool true if the alias exists, false otherwise
849837
*/
850838
public function hasAlias(string $id)
@@ -861,8 +849,6 @@ public function getAliases()
861849
}
862850

863851
/**
864-
* Gets an alias.
865-
*
866852
* @return Alias An Alias instance
867853
*
868854
* @throws InvalidArgumentException if the alias does not exist
@@ -1520,7 +1506,7 @@ public static function hash($value)
15201506
/**
15211507
* {@inheritdoc}
15221508
*/
1523-
protected function getEnv($name)
1509+
protected function getEnv(string $name)
15241510
{
15251511
$value = parent::getEnv($name);
15261512
$bag = $this->getParameterBag();
@@ -1549,7 +1535,7 @@ protected function getEnv($name)
15491535
}
15501536
}
15511537

1552-
private function callMethod($service, array $call, array &$inlineServices)
1538+
private function callMethod(object $service, array $call, array &$inlineServices)
15531539
{
15541540
foreach (self::getServiceConditionals($call[1]) as $s) {
15551541
if (!$this->has($s)) {

ContainerInterface.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,14 @@ public function has($id);
6565
public function initialized(string $id);
6666

6767
/**
68-
* Gets a parameter.
69-
*
70-
* @param string $name The parameter name
71-
*
72-
* @return mixed The parameter value
68+
* @return mixed
7369
*
7470
* @throws InvalidArgumentException if the parameter is not defined
7571
*/
7672
public function getParameter(string $name);
7773

7874
/**
79-
* Checks if a parameter exists.
80-
*
81-
* @param string $name The parameter name
82-
*
83-
* @return bool The presence of parameter in container
75+
* @return bool
8476
*/
8577
public function hasParameter(string $name);
8678

Exception/ParameterNotFoundException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ public function getSourceKey()
8484
return $this->sourceKey;
8585
}
8686

87-
public function setSourceId($sourceId)
87+
public function setSourceId(?string $sourceId)
8888
{
8989
$this->sourceId = $sourceId;
9090

9191
$this->updateRepr();
9292
}
9393

94-
public function setSourceKey($sourceKey)
94+
public function setSourceKey(?string $sourceKey)
9595
{
9696
$this->sourceKey = $sourceKey;
9797

Loader/YamlFileLoader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -716,13 +716,11 @@ private function parseCallable($callable, string $parameter, string $id, string
716716
/**
717717
* Loads a YAML file.
718718
*
719-
* @param string $file
720-
*
721719
* @return array The file content
722720
*
723721
* @throws InvalidArgumentException when the given file is not a local file or when it does not exist
724722
*/
725-
protected function loadFile($file)
723+
protected function loadFile(string $file)
726724
{
727725
if (!class_exists(\Symfony\Component\Yaml\Parser::class)) {
728726
throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.');

0 commit comments

Comments
 (0)