Skip to content

Commit 3b8c6d4

Browse files
author
jacek.foremski
committed
Add return type declarations
1 parent e1cc10a commit 3b8c6d4

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
@@ -87,7 +87,7 @@ public function __toString()
8787
*
8888
* @return bool
8989
*/
90-
final public function equals($variable = null)
90+
final public function equals($variable = null): bool
9191
{
9292
return $variable instanceof self
9393
&& $this->getValue() === $variable->getValue()
@@ -99,7 +99,7 @@ final public function equals($variable = null)
9999
*
100100
* @return array
101101
*/
102-
public static function keys()
102+
public static function keys(): array
103103
{
104104
return \array_keys(static::toArray());
105105
}
@@ -109,7 +109,7 @@ public static function keys()
109109
*
110110
* @return static[] Constant name in key, Enum instance in value
111111
*/
112-
public static function values()
112+
public static function values(): array
113113
{
114114
$values = array();
115115

@@ -125,7 +125,7 @@ public static function values()
125125
*
126126
* @return array Constant name in key, constant value in value
127127
*/
128-
public static function toArray()
128+
public static function toArray(): array
129129
{
130130
$class = \get_called_class();
131131
if (!isset(static::$cache[$class])) {
@@ -143,7 +143,7 @@ public static function toArray()
143143
*
144144
* @return bool
145145
*/
146-
public static function isValid($value)
146+
public static function isValid($value): bool
147147
{
148148
return \in_array($value, static::toArray(), true);
149149
}
@@ -155,7 +155,7 @@ public static function isValid($value)
155155
*
156156
* @return bool
157157
*/
158-
public static function isValidKey($key)
158+
public static function isValidKey($key): bool
159159
{
160160
$array = static::toArray();
161161

0 commit comments

Comments
 (0)