-
Notifications
You must be signed in to change notification settings - Fork 554
Add non regression tests #5110
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
Add non regression tests #5110
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?php // lint >= 8.3 | ||
|
|
||
| declare(strict_types = 1); | ||
|
|
||
| namespace Pr5105; | ||
|
|
||
| enum ReactionType: string | ||
| { | ||
| case EMOJI_HEART = '❤️'; | ||
|
|
||
| public static function tryFromName1(string $name): ?self | ||
| { | ||
| try { | ||
| return ReactionType::{$name}; | ||
| } catch (\RuntimeException) { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| public static function tryFromName2(string $name): ?self | ||
| { | ||
| if ($name !== 'EMOJI_HEART') { | ||
| return null; | ||
| } | ||
|
|
||
| try { | ||
| return ReactionType::{$name}; | ||
| } catch (\Error) { | ||
| return null; | ||
| } | ||
|
Comment on lines
+26
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not after the condition line 22 ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are right. maybe we should add a test for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently it's not supported And it's like any method call we're currently reporting the method call as an error but also reporting the dead catch (if implictThrow = false) |
||
| } | ||
| } | ||
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.