File tree Expand file tree Collapse file tree 3 files changed +27
-60
lines changed
framework/Magento/CodeMessDetector
testsuite/Magento/Test/Php/_files/phpmd Expand file tree Collapse file tree 3 files changed +27
-60
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 10
10
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
11
11
xsi : schemaLocation =" http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
12
12
xsi : noNamespaceSchemaLocation =" http://pmd.sf.net/ruleset_xml_schema.xsd" >
13
+ <rule name =" FinalImplementation"
14
+ class =" Magento\CodeMessDetector\Rule\Design\FinalImplementation"
15
+ message = " The {0} {1} declared as final." >
16
+ <description >
17
+ <![CDATA[
18
+ Final keyword is prohibited in Magento as this decreases extensibility and customizability.
19
+ Final classes and method are not compatible with plugins and proxies.
20
+ ]]>
21
+ </description >
22
+ <priority >1</priority >
23
+ <properties />
24
+ <example >
25
+ <![CDATA[
26
+ final class Foo
27
+ {
28
+ public function bar() {}
29
+ }
30
+ class Baz {
31
+ final public function bad() {}
32
+ }
33
+ ]]>
34
+ </example >
35
+ </rule >
13
36
<rule name =" AllPurposeAction"
14
37
class =" Magento\CodeMessDetector\Rule\Design\AllPurposeAction"
15
38
message = " The class {0} does not restrict processed HTTP methods by implementing a Http*Method name*ActionInterface" >
@@ -60,31 +83,6 @@ class OrderProcessor
60
83
$currentOrder = $this->session->get('current_order');
61
84
...
62
85
}
63
- }
64
- ]]>
65
- </example >
66
- </rule >
67
- <rule name =" SerializationAware"
68
- class =" Magento\CodeMessDetector\Rule\Design\SerializationAware"
69
- message =" {1} has {0} method and is PHP serialization aware - PHP serialization must be avoided." >
70
- <description >
71
- <![CDATA[
72
- Using PHP serialization must be avoided in Magento for security reasons and for prevention of unexpected behaviour.
73
- ]]>
74
- </description >
75
- <priority >2</priority >
76
- <properties />
77
- <example >
78
- <![CDATA[
79
- class MyModel extends AbstractModel
80
- {
81
-
82
- .......
83
-
84
- public function __sleep()
85
- {
86
- .....
87
- }
88
86
}
89
87
]]>
90
88
</example >
Original file line number Diff line number Diff line change 29
29
<rule ref =" rulesets/unusedcode.xml" />
30
30
31
31
<!-- Code design rules -->
32
+ <rule ref =" rulesets/design.xml/ExitExpression" />
33
+ <rule ref =" rulesets/design.xml/EvalExpression" />
34
+ <rule ref =" rulesets/design.xml/GotoStatement" />
32
35
<rule ref =" rulesets/design.xml/NumberOfChildren" />
33
36
<rule ref =" rulesets/design.xml/DepthOfInheritance" >
34
37
<properties >
43
46
<rule ref =" rulesets/naming.xml/BooleanGetMethodName" />
44
47
45
48
<!-- Magento Specific Rules -->
49
+ <rule ref =" Magento/CodeMessDetector/resources/rulesets/design.xml/FinalImplementation" />
46
50
<rule ref =" Magento/CodeMessDetector/resources/rulesets/design.xml/AllPurposeAction" />
47
51
<rule ref =" Magento/CodeMessDetector/resources/rulesets/design.xml/CookieAndSessionMisuse" />
48
- <rule ref =" Magento/CodeMessDetector/resources/rulesets/design.xml/SerializationAware" />
49
52
50
53
</ruleset >
You can’t perform that action at this time.
0 commit comments