Skip to content

Commit 36e9935

Browse files
committed
Add parameter type declarations to magic methods.
1 parent 3cd5f40 commit 36e9935

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

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
}

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;

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

0 commit comments

Comments
 (0)