Skip to content

Commit 6c62e90

Browse files
committed
MC-22829: Revert ticket MAGETWO-96975 which introduce BIC on 2.3.4
1 parent 9a2561e commit 6c62e90

File tree

3 files changed

+27
-60
lines changed

3 files changed

+27
-60
lines changed

dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/SerializationAware.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

dev/tests/static/framework/Magento/CodeMessDetector/resources/rulesets/design.xml

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,29 @@
1010
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1111
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
1212
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>
1336
<rule name="AllPurposeAction"
1437
class="Magento\CodeMessDetector\Rule\Design\AllPurposeAction"
1538
message= "The class {0} does not restrict processed HTTP methods by implementing a Http*Method name*ActionInterface">
@@ -60,31 +83,6 @@ class OrderProcessor
6083
$currentOrder = $this->session->get('current_order');
6184
...
6285
}
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-
}
8886
}
8987
]]>
9088
</example>

dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<rule ref="rulesets/unusedcode.xml" />
3030

3131
<!-- Code design rules -->
32+
<rule ref="rulesets/design.xml/ExitExpression" />
33+
<rule ref="rulesets/design.xml/EvalExpression" />
34+
<rule ref="rulesets/design.xml/GotoStatement" />
3235
<rule ref="rulesets/design.xml/NumberOfChildren" />
3336
<rule ref="rulesets/design.xml/DepthOfInheritance">
3437
<properties>
@@ -43,8 +46,8 @@
4346
<rule ref="rulesets/naming.xml/BooleanGetMethodName" />
4447

4548
<!-- Magento Specific Rules -->
49+
<rule ref="Magento/CodeMessDetector/resources/rulesets/design.xml/FinalImplementation" />
4650
<rule ref="Magento/CodeMessDetector/resources/rulesets/design.xml/AllPurposeAction" />
4751
<rule ref="Magento/CodeMessDetector/resources/rulesets/design.xml/CookieAndSessionMisuse" />
48-
<rule ref="Magento/CodeMessDetector/resources/rulesets/design.xml/SerializationAware" />
4952

5053
</ruleset>

0 commit comments

Comments
 (0)