Skip to content

Add return type declaration for "equals()" method #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class Action extends Enum
}
```

Note the `private` keyword requires PHP 7.1 or higher, you can omit it on PHP 7.0.

## Usage

```php
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
},
"require": {
"php": ">=5.4",
"php": ">=7.2",
"ext-json": "*"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function __toString()
*
* @return bool
*/
final public function equals($variable = null)
final public function equals($variable = null): bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding other return types?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read the discussion above (basically it would be a BC break)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. Still working on my first cup of ☕️

{
return $variable instanceof self
&& $this->getValue() === $variable->getValue()
Expand Down