Skip to content

Commit 4af2e56

Browse files
authored
Merge pull request #2 from fredden/youwe-magento2
Use official Magento2 coding standard as base for YouweMagento2
2 parents 2913e79 + f243571 commit 4af2e56

File tree

6 files changed

+37
-47
lines changed

6 files changed

+37
-47
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Introduction
22

3-
This is the MediaCT coding standard for Magento 2 projects. It is based on
4-
the default MediaCT coding standard but some tests have been removed to create
3+
This is the Youwe coding standard for Magento 2 projects. It is based on
4+
the default Magento2 coding standard but some tests have been removed to create
55
a workable and fast standard.
66

77
# Installation
88

99
Use composer to require the standard in a project.
1010

1111
```shell
12-
composer require --dev mediact/coding-standard-magento2
12+
composer require --dev youwe/coding-standard-magento2
1313
```
1414

1515
To let PHPCS know that this standard should be used add a phpcs.xml file in the
@@ -18,20 +18,20 @@ root of the project.
1818
```xml
1919
<?xml version="1.0"?>
2020
<ruleset>
21-
<rule ref="./vendor/mediact/coding-standard-magento2/src/MediactMagento2"/>
21+
<rule ref="./vendor/youwe/coding-standard-magento2/src/YouweMagento2"/>
2222
</ruleset>
2323
```
2424

2525
# Integration with PHPStorm and automatic testing
2626

2727
The recommended way to enable the coding standard in PHPStorm and automatic
28-
testing is by requiring the MediaCT testing suite in a project.
28+
testing is by requiring the Youwe testing suite in a project.
2929

3030
```shell
31-
composer require --dev mediact/testing-suite
31+
composer require --dev youwe/testing-suite
3232
```
3333

34-
For more information go to [MediaCT Testing Suite](https://github.com/mediact/testing-suite).
34+
For more information go to [Youwe Testing Suite](https://github.com/YouweGit/testing-suite).
3535

3636
# Contribution guidelines
3737

composer.json

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
{
22
"name": "youwe/coding-standard-magento2",
33
"description": "Youwe PHP Coding Standard for Magento2",
4-
"type": "phpcs-sniffs",
5-
"homepage": "https://github.com/YouweGit/coding-standard-magento2",
64
"license": "proprietary",
5+
"type": "phpcs-sniffs",
76
"authors": [
87
{
98
"name": "Youwe B.V.",
109
"email": "[email protected]"
1110
}
1211
],
12+
"homepage": "https://github.com/YouweGit/coding-standard-magento2",
1313
"require": {
14-
"youwe/coding-standard": ">=3.3.0"
14+
"magento/magento-coding-standard": "*",
15+
"youwe/coding-standard": "^3.5.0"
1516
},
1617
"autoload": {
1718
"psr-0": {
18-
"MediactMagento2": "src/MediactMagento2",
19-
"Magento2": "src/Magento2"
19+
"YouweMagento2": "src/YouweMagento2"
2020
}
21+
},
22+
"scripts": {
23+
"post-install-cmd": [
24+
"@phpcs-set-paths"
25+
],
26+
"post-update-cmd": [
27+
"@phpcs-set-paths"
28+
],
29+
"phpcs-set-paths": [
30+
"vendor/bin/phpcs --config-set installed_paths src/,../../magento/magento-coding-standard/,../../phpcompatibility/php-compatibility/"
31+
]
2132
}
2233
}

src/MediactMagento2/phpmd.xml

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

src/MediactMagento2/ruleset.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.
File renamed without changes.

src/Magento2/ruleset.xml renamed to src/YouweMagento2/ruleset.xml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,30 @@
55
* https://www.youweagency.com
66
*/
77
-->
8-
<ruleset name="Magento2">
9-
<description>Youwe coding standards for Magento2.</description>
8+
<ruleset name="YouweMagento2">
9+
<description>Youwe coding standards for Magento2 websites and modules</description>
10+
1011
<arg name="colors" />
1112
<arg name="extensions" value="php/PHP,phtml/PHP,js/JS,css/CSS" />
1213

1314
<!-- Base rules on Youwe -->
14-
<rule ref="../../../coding-standard/src/GlobalCommon">
15-
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
16-
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" />
15+
<rule ref="Youwe">
1716
<exclude name="GlobalCommon.Php7.ReturnType" />
18-
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing" />
1917
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
18+
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
2019
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" />
20+
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" />
21+
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing" />
22+
</rule>
23+
24+
<!-- Import most rules from official Magento2 coding standard -->
25+
<rule ref="Magento2">
26+
<exclude name="Magento2.Annotation" />
27+
<exclude name="Magento2.Commenting.ClassPropertyPHPDocFormatting" />
2128
</rule>
2229

2330
<rule ref="Generic.Files.LineLength.TooLong">
24-
<exclude-pattern>*.phtml</exclude-pattern>
31+
<exclude-pattern>*.phtml,*.xml</exclude-pattern>
2532
</rule>
2633

2734
<rule ref="Squiz.ControlStructures.ControlSignature">

0 commit comments

Comments
 (0)