Skip to content

#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

Closed
wants to merge 2 commits into from

Conversation

larsroettig
Copy link
Member

see: #49

@larsroettig larsroettig changed the title #49 Impl. LocalizedException SHOULD only be thrown in View #49: LocalizedException SHOULD only be thrown in View Mar 3, 2019
@@ -195,6 +195,10 @@
<severity>7</severity>
<type>warning</type>
</rule>
<rule ref="Magento.Exceptions.LocalizedThrow">
<severity>7</severity>
Copy link
Contributor

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.

Copy link
Contributor

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.
Copy link
Contributor

@paliarush paliarush Mar 4, 2019

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.';
Copy link
Contributor

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.

Copy link
Contributor

@paliarush paliarush left a 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.

@lenaorobei lenaorobei added the waiting for feedback Additional explanation needed label Mar 5, 2019
@larsroettig
Copy link
Member Author

@paliarush can you give me feedback than i change the implementation

@larsroettig
Copy link
Member Author

Close because of Impelementation does not solve it able with the new requirements with tokens

See:
magento/devdocs#3871

@lenaorobei lenaorobei deleted the 49-LocalizedException branch March 18, 2019 15:25
magento-devops-reposync-svc pushed a commit that referenced this pull request Sep 3, 2021
…-coding-standard-254

[Imported] Ignore PHPUnit results cache file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants