8000 minor #33267 Add parameter type declarations to magic methods (derrabus) · symfony/symfony@b273561 · GitHub
[go: up one dir, main page]

Skip to content

Commit b273561

Browse files
committed
minor #33267 Add parameter type declarations to magic methods (derrabus)
This PR was merged into the 5.0-dev branch. Discussion ---------- Add parameter type declarations to magic methods | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32179 | License | MIT | Doc PR | N/A Commits ------- ec8215c Add parameter type declarations to magic methods.
2 parents 77dd116 + ec8215c commit b273561

File tree

12 files changed

+21
-22
lines changed

12 files changed

+21
-22
lines changed

src/Symfony/Component/Cache/Traits/RedisClusterProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(\Closure $initializer)
2626
$this->initializer = $initializer;
2727
}
2828

29-
public function __call($method, array $args)
29+
public function __call(string $method, array $args)
3030
{
3131
$this->redis ?: $this->redis = $this->initializer->__invoke();
3232

src/Symfony/Component/Cache/Traits/RedisProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(\Redis $redis, \Closure $initializer)
2828
$this->initializer = $initializer;
2929
}
3030

31-
public function __call($method, array $args)
31+
public function __call(string $method, array $args)
3232
{
3333
$this->ready ?: $this->ready = $this->initializer->__invoke($this->redis);
3434

src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ abstract class AbstractConfigurator
2525
/** @internal */
2626
protected $definition;
2727

28-
public function __call($method, $args)
28+
public function __call(string $method, array $args)
2929
{
3030
if (method_exists($this, 'set'.$method)) {
3131
return $this->{'set'.$method}(...$args);

src/Symfony/Component/ErrorHandler/Tests/Fixtures/VirtualClassMagicCall.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
*/
99
class VirtualClassMagicCall
1010
{
11-
public static function __callStatic($name, $arguments)
11+
public static function __callStatic(string $name, array $arguments)
1212
{
1313
}
1414

15-
public function __call($name, $arguments)
15+
public function __call(string $name, array $arguments)
1616
{
1717
}
1818
}

src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,15 @@ public static function staticControllerMethod()
305305
/**
306306
* Magic method to allow non existing methods to be called and delegated.
307307
*/
308-
public function __call($method, $args)
308+
public function __call(string $method, array $args)
309309
{
310310
throw new \LogicException('Unexpected method call');
311311
}
312312

313313
/**
314314
* Magic method to allow non existing methods to be called and delegated.
315315
*/
316-
public static function __callStatic($method, $args)
316+
public static function __callStatic(string $method, array $args)
317317
{
318318
throw new \LogicException('Unexpected method call');
319319
}

src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicCall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct($value)
2020
$this->magicCallProperty = $value;
2121
}
2222

23-
public function __call($method, array $args)
23+
public function __call(string $method, array $args)
2424
{
2525
if ('getMagicCallProperty' === $method) {
2626
return $this->magicCallProperty;

src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicGet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ public function __construct($value)
2222
$this->magicProperty = $value;
2323
}
2424

25-
public function __set($property, $value)
25+
public function __set(string $property, $value)
2626
{
2727
if ('magicProperty' === $property) {
2828
$this->magicProperty = $value;
2929
}
3030
}
3131

32-
public function __get($property)
32+
public function __get(string $property)
3333
{
3434
if ('magicProperty' === $property) {
3535
return $this->magicProperty;

src/Symfony/Component/PropertyAccess/Tests/Fixtures/Ticket5775Object.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private function setProperty()
2424
{
2525
}
2626

27-
public function __set($property, $value)
27+
public function __set(string $property, $value)
2828
{
2929
$this->$property = $value;
3030
}

src/Symfony/Component/Validator/Constraint.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,11 @@ public function __construct($options = null)
163163
* this method will be called at most once per constraint instance and
164164
* option name.
165165
*
166-
* @param string $option The option name
167-
* @param mixed $value The value to set
166+
* @param mixed $value The value to set
168167
*
169168
* @throws InvalidOptionsException If an invalid option name is given
170169
*/
171-
public function __set($option, $value)
170+
public function __set(string $option, $value)
172171
{
173172
if ('groups' === $option) {
174173
$this->groups = (array) $value;
@@ -194,7 +193,7 @@ public function __set($option, $value)
194193
*
195194
* @internal this method should not be used or overwritten in userland code
196195
*/
197-
public function __get($option)
196+
public function __get(string $option)
198197
{
199198
if ('groups' === $option) {
200199
$this->groups = [self::DEFAULT_GROUP];
@@ -210,7 +209,7 @@ public function __get($option)
210209
*
211210
* @return bool
212211
*/
213-
public function __isset($option)
212+
public function __isset(string $option)
214213
{
215214
return 'groups' === $option;
216215
}

src/Symfony/Component/Validator/Constraints/File.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct($options = null)
7171
}
7272
}
7373

74-
public function __set($option, $value)
74+
public function __set(string $option, $value)
7575
{
7676
if ('maxSize' === $option) {
7777
$this->normalizeBinaryFormat($value);
@@ -82,7 +82,7 @@ public function __set($option, $value)
8282
parent::__set($option, $value);
8383
}
8484

85-
public function __get($option)
85+
public function __get(string $option)
8686
{
8787
if ('maxSize' === $option) {
8888
return $this->maxSize;
@@ -91,7 +91,7 @@ public function __get($option)
9191
return parent::__get($option);
9292
}
9393

94-
public function __isset($option)
94+
public function __isset(string $option)
9595
{
9696
if ('maxSize' === $option) {
9797
return true;

src/Symfony/Component/Validator/Constraints/Valid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Valid extends Constraint
2323
{
2424
public $traverse = true;
2525

26-
public function __get($option)
26+
public function __get(string $option)
2727
{
2828
if ('groups' === $option) {
2929
// when this is reached, no groups have been configured

src/Symfony/Component/VarDumper/Cloner/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function getIterator()
126126
yield from $value;
127127
}
128128

129-
public function __get($key)
129+
public function __get(string $key)
130130
{
131131
if (null !== $data = $this->seek($key)) {
132132
$item = $this->getStub($data->data[$data->position][$data->key]);
@@ -140,7 +140,7 @@ public function __get($key)
140140
/**
141141
* @return bool
142142
*/
143-
public function __isset($key)
143+
public function __isset(string $key)
144144
{
145145
return null !== $this->seek($key);
146146
}

0 commit comments

Comments
 (0)
0