From d07db2835a0911e5058eaaf9d9bb65349d20e903 Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Sat, 22 Apr 2017 14:30:57 +0200 Subject: [PATCH 1/5] Fixed coding standard violations in the Framework\Code namespace, so that it will be checked bij PHP CS and no longer be ignored while doing CI checks. Made the following changes: - Removed @codingStandardsIgnoreFile from the head of the file. - Changed interfaces in tests to actually end with the name "Interface". --- .../Code/Test/Unit/GeneratorTest.php | 2 - .../_files/ClassesForArgumentsReader.php | 2 - .../ConstructorArgumentTypesTest.php | 2 - .../_files/ClassesForArgumentSequence.php | 2 - .../_files/ClassesForConstructorIntegrity.php | 18 ++++----- .../_files/ClassesForContextAggregation.php | 40 +++++++++---------- .../_files/ClassesForTypeDuplication.php | 2 - .../SomeModule/Model/SevenInterface.php | 2 - 8 files changed, 27 insertions(+), 43 deletions(-) diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php index ea54cde9c8648..b17db6ecb9459 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Code\Test\Unit; use Magento\Framework\Code\Generator; diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php index 0955161cafabc..0fe2654175e8a 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php @@ -5,8 +5,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - class ClassWithAllArgumentTypes { const DEFAULT_VALUE = 'Const Value'; diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorArgumentTypesTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorArgumentTypesTest.php index ca1b856c7f6ab..4e5c8a0e04a17 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorArgumentTypesTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorArgumentTypesTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Code\Test\Unit\Validator; class ConstructorArgumentTypesTest extends \PHPUnit_Framework_TestCase diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForArgumentSequence.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForArgumentSequence.php index e46f03c3de970..3f5f8bc161890 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForArgumentSequence.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForArgumentSequence.php @@ -5,8 +5,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace ArgumentSequence; class ContextObject implements \Magento\Framework\ObjectManager\ContextInterface diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForConstructorIntegrity.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForConstructorIntegrity.php index 7d472e56ea297..da736769155b7 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForConstructorIntegrity.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForConstructorIntegrity.php @@ -5,8 +5,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - class ClassA { } @@ -16,16 +14,16 @@ class ClassB class ClassC { } -interface InterfaceA +interface FirstInterface { } -class ImplementationOfInterfaceA implements InterfaceA +class ImplementationOfFirstInterface implements FirstInterface { } -interface InterfaceB +interface SecondInterface { } -class ImplementationOfInterfaceB implements InterfaceB +class ImplementationOfSecondInterface implements SecondInterface { } class Context implements \Magento\Framework\ObjectManager\ContextInterface @@ -46,12 +44,12 @@ class Context implements \Magento\Framework\ObjectManager\ContextInterface protected $_exC; /** - * @var InterfaceA + * @var FirstInterface */ protected $_interfaceA; /** - * @var ImplementationOfInterfaceB + * @var ImplementationOfSecondInterface */ protected $_implOfBInterface; @@ -59,8 +57,8 @@ public function __construct( \ClassA $exA, \ClassB $exB, \ClassC $exC, - \InterfaceA $interfaceA, - \ImplementationOfInterfaceB $implOfBInterface + \FirstInterface $interfaceA, + \ImplementationOfSecondInterface $implOfBInterface ) { $this->_exA = $exA; $this->_exB = $exB; diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForContextAggregation.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForContextAggregation.php index c2af1e87e8098..67cf374cd1856 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForContextAggregation.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForContextAggregation.php @@ -5,8 +5,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - class ClassFirst { } @@ -19,16 +17,16 @@ class ClassThird class ClassD { } -interface InterfaceFirst +interface ThirdInterface { } -class ImplementationOfInterfaceFirst implements InterfaceFirst +class ImplementationOfThirdInterface implements ThirdInterface { } -interface InterfaceSecond +interface FourthInterface { } -class ImplementationOfInterfaceSecond implements InterfaceSecond +class ImplementationOfFourthInterface implements FourthInterface { } class ContextFirst implements \Magento\Framework\ObjectManager\ContextInterface @@ -49,12 +47,12 @@ class ContextFirst implements \Magento\Framework\ObjectManager\ContextInterface protected $_exC; /** - * @var InterfaceFirst + * @var ThirdInterface */ protected $_interfaceA; /** - * @var ImplementationOfInterfaceSecond + * @var ImplementationOfFourthInterface */ protected $_implOfBInterface; @@ -62,15 +60,15 @@ class ContextFirst implements \Magento\Framework\ObjectManager\ContextInterface * @param ClassFirst $exA * @param ClassSecond $exB * @param ClassThird $exC - * @param InterfaceFirst $interfaceA - * @param ImplementationOfInterfaceSecond $implOfBInterface + * @param ThirdInterface $interfaceA + * @param ImplementationOfFourthInterface $implOfBInterface */ public function __construct( \ClassFirst $exA, \ClassSecond $exB, \ClassThird $exC, - \InterfaceFirst $interfaceA, - \ImplementationOfInterfaceSecond $implOfBInterface + \ThirdInterface $interfaceA, + \ImplementationOfFourthInterface $implOfBInterface ) { $this->_exA = $exA; $this->_exB = $exB; @@ -109,15 +107,15 @@ class ClassArgumentWithInterfaceImplementation protected $_context; /** - * @var ImplementationOfInterfaceFirst + * @var ImplementationOfThirdInterface */ protected $_exA; /** * @param ContextFirst $context - * @param ImplementationOfInterfaceFirst $exA + * @param ImplementationOfThirdInterface $exA */ - public function __construct(\ContextFirst $context, \ImplementationOfInterfaceFirst $exA) + public function __construct(\ContextFirst $context, \ImplementationOfThirdInterface $exA) { $this->_context = $context; $this->_exA = $exA; @@ -131,15 +129,15 @@ class ClassArgumentWithInterface protected $_context; /** - * @var InterfaceSecond + * @var FourthInterface */ protected $_exB; /** * @param ContextFirst $context - * @param InterfaceSecond $exB + * @param FourthInterface $exB */ - public function __construct(\ContextFirst $context, \InterfaceSecond $exB) + public function __construct(\ContextFirst $context, \FourthInterface $exB) { $this->_context = $context; $this->_exB = $exB; @@ -153,15 +151,15 @@ class ClassArgumentWithAlreadyInjectedInterface protected $_context; /** - * @var InterfaceFirst + * @var ThirdInterface */ protected $_exA; /** * @param ContextFirst $context - * @param InterfaceFirst $exA + * @param ThirdInterface $exA */ - public function __construct(\ContextFirst $context, \InterfaceFirst $exA) + public function __construct(\ContextFirst $context, \ThirdInterface $exA) { $this->_context = $context; $this->_exA = $exA; diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForTypeDuplication.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForTypeDuplication.php index 82de20817fe30..3d1e1d131a098 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForTypeDuplication.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForTypeDuplication.php @@ -5,8 +5,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace TypeDuplication; interface ArgumentInterface diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php b/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php index e4249eda6878c..7a1bb6766c7ad 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\SomeModule\Model; use Magento\SomeModule\Model\Two\Test as TestTwo; From 99f296769905469e10aea25728108b3b2ddbde8b Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Sat, 13 May 2017 11:05:16 +0200 Subject: [PATCH 2/5] Fixed coding standard in SevenInterface --- .../app/code/Magento/SomeModule/Model/SevenInterface.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php b/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php index 7a1bb6766c7ad..e78f41c0fc189 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php @@ -27,7 +27,7 @@ interface SevenInterface extends \Magento\Framework\Code\Generator\CodeGenerator * @param array $data * @return TestThree */ - public static function testMethod1(array &$data = array()); + public static function testMethod1(array &$data = []); /** * Method short description @@ -41,6 +41,4 @@ public static function testMethod1(array &$data = array()); public function testMethod2($data = 'test_default', $flag = true); public function testMethod3(); - - } From 0f6e72edec843586099e980e03ed39e07aeb2f86 Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Sat, 13 May 2017 11:21:14 +0200 Subject: [PATCH 3/5] Zend Code Generator generates a array() param instead of PSR compliant [] --- .../_files/app/code/Magento/SomeModule/Model/SevenInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php b/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php index e78f41c0fc189..6fd10d63f5dfb 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php @@ -27,7 +27,7 @@ interface SevenInterface extends \Magento\Framework\Code\Generator\CodeGenerator * @param array $data * @return TestThree */ - public static function testMethod1(array &$data = []); + public static function testMethod1(array &$data = array()); /** * Method short description From 8b9ad5cb0da7d31ba5e461ff516dd921b8f5e05c Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 23 Jun 2017 17:04:29 +0300 Subject: [PATCH 4/5] MAGETWO-70141: Fixed coding standard violations in the Framework\Code namespace #9358 --- .../Test/Unit/Reader/_files/ClassesForArgumentsReader.php | 6 +++++- .../Unit/Validator/_files/ClassesForArgumentSequence.php | 6 +++++- .../Validator/_files/ClassesForConstructorIntegrity.php | 6 +++++- .../Unit/Validator/_files/ClassesForTypeDuplication.php | 6 +++++- .../app/code/Magento/SomeModule/Model/SevenInterface.php | 7 +++++++ 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php index 0fe2654175e8a..20748ae2c7cf1 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php @@ -1,10 +1,14 @@ Date: Fri, 23 Jun 2017 17:38:16 +0300 Subject: [PATCH 5/5] MAGETWO-70141: Fixed coding standard violations in the Framework\Code namespace #9358 --- .../Test/Unit/Validator/_files/ClassesForContextAggregation.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForContextAggregation.php diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForContextAggregation.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/_files/ClassesForContextAggregation.php deleted file mode 100644 index e69de29bb2d1d..0000000000000