Skip to content

Commit 95b6690

Browse files
Add return types to internal & magic methods when possible
1 parent ec556fd commit 95b6690

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

ConstraintViolationList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ public function getIterator()
116116
}
117117

118118
/**
119-
* {@inheritdoc}
119+
* @return int
120120
*/
121121
public function count()
122122
{
123123
return \count($this->violations);
124124
}
125125

126126
/**
127-
* {@inheritdoc}
127+
* @return bool
128128
*/
129129
public function offsetExists($offset)
130130
{

Tests/Constraints/AbstractComparisonValidatorTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct($value)
2525
$this->value = $value;
2626
}
2727

28-
public function __toString()
28+
public function __toString(): string
2929
{
3030
return (string) $this->value;
3131
}

Tests/Constraints/BicValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function __construct($value)
248248
$this->value = $value;
249249
}
250250

251-
public function __toString()
251+
public function __toString(): string
252252
{
253253
return (string) $this->value;
254254
}

Tests/Constraints/UrlValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ public function testCheckDnsOptionIsDeprecated()
387387

388388
class EmailProvider
389389
{
390-
public function __toString()
390+
public function __toString(): string
391391
{
392392
return '';
393393
}

Tests/Fixtures/Countable.php

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

23-
public function count()
23+
public function count(): int
2424
{
2525
return \count($this->content);
2626
}

Tests/Fixtures/CustomArrayObject.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(array $array = null)
2424
$this->array = $array ?: [];
2525
}
2626

27-
public function offsetExists($offset)
27+
public function offsetExists($offset): bool
2828
{
2929
return \array_key_exists($offset, $this->array);
3030
}
@@ -48,12 +48,12 @@ public function offsetUnset($offset)
4848
unset($this->array[$offset]);
4949
}
5050

51-
public function getIterator()
51+
public function getIterator(): \Traversable
5252
{
5353
return new \ArrayIterator($this->array);
5454
}
5555

56-
public function count()
56+
public function count(): int
5757
{
5858
return \count($this->array);
5959
}
@@ -63,7 +63,7 @@ public function __serialize(): array
6363
return $this->array;
6464
}
6565

66-
public function serialize()
66+
public function serialize(): string
6767
{
6868
return serialize($this->__serialize());
6969
}

Tests/Fixtures/ToString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ToString
1515
{
1616
public $data;
1717

18-
public function __toString()
18+
public function __toString(): string
1919
{
2020
return 'toString';
2121
}

0 commit comments

Comments
 (0)