Cyber Monday 2024! 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 4 Question 20 Discussion

Actual exam question for Adobe's AD0-E722 exam
Question #: 20
Topic #: 4
[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 AwesomeAgencyCodingStandard 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 AwesomeAgencyCodingStandardRulesetForbiddenNamespaces 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:

Walton
5 months ago
Option B is the way to go, easy peasy. Though I have to say, this whole 'no Helper classes' thing sounds like a recipe for disaster. Godspeed, Architect!
upvoted 0 times
Denae
3 months ago
Pa: Yeah, it might make things more challenging in the long run.
upvoted 0 times
...
Juliann
3 months ago
I'm a bit worried about the 'no Helper classes' rule though.
upvoted 0 times
...
Pa
4 months ago
I agree, it seems like the most straightforward option.
upvoted 0 times
...
Pete
4 months ago
Option B is definitely the best choice.
upvoted 0 times
...
...
Cheryl
5 months ago
Ha! Discouraging Helper classes? That's like trying to stop a toddler from eating candy. Good luck, Architect!
upvoted 0 times
...
Charlene
5 months ago
You know, I'm actually leaning towards Option A. It seems like the most efficient approach to me.
upvoted 0 times
Tresa
3 months ago
Option A does look like the best option for implementing the new code rule.
upvoted 0 times
...
Makeda
3 months ago
I think Option A is the way to go as well.
upvoted 0 times
...
Gennie
3 months ago
I agree, Option A does seem like the most efficient choice.
upvoted 0 times
...
Celia
3 months ago
I see your point, but I still think Option A is the way to go.
upvoted 0 times
...
Paris
4 months ago
I think Option B might also be worth considering, though.
upvoted 0 times
...
Oren
4 months ago
I agree, Option A does seem like the most efficient choice.
upvoted 0 times
...
...
Ernie
5 months ago
Hmm, I think Option C might be the way to go. Looks like it provides a more comprehensive solution.
upvoted 0 times
Brice
4 months ago
Yeah, Option C looks like it covers all the necessary aspects.
upvoted 0 times
...
Howard
4 months ago
I agree, Option C seems like the best choice.
upvoted 0 times
...
...
Merlyn
5 months ago
Option B provides a more comprehensive approach to implementing the new code rule.
upvoted 0 times
...
Allene
5 months ago
Option B looks the most straightforward to implement the new code rule. I'd go with that one.
upvoted 0 times
Virgilio
4 months ago
Yeah, Option B looks like it would be the most efficient way to enforce the coding standards.
upvoted 0 times
...
Emile
5 months ago
I agree, Option B seems like the best choice for implementing the new code rule.
upvoted 0 times
...
...
Jacob
5 months ago
Why do you think Option B is better?
upvoted 0 times
...
Merlyn
6 months ago
I disagree, I believe Option B is the best choice.
upvoted 0 times
...
Jacob
6 months ago
I think the Architect should choose Option A.
upvoted 0 times
...

Save Cancel