-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enum cases should not be altered #20
Comments
I think these are reserved constants and should not be used as ENUM values: https://www.php.net/manual/en/reserved.constants.php ? |
Partially true: you cannot declare a constant with those names but nothing prevents you from using as an Enum case. |
Probably caused by https://cs.symfony.com/doc/rules/casing/native_function_type_declaration_casing.html (#10) Unfortunately you can't exclude this just for enum cases by default, as this is an enable-or-disable kind of rule. Furthermore, as @driesvints mentioned you probably shouldn't be 'working around' reserved constants anyway. Just because the language doesn't cover it or block you from doing so, doesn't necessarily mean it's a good idea either. In either case, if you're really eager to disable this, you can manually disable the rule in a {
"rules": {
"native_function_type_declaration_casing": false
}
} |
I feel @claudiodekker is right. This is going to be an edge case at best. |
Alternatively, a custom rule could be considered to still allow it just for |
I agree that this could be an edge case but the language does not simply not blocking this case but allowing it. I don't feel comfortable disabling the rule because it's useful for numerous other case but I'll add to pint.json for now. |
Hello. I just ran into this too. I have an application that heavily relies on tables and related logic. My use case is to cast columns into Enums and group column-related helpers there, such as header(), default(), validators(), etc. Solution: I changed case True and case False to case Yes and case No. :) |
Update BusinessDeliveryZonesController.php
Description:
Enum cases should not be reformatted even regardless of keyword name.
Enum class: app/Enum/SegmentCastMissingAs.php
Pint change this style using Laravel preset:
Steps To Reproduce:
app/Enum/SegmentCastMissingAs.php
/vendor/bin/pint --preset laravel app/Enum/SegmentCastMissingAs.php
The text was updated successfully, but these errors were encountered: