-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Labels
Progress: good first issueIssues is easy to get started withIssues is easy to get started withacceptedNew rule is acceptedNew rule is acceptedevent: MageTestFest2019MageTestFest contributionsMageTestFest contributionsnew ruleNew feature implementationNew feature implementationtechnical guidelinesThe rule is based on Magento Technical GuidelinesThe rule is based on Magento Technical Guidelines
Description
Rule
Proxies and interceptors MUST never be explicitly requested in constructors.
Source - Magento Technical Guidelines
Description
Proxies are used for lazy-loading. Details on DevDocs.
Proxies should be configured via di.xml
file.
<type name="FastLoading">
<arguments>
<argument name="slowLoading" xsi:type="object">SlowLoading\Proxy</argument>
</arguments>
</type>
Plugins (interceptors) modify the behavior of public class functions by intercepting a function call and running code before, after, or around that function call. Details on DevDocs.
Plugins should be declared via di.xml
file.
<config>
<type name="{ObservedType}">
<plugin name="{pluginName}" type="{PluginClassName}" sortOrder="1" disabled="false" />
</type>
</config>
Implementation
Subscribe to the T_CLASS
token and analyse __constructor
arguments.
<severity>8</severity>
<type>warning</type>
Metadata
Metadata
Assignees
Labels
Progress: good first issueIssues is easy to get started withIssues is easy to get started withacceptedNew rule is acceptedNew rule is acceptedevent: MageTestFest2019MageTestFest contributionsMageTestFest contributionsnew ruleNew feature implementationNew feature implementationtechnical guidelinesThe rule is based on Magento Technical GuidelinesThe rule is based on Magento Technical Guidelines