-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Enum error message consistency #9350
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
kocsismate
merged 18 commits into
php:master
from
ollieread:enum-stringable-and-magic-methods
Aug 23, 2022
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
14b5d8c
Updated magic method error message, updated existing tests, and added…
ollieread d0b5dea
Updated __isset enum tests
ollieread fa3244b
Remove __construct and __destruct tests in favour of existing ones
ollieread c90fa62
Fix existing enum tests to include new magic method error message
ollieread 0f0f39d
Updated enum exception messages to be consistent, and not wrap enum n…
ollieread 7f0b4dc
Merge branch 'master' into enum-stringable-and-magic-methods
ollieread bee3186
Normalise enum property error message to not quote enum name
ollieread 533f0f8
Fixed internal enums test
ollieread 2d07685
Unquote the integer value for invalid enum backing value error message
ollieread fd3dbad
Fixed expected error message for invalid int on enum backing test
ollieread 4054284
Fix internal enum tests with correct error message
ollieread 320344b
Change "may not" to "cannot" within the enum error messages
ollieread 1b2a8cb
Added the enum class name to the enum error messages
ollieread 0e3c8a3
Updated enum error messages in enum tests
ollieread 3a90c2b
Remove return statement for enum __set test
ollieread 44d0066
Correct plurality of "enum" in enum error messages
ollieread a985251
Update enum static property error messages to include enum class anme
ollieread 688084d
Change enum error message when an enum has properties
ollieread File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--TEST-- | ||
Enum __clone | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __clone() { | ||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __clone in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __debugInfo | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __debugInfo(): array { | ||
return $this->cases(); | ||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __debugInfo in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __serialize | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __serialize(): array { | ||
return $this->cases(); | ||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __serialize in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __set | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __set(string $name, mixed $value) | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __set in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __set_state | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public static function __set_state(array $properties): object { | ||
|
||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __set_state in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __sleep | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __sleep(): array { | ||
|
||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __sleep in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __toString | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __toString(): string { | ||
return $this->name; | ||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __toString in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __unserialize | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __unserialize(array $data) { | ||
|
||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __unserialize in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __unset | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __unset($property) { | ||
return; | ||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __unset in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Enum __wakeup | ||
--FILE-- | ||
<?php | ||
|
||
enum Foo { | ||
case Bar; | ||
|
||
public function __wakeup() { | ||
|
||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Enum Foo cannot include magic method __wakeup in %s on line %d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ try { | |
|
||
?> | ||
--EXPECT-- | ||
2 is not a valid backing value for enum "Foo" | ||
2 is not a valid backing value for enum Foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the tests could profit from this change