-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[12.x] Const to enum #53961
Closed
+105
−60
Closed
[12.x] Const to enum #53961
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
3a251cf
const to enum
shaedrich 5bf6f69
Fix syntax error
shaedrich dbf5145
Fix StyleCI
shaedrich 86733fd
More linting fixes
shaedrich 7ccc387
Fix Typo
shaedrich 2ebb039
Fix typo
shaedrich af63fdd
Add missing input
shaedrich 053c72a
stringify enums
shaedrich 7d04309
Fix typo
shaedrich eaa84c0
enum_value
shaedrich 8712ba9
Fix test
shaedrich 01468a4
Another enum_value
shaedrich a7fd3e9
FIx StyleCI
shaedrich 52ed299
Fix syntax error
shaedrich a248b4e
Add missing import
shaedrich 27da74a
Fix StyleCI
shaedrich 201a5e2
Only wrap in enum if it is none
shaedrich a8eca1b
Remove worker-related enum
shaedrich 935efcc
Change casing for enum cases
shaedrich 31cc1b3
Remove unused function
shaedrich 7f0bda7
Revert to promoted property
shaedrich f49854a
Remove enum_value to the proper location
shaedrich 4c17dcd
Cron expression is not an enum
shaedrich f44b034
Also make ScheduleOn cases PascalCase
shaedrich e065656
More casing
shaedrich a0a2ee9
Remove manually setting argument that has been reverted to a promited…
shaedrich 41a889a
Deprecation messages and correct PHPDoc types
shaedrich 1b19e79
Improve type-hint for days
shaedrich 8ce6e6c
More PHPDocs
shaedrich f384afd
Fix StyleCI
shaedrich c66a581
More StyleCI
shaedrich 0e26932
Remove accidentally added spacing
shaedrich 76cc1d6
StyleCI leftovers
shaedrich ddfacc2
Months are 1-indexed
shaedrich 2ddbab1
Add type-hints to respective facade
shaedrich 1df5098
Add range type-hint for seconds
shaedrich 4418d4f
Add array type-hint
shaedrich f08f992
Fix typo
shaedrich d4f76ad
formatting
taylorotwell eed57b8
Update PasswordResetResult.php
taylorotwell d86d3ad
still use strings for passwords
taylorotwell 3c1ba5f
cant depend on auth component
taylorotwell 680036d
dont use enums
taylorotwell 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 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 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,31 @@ | ||
<?php | ||
|
||
namespace Illuminate\Auth\Passwords; | ||
|
||
class PasswordResetResult | ||
{ | ||
/** | ||
* Result indicating a successfully sent password reset email. | ||
*/ | ||
const ResetLinkSent = 'passwords.sent'; | ||
|
||
/** | ||
* Result representing a successfully reset password. | ||
*/ | ||
const PasswordReset = 'passwords.reset'; | ||
|
||
/** | ||
* Result indicating the user is invalid. | ||
*/ | ||
const InvalidUser = 'passwords.user'; | ||
|
||
/** | ||
* Result indicating the token is invalid. | ||
*/ | ||
const InvalidToken = 'passwords.token'; | ||
|
||
/** | ||
* Result indicating the password reset attempt has been throttled. | ||
*/ | ||
const Throttled = 'passwords.throttled'; | ||
} |
This file contains 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,14 @@ | ||
<?php | ||
|
||
namespace Illuminate\Console\Scheduling\Enums; | ||
|
||
enum Day: int | ||
{ | ||
case Sunday = 0; | ||
case Monday = 1; | ||
case Tuesday = 2; | ||
case Wednesday = 3; | ||
case Thursday = 4; | ||
case Friday = 5; | ||
case Saturday = 6; | ||
} |
This file contains 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 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 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
Oops, something went wrong.
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.
Could this also be a leftover? Or is the change from
static
toself
intentionally left as a part of this PR?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.
While reviewing this file, I also felt compelled to say this change was unnecessary.
But after some thinking, and considering your previous remark regarding when enums should be used versus when constants should be used, I thought that, even if the class isn't final, there is no point on reading these constants from subclasses, as they are basically hard-coded exit values from processes, and should not change.
Using
self::
instead ofstatic::
, improves -- IMO -- intention declaration and correctness in this case.