Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe Exam AD0-E722 Topic 6 Question 22 Discussion

Actual exam question for Adobe's AD0-E722 exam
Question #: 22
Topic #: 6
[All AD0-E722 Questions]

An Architect agrees to improve company coding standards and discourage using Helper classes in the code by introducing a new check with PHPCS.

The Architect creates the following:

* A new composer package under the AwesomeAgency\CodingStandard\ namespace

* The ruleset. xml file extending the Magento 2 Coding Standard

What should the Architect do to implement the new code rule?

A)

B)

C)

Show Suggested Answer Hide Answer
Suggested Answer: C

Option C is correct because adjusting the ruleset.xml file with the new rule is the simplest and most effective way to implement the new code rule. The ruleset.xml file defines the coding standards that are applied by PHP_CodeSniffer. By extending the Magento 2 Coding Standard and adding a new rule, the Architect can customize the code analysis and enforce the company coding standards.The new rule can use the Magento2.Namespaces.ForbiddenNamespaces sniff to check for any usage of Helper classes in the code and report them as errors or warnings1.

Option A is incorrect because creating a new composer package under the AwesomeAgency\CodingStandard\ namespace is not enough to implement the new code rule. The composer package is just a way to distribute and install the coding standard, but it does not define the rules themselves.The Architect still needs to create a ruleset.xml file and register it with PHP_CodeSniffer2.

Option B is incorrect because creating a new class \AwesomeAgency\CodingStandard\Ruleset\ForbiddenNamespaces and specifying the rule inside the process method is unnecessary and complicated. The Architect does not need to create a new class or a new sniff for this rule, as there is already an existing sniff in the Magento 2 Coding Standard that can be used for this purpose.The Magento2.Namespaces.ForbiddenNamespaces sniff can be configured with an include-pattern element to specify which namespaces are forbidden1.


1: Magento 2 Coding Standards | Adobe Commerce Developer Guide

2: How to create a custom coding standard | PHP_CodeSniffer Documentation

Contribute your Thoughts:

Ricki
26 days ago
I'm surprised the Architect didn't just include a 'No Helpers Allowed' sign in the office. Might as well make it official with Option C!
upvoted 0 times
Elza
4 days ago
User 3: The Architect is really serious about improving coding standards.
upvoted 0 times
...
Dorothea
7 days ago
User 2: Yeah, it's a clear message to discourage using Helper classes.
upvoted 0 times
...
Refugia
17 days ago
User 1: I think Option C is the way to go.
upvoted 0 times
...
...
Ellsworth
1 months ago
That makes sense, thanks for sharing your opinion.
upvoted 0 times
...
Kirk
1 months ago
Option B provides a more comprehensive solution to implement the new code rule.
upvoted 0 times
...
Ellsworth
1 months ago
Why do you think Option B is better?
upvoted 0 times
...
Fernanda
1 months ago
I agree, Option C is the way to go. Extending the Magento 2 Coding Standard is a smart move to ensure consistency and maintainability.
upvoted 0 times
...
Cherri
1 months ago
Option C looks like the most comprehensive approach. Implementing the new coding rule in the ruleset.xml file seems like the best way to enforce it across the codebase.
upvoted 0 times
Stefan
19 days ago
User 2: Yeah, adding the new rule in the ruleset.xml file will ensure consistency in the code.
upvoted 0 times
...
Raul
25 days ago
User 1: I think Option C is the way to go.
upvoted 0 times
...
...
Kirk
1 months ago
I disagree, I believe Option B is the best choice.
upvoted 0 times
...
Ellsworth
2 months ago
I think the Architect should choose Option A.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77