Skip to content

Commit 26195bb

Browse files
author
jacek.foremski
committed
Add return type declarations
1 parent 6b7d5ee commit 26195bb

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

.travis.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
language: php
22

33
php:
4-
- 5.4
5-
- 5.5
6-
- 5.6
7-
- 7.0
8-
- 7.1
94
- 7.2
105
- 7.3
116

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class Action extends Enum
3838
}
3939
```
4040

41-
Note the `private` keyword requires PHP 7.1 or higher, you can omit it on PHP 7.0.
42-
4341
## Usage
4442

4543
```php

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
},
2424
"require": {
25-
"php": ">=5.4",
25+
"php": ">=7.2",
2626
"ext-json": "*"
2727
},
2828
"require-dev": {

src/Enum.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function __toString()
8686
*
8787
* @return bool True if Enums are equal, false if not equal
8888
*/
89-
final public function equals(Enum $enum = null)
89+
final public function equals(Enum $enum = null): bool
9090
{
9191
return $enum !== null && $this->getValue() === $enum->getValue() && \get_called_class() === \get_class($enum);
9292
}
@@ -96,7 +96,7 @@ final public function equals(Enum $enum = null)
9696
*
9797
* @return array
9898
*/
99-
public static function keys()
99+
public static function keys(): array
100100
{
101101
return \array_keys(static::toArray());
102102
}
@@ -106,7 +106,7 @@ public static function keys()
106106
*
107107
* @return static[] Constant name in key, Enum instance in value
108108
*/
109-
public static function values()
109+
public static function values(): array
110110
{
111111
$values = array();
112112

@@ -122,7 +122,7 @@ public static function values()
122122
*
123123
* @return array Constant name in key, constant value in value
124124
*/
125-
public static function toArray()
125+
public static function toArray(): array
126126
{
127127
$class = \get_called_class();
128128
if (!isset(static::$cache[$class])) {
@@ -140,7 +140,7 @@ public static function toArray()
140140
*
141141
* @return bool
142142
*/
143-
public static function isValid($value)
143+
public static function isValid($value): bool
144144
{
145145
return \in_array($value, static::toArray(), true);
146146
}
@@ -152,7 +152,7 @@ public static function isValid($value)
152152
*
153153
* @return bool
154154
*/
155-
public static function isValidKey($key)
155+
public static function isValidKey($key): bool
156156
{
157157
$array = static::toArray();
158158

0 commit comments

Comments
 (0)