-
Notifications
You must be signed in to change notification settings - Fork 160
#49: LocalizedException SHOULD only be thrown in View #53
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
Conversation
@@ -195,6 +195,10 @@ | |||
<severity>7</severity> | |||
<type>warning</type> | |||
</rule> | |||
<rule ref="Magento.Exceptions.LocalizedThrow"> | |||
<severity>7</severity> |
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.
Please change the severity to 8
. This rule looks like:
Magento specific code issue.
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.
Sorry for nit-picking, but could you please add rules in alphabetical order? So they will be ordered by severity then by name.
use PHP_CodeSniffer\Files\File; | ||
|
||
/** | ||
* Detects possible direct throws of Exceptions. |
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.
Please update docs
/** | ||
* String representation of warning. | ||
*/ | ||
protected $warningMessage = 'LocalizedException SHOULD only be thrown in the Presentation layer.'; |
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.
It looks like tech guidelines must be updated to allow LocalizedException in Service Layer as well. See #5.17 in https://devdocs.magento.com/guides/v2.3/coding-standards/technical-guidelines.html
Please do not merge this PR until tech guidelines are updated.
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.
Blocked by changes required in tech guidelines. The implementation of the sniff will have to be adjusted accordingly.
@paliarush can you give me feedback than i change the implementation |
Close because of Impelementation does not solve it able with the new requirements with tokens See: |
…-coding-standard-254 [Imported] Ignore PHPUnit results cache file
see: #49