diff --git a/.travis.yml b/.travis.yml index a82e42481c4e7..98b8e238afd89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,10 +24,6 @@ env: cache: apt: true directories: $HOME/.composer/cache -matrix: - exclude: - - php: 7.0 - env: TEST_SUITE=static before_install: ./dev/travis/before_install.sh install: composer install --no-interaction --prefer-dist before_script: ./dev/travis/before_script.sh diff --git a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php index 68fac7bf5f372..70063dea8d6d3 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php @@ -114,37 +114,6 @@ function ($path) use ($directoriesToCheck, $fileTypes) { return $changedFiles; } - /** - * Run the PSR2 code sniffs on the code - * - * @TODO: combine with testCodeStyle - * @return void - */ - public function testCodeStylePsr2() - { - $reportFile = self::$reportDir . '/phpcs_psr2_report.txt'; - $wrapper = new Wrapper(); - $codeSniffer = new CodeSniffer('PSR2', $reportFile, $wrapper); - if (!$codeSniffer->canRun()) { - $this->markTestSkipped('PHP Code Sniffer is not installed.'); - } - if (version_compare($wrapper->version(), '1.4.7') === -1) { - $this->markTestSkipped('PHP Code Sniffer Build Too Old.'); - } - - $result = $codeSniffer->run(self::getWhitelist()); - - $output = ""; - if (file_exists($reportFile)) { - $output = file_get_contents($reportFile); - } - $this->assertEquals( - 0, - $result, - "PHP Code Sniffer has found {$result} error(s): " . PHP_EOL . $output - ); - } - /** * Run the magento specific coding standards on the code * @@ -155,9 +124,15 @@ public function testCodeStyle() $reportFile = self::$reportDir . '/phpcs_report.txt'; $wrapper = new Wrapper(); $codeSniffer = new CodeSniffer(realpath(__DIR__ . '/_files/phpcs'), $reportFile, $wrapper); + if (!$codeSniffer->canRun()) { $this->markTestSkipped('PHP Code Sniffer is not installed.'); } + + if (version_compare($wrapper->version(), '1.4.7') === -1) { + $this->markTestSkipped('PHP Code Sniffer Build Too Old.'); + } + $codeSniffer->setExtensions(['php', 'phtml']); $result = $codeSniffer->run(self::getWhitelist(['php', 'phtml'])); diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/ruleset.xml b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/ruleset.xml index 89a7d56539ce3..00d3affcda7c8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/ruleset.xml +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/ruleset.xml @@ -7,6 +7,9 @@ --> Magento coding standard. + + */_files/* + diff --git a/lib/internal/Magento/Framework/Acl/AclResource/Provider.php b/lib/internal/Magento/Framework/Acl/AclResource/Provider.php index 1898a2fccef1b..1935aee1cf045 100644 --- a/lib/internal/Magento/Framework/Acl/AclResource/Provider.php +++ b/lib/internal/Magento/Framework/Acl/AclResource/Provider.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Acl\AclResource; class Provider implements ProviderInterface @@ -24,8 +22,10 @@ class Provider implements ProviderInterface * @param \Magento\Framework\Config\ReaderInterface $configReader * @param TreeBuilder $resourceTreeBuilder */ - public function __construct(\Magento\Framework\Config\ReaderInterface $configReader, TreeBuilder $resourceTreeBuilder) - { + public function __construct( + \Magento\Framework\Config\ReaderInterface $configReader, + TreeBuilder $resourceTreeBuilder + ) { $this->_configReader = $configReader; $this->_resourceTreeBuilder = $resourceTreeBuilder; } @@ -37,7 +37,9 @@ public function getAclResources() { $aclResourceConfig = $this->_configReader->read(); if (!empty($aclResourceConfig['config']['acl']['resources'])) { - return $this->_resourceTreeBuilder->build($aclResourceConfig['config']['acl']['resources']); + return $this->_resourceTreeBuilder->build( + $aclResourceConfig['config']['acl']['resources'] + ); } return []; } diff --git a/lib/internal/Magento/Framework/Api/DataObjectHelper.php b/lib/internal/Magento/Framework/Api/DataObjectHelper.php index 68f332fe6a9d7..d455040eee7ff 100644 --- a/lib/internal/Magento/Framework/Api/DataObjectHelper.php +++ b/lib/internal/Magento/Framework/Api/DataObjectHelper.php @@ -144,6 +144,7 @@ protected function _setDataValues($dataObject, array $data, $interfaceName) * @param string $interfaceName * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function setComplexValue( $dataObject, @@ -176,7 +177,7 @@ protected function setComplexValue( if (is_subclass_of($returnType, \Magento\Framework\Api\ExtensibleDataInterface::class)) { $object = $this->objectFactory->create($returnType, []); $this->populateWithArray($object, $value, $returnType); - } else if (is_subclass_of($returnType, \Magento\Framework\Api\ExtensionAttributesInterface::class)) { + } elseif (is_subclass_of($returnType, \Magento\Framework\Api\ExtensionAttributesInterface::class)) { foreach ($value as $extensionAttributeKey => $extensionAttributeValue) { $extensionAttributeGetterMethodName = 'get' . \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase( diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataObjectConverter.php b/lib/internal/Magento/Framework/Api/ExtensibleDataObjectConverter.php index 7c675174aafe0..7ec9ed5706503 100644 --- a/lib/internal/Magento/Framework/Api/ExtensibleDataObjectConverter.php +++ b/lib/internal/Magento/Framework/Api/ExtensibleDataObjectConverter.php @@ -48,7 +48,7 @@ public function toNestedArray( if (!empty($dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY])) { /** @var AttributeValue[] $customAttributes */ $customAttributes = $dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY]; - unset ($dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY]); + unset($dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY]); foreach ($customAttributes as $attributeValue) { if (!in_array($attributeValue[AttributeValue::ATTRIBUTE_CODE], $skipAttributes)) { $dataObjectArray[$attributeValue[AttributeValue::ATTRIBUTE_CODE]] @@ -59,7 +59,7 @@ public function toNestedArray( if (!empty($dataObjectArray[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY])) { /** @var array $extensionAttributes */ $extensionAttributes = $dataObjectArray[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]; - unset ($dataObjectArray[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]); + unset($dataObjectArray[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]); foreach ($extensionAttributes as $attributeKey => $attributeValue) { if (!in_array($attributeKey, $skipAttributes)) { $dataObjectArray[$attributeKey] = $attributeValue; diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php index 7cf9020f17278..481c5407e46b5 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php @@ -5,7 +5,6 @@ */ namespace Magento\Framework\Api\SearchCriteria\CollectionProcessor; - use Magento\Framework\Api\SearchCriteria\CollectionProcessor\JoinProcessor\CustomJoinInterface; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaInterface; diff --git a/lib/internal/Magento/Framework/Api/SortOrder.php b/lib/internal/Magento/Framework/Api/SortOrder.php index ed799cad67719..d6c465e34002c 100644 --- a/lib/internal/Magento/Framework/Api/SortOrder.php +++ b/lib/internal/Magento/Framework/Api/SortOrder.php @@ -31,8 +31,7 @@ public function __construct(array $data = []) $this->validateDirection($this->getDirection()); } } - - + /** * Get sorting field. * @@ -78,7 +77,7 @@ public function setDirection($direction) /** * Validate direction argument ASC or DESC - * + * * @param mixed $direction * @return null * @throws InputException diff --git a/lib/internal/Magento/Framework/Api/SortOrderBuilder.php b/lib/internal/Magento/Framework/Api/SortOrderBuilder.php index c90e5a68bd165..22314d54b1203 100644 --- a/lib/internal/Magento/Framework/Api/SortOrderBuilder.php +++ b/lib/internal/Magento/Framework/Api/SortOrderBuilder.php @@ -6,7 +6,6 @@ namespace Magento\Framework\Api; - /** * Builder for sort order data object. * @method SortOrder create() diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageContentValidatorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageContentValidatorTest.php index e57635a2d9750..eead35e801997 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageContentValidatorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageContentValidatorTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Api\Test\Unit\Api; /** @@ -26,8 +24,8 @@ class ImageContentValidatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->imageContentValidator = $this->objectManager->getObject( - \Magento\Framework\Api\ImageContentValidator::class + $this->imageContentValidator = $this->objectManager->getObject( + \Magento\Framework\Api\ImageContentValidator::class ); } diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php index 83d1a9ece7c18..4d707f25b856e 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Api\Test\Unit\Api; /** @@ -57,7 +55,7 @@ protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->directoryWriteMock = $this->getMockForAbstractClass( + $this->directoryWriteMock = $this->getMockForAbstractClass( \Magento\Framework\Filesystem\Directory\WriteInterface::class ); $this->fileSystemMock = $this->getMockBuilder(\Magento\Framework\Filesystem::class) @@ -66,8 +64,9 @@ protected function setUp() $this->fileSystemMock->expects($this->any()) ->method('getDirectoryWrite') ->willReturn($this->directoryWriteMock); - $this->contentValidatorMock = $this->getMockBuilder( - \Magento\Framework\Api\ImageContentValidatorInterface::class) + $this->contentValidatorMock = $this->getMockBuilder( + \Magento\Framework\Api\ImageContentValidatorInterface::class + ) ->disableOriginalConstructor() ->getMock(); $this->dataObjectHelperMock = $this->getMockBuilder(\Magento\Framework\Api\DataObjectHelper::class) @@ -90,7 +89,7 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $this->imageProcessor = $this->objectManager->getObject( + $this->imageProcessor = $this->objectManager->getObject( \Magento\Framework\Api\ImageProcessor::class, [ 'fileSystem' => $this->fileSystemMock, diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php index 6a7fac692f4d0..dea20b3cceacf 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php @@ -3,7 +3,7 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + namespace Magento\Framework\Api\Test\Unit\Code\Generator; use Magento\Framework\Api\ExtensionAttribute\Config\Converter; diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php index 842802470454b..d3938629f1da2 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php @@ -3,7 +3,7 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + namespace Magento\Framework\Api\Test\Unit\Code\Generator; use Magento\Framework\Api\ExtensionAttribute\Config\Converter; diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php index 18d5195a46c6b..5de6b6494f38d 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php @@ -5,7 +5,6 @@ */ namespace Magento\Framework\Api\Test\Unit\Code\Generator; - /** * Class SearchResultTest */ diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php index 95e46d99a8e45..6d1ca38d72e70 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Api\Test\Unit; use Magento\Framework\Api\CustomAttributesDataInterface; @@ -144,7 +142,8 @@ public function testPopulateWithArrayWithSimpleAttributes() $this->dataObjectHelper->populateWithArray( $addressDataObject, - $data, \Magento\Customer\Api\Data\AddressInterface::class + $data, + \Magento\Customer\Api\Data\AddressInterface::class ); $this->assertEquals($id, $addressDataObject->getId()); @@ -198,7 +197,8 @@ public function testPopulateWithArrayWithCustomAttribute() ->willReturn($customAttribute); $this->dataObjectHelper->populateWithArray( $addressDataObject, - $data, \Magento\Customer\Api\Data\AddressInterface::class + $data, + \Magento\Customer\Api\Data\AddressInterface::class ); $this->assertEquals($id, $addressDataObject->getId()); @@ -260,7 +260,8 @@ public function testPopulateWithArrayWithCustomAttributes() ->willReturn($customAttribute); $this->dataObjectHelper->populateWithArray( $addressDataObject, - $data, \Magento\Customer\Api\Data\AddressInterface::class + $data, + \Magento\Customer\Api\Data\AddressInterface::class ); $this->assertEquals($id, $addressDataObject->getId()); diff --git a/lib/internal/Magento/Framework/Api/Uploader.php b/lib/internal/Magento/Framework/Api/Uploader.php index cd8912a470109..4f3a39c8c79c9 100644 --- a/lib/internal/Magento/Framework/Api/Uploader.php +++ b/lib/internal/Magento/Framework/Api/Uploader.php @@ -17,7 +17,6 @@ class Uploader extends \Magento\Framework\File\Uploader */ public function __construct() { - } /** diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php index ac1e5f6ecf897..e6f1727a1e428 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php @@ -15,6 +15,8 @@ /** * Deployment configuration writer + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Writer { @@ -101,7 +103,6 @@ public function saveConfig(array $data, $override = false) foreach ($data as $fileKey => $config) { if (isset($paths[$fileKey])) { - if ($this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->isExist($paths[$fileKey])) { $currentData = $this->reader->load($fileKey); if ($override) { diff --git a/lib/internal/Magento/Framework/App/Response/HttpInterface.php b/lib/internal/Magento/Framework/App/Response/HttpInterface.php index a0b04b34a47f4..978ae4684e025 100644 --- a/lib/internal/Magento/Framework/App/Response/HttpInterface.php +++ b/lib/internal/Magento/Framework/App/Response/HttpInterface.php @@ -38,7 +38,7 @@ public function setHeader($name, $value, $replace = false); /** * Get header value by name - * + * * Returns first found header by passed name. * If header with specified name was not found returns false. * @@ -57,14 +57,14 @@ public function clearHeader($name); /** * Allow granular setting of HTTP response status code, version and phrase - * + * * For example, a HTTP response as the following: * HTTP 200 1.1 Your response has been served * Can be set with the arguments * $httpCode = 200 * $version = 1.1 * $phrase = 'Your response has been served' - * + * * @param int|string $httpCode * @param null|int|string $version * @param null|string $phrase @@ -74,7 +74,7 @@ public function setStatusHeader($httpCode, $version = null, $phrase = null); /** * Append the given string to the response body - * + * * @param string $value * @return self */ @@ -82,9 +82,9 @@ public function appendBody($value); /** * Set the response body to the given value - * + * * Any previously set contents will be replaced by the new content. - * + * * @param string $value * @return self */ diff --git a/lib/internal/Magento/Framework/App/SetupInfo.php b/lib/internal/Magento/Framework/App/SetupInfo.php index 731ec97ee7dd2..02c225ce485cf 100644 --- a/lib/internal/Magento/Framework/App/SetupInfo.php +++ b/lib/internal/Magento/Framework/App/SetupInfo.php @@ -111,7 +111,7 @@ public function getProjectUrl() $isProjectInDocRoot = false !== strpos($this->projectRoot . '/', $this->docRoot . '/'); if (empty($this->server['HTTP_HOST'])) { return ''; - } else if (!$isProjectInDocRoot) { + } elseif (!$isProjectInDocRoot) { return 'http://' . $this->server['HTTP_HOST'] . '/'; } return 'http://' . $this->server['HTTP_HOST'] . substr($this->projectRoot . '/', strlen($this->docRoot)); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionFake.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionFake.php new file mode 100644 index 0000000000000..672bf49ffc6bf --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionFake.php @@ -0,0 +1,27 @@ +_forward( + ActionTest::ACTION_NAME, + ActionTest::CONTROLLER_NAME, + ActionTest::MODULE_NAME, + ActionTest::$actionParams + ); + $this->_redirect(ActionTest::FULL_ACTION_NAME, ActionTest::$actionParams); + return; + } +} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php index cb9c427816d23..8bb280cbef377 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit\Action; use \Magento\Framework\App\Action\Action; @@ -185,20 +183,3 @@ public function testDispatchPostDispatch() $this->assertEquals($this->_responseMock, $this->action->dispatch($this->_requestMock)); } } - -class ActionFake extends Action -{ - /** - * Fake action to check a method call from a parent - */ - public function execute() - { - $this->_forward( - ActionTest::ACTION_NAME, - ActionTest::CONTROLLER_NAME, - ActionTest::MODULE_NAME, - ActionTest::$actionParams); - $this->_redirect(ActionTest::FULL_ACTION_NAME, ActionTest::$actionParams); - return; - } -} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php index 9886abf023216..b10a553959de2 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit; use \Magento\Framework\App\AreaList; @@ -48,12 +46,12 @@ public function testGetCodeByFrontNameWhenAreaDoesNotContainFrontName() $this->_resolverFactory->expects( $this->any() )->method( - 'create' - )->with( - 'testValue' - )->will( - $this->returnValue($resolverMock) - ); + 'create' + )->with( + 'testValue' + )->will( + $this->returnValue($resolverMock) + ); $actual = $this->_model->getCodeByFrontName('testFrontName'); $this->assertEquals($expected, $actual); @@ -106,7 +104,10 @@ public function testGetCodes() { $areas = ['area1' => 'value1', 'area2' => 'value2']; $this->_model = new \Magento\Framework\App\AreaList( - $this->objectManagerMock, $this->_resolverFactory, $areas, '' + $this->objectManagerMock, + $this->_resolverFactory, + $areas, + '' ); $expected = array_keys($areas); @@ -118,7 +119,10 @@ public function testGetDefaultRouter() { $areas = ['area1' => ['router' => 'value1'], 'area2' => 'value2']; $this->_model = new \Magento\Framework\App\AreaList( - $this->objectManagerMock, $this->_resolverFactory, $areas, '' + $this->objectManagerMock, + $this->_resolverFactory, + $areas, + '' ); $this->assertEquals($this->_model->getDefaultRouter('area1'), $areas['area1']['router']); @@ -131,7 +135,10 @@ public function testGetArea() $objectManagerMock = $this->getObjectManagerMockGetArea(); $areas = ['area1' => ['router' => 'value1'], 'area2' => 'value2']; $this->_model = new AreaList( - $objectManagerMock, $this->_resolverFactory, $areas, '' + $objectManagerMock, + $this->_resolverFactory, + $areas, + '' ); $this->assertEquals($this->_model->getArea('testArea'), 'ok'); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php index 66564cc7f2120..342bd58e7f23e 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit; use \Magento\Framework\App\Bootstrap; @@ -93,7 +91,7 @@ protected function setUp() [\Magento\Framework\App\MaintenanceMode::class, $this->maintenanceMode], [\Magento\Framework\Filesystem::class, $filesystem], [\Magento\Framework\App\DeploymentConfig::class, $this->deploymentConfig], - ['Psr\Log\LoggerInterface', $this->logger], + [\Psr\Log\LoggerInterface::class, $this->logger], ]; $this->objectManager->expects($this->any())->method('get') diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php index afc745f33c5a9..efb48fc4bd692 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php @@ -40,7 +40,6 @@ protected function setUp() ['test'], $this->tagResolver ); - } public function testAroundSave() diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/FactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/FactoryTest.php index 77a0d7e664e91..96b3c048999dd 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/FactoryTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/FactoryTest.php @@ -5,7 +5,6 @@ */ namespace Magento\Framework\App\Test\Unit\Cache\Frontend; - class FactoryTest extends \PHPUnit_Framework_TestCase { public static function setUpBeforeClass() diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php index 5a0b4ae96f26c..94fa0393e0b30 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit\ObjectManager; class ConfigLoaderTest extends \PHPUnit_Framework_TestCase @@ -32,7 +30,7 @@ class ConfigLoaderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_readerMock = $this->getMock( + $this->_readerMock = $this->getMock( \Magento\Framework\ObjectManager\Config\Reader\Dom::class, [], [], @@ -40,7 +38,7 @@ protected function setUp() false ); - $this->_readerFactoryMock = $this->getMock( + $this->_readerFactoryMock = $this->getMock( \Magento\Framework\ObjectManager\Config\Reader\DomFactory::class, ['create'], [], @@ -58,7 +56,8 @@ protected function setUp() $this->_cacheMock = $this->getMock(\Magento\Framework\App\Cache\Type\Config::class, [], [], '', false); $this->_model = new \Magento\Framework\App\ObjectManager\ConfigLoader( - $this->_cacheMock, $this->_readerFactoryMock + $this->_cacheMock, + $this->_readerFactoryMock ); } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/FactoryStub.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/FactoryStub.php index 808d7fbaa6deb..7c0d181a32385 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/FactoryStub.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/FactoryStub.php @@ -47,6 +47,5 @@ public function create($requestedType, array $arguments = []) */ public function setObjectManager(ObjectManagerInterface $objectManager) { - } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php index 9a35aa9104e80..bcb4dba000a0b 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit; class ReinitableConfigTest extends \PHPUnit_Framework_TestCase diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php index 98742f397e1cf..00dd7fdefcd94 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php @@ -5,8 +5,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit\Request; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -99,7 +97,7 @@ private function getModel($uri = null, $appConfigMock = true) ); if ($appConfigMock) { - $configMock = $this->getMock(\Magento\Framework\App\Config::class, [], [], '' , false); + $configMock = $this->getMock(\Magento\Framework\App\Config::class, [], [], '', false); $this->objectManager->setBackwardCompatibleProperty($model, 'appConfig', $configMock); } @@ -283,7 +281,6 @@ public function getDistroBaseUrlPathDataProvider() ]; } - public function serverVariablesProvider() { $returnValue = []; @@ -351,8 +348,10 @@ public function testIsSecure($isSecure, $serverHttps, $headerOffloadKey, $header ->getMock(); $configMock->expects($this->exactly($configCall)) ->method('getValue') - ->with(\Magento\Framework\App\Request\Http::XML_PATH_OFFLOADER_HEADER, ScopeConfigInterface::SCOPE_TYPE_DEFAULT) - ->willReturn($configOffloadHeader); + ->with( + \Magento\Framework\App\Request\Http::XML_PATH_OFFLOADER_HEADER, + ScopeConfigInterface::SCOPE_TYPE_DEFAULT + )->willReturn($configOffloadHeader); $this->objectManager->setBackwardCompatibleProperty($this->_model, 'appConfig', $configMock); $this->objectManager->setBackwardCompatibleProperty($this->_model, 'sslOffloadHeader', null); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php index 2045fc9bd17b4..77aa77b011e9c 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit\Response; use \Magento\Framework\App\Response\Http; @@ -53,7 +51,8 @@ protected function setUp() )->disableOriginalConstructor()->getMock(); $this->cookieManagerMock = $this->getMock(\Magento\Framework\Stdlib\CookieManagerInterface::class); $this->contextMock = $this->getMockBuilder( - \Magento\Framework\App\Http\Context::class)->disableOriginalConstructor() + \Magento\Framework\App\Http\Context::class + )->disableOriginalConstructor() ->getMock(); $this->dateTimeMock = $this->getMockBuilder(\Magento\Framework\Stdlib\DateTime::class) @@ -88,7 +87,8 @@ public function testSendVary() $expectedCookieName = Http::COOKIE_VARY_STRING; $expectedCookieValue = sha1(serialize($data)); $sensitiveCookieMetadataMock = $this->getMockBuilder( - \Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata::class) + \Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata::class + ) ->disableOriginalConstructor() ->getMock(); $sensitiveCookieMetadataMock->expects($this->once()) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php index 1af3a0b86ee7e..3260fae911f7c 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit\Router; class NoRouteHandlerListTest extends \PHPUnit_Framework_TestCase diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerTest.php index eaa6418348dba..1c59226bb0e5a 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerTest.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit\Router; class NoRouteHandlerTest extends \Magento\Framework\TestFramework\Unit\BaseTestCase diff --git a/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php b/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php index ae3845834ee02..a62c04c2eebca 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit; use \Magento\Framework\App\Area; diff --git a/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php b/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php index 002e4746f6fb0..a665fabcf5c2b 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\App\Test\Unit; use Magento\Framework\App\Bootstrap; @@ -77,7 +75,11 @@ protected function setUp() $this->objectManager = $this->getMockForAbstractClass(\Magento\Framework\ObjectManagerInterface::class); $this->logger = $this->getMockForAbstractClass(\Psr\Log\LoggerInterface::class); $this->configLoader = $this->getMock( - \Magento\Framework\App\ObjectManager\ConfigLoader::class, [], [], '', false + \Magento\Framework\App\ObjectManager\ConfigLoader::class, + [], + [], + '', + false ); $this->object = new \Magento\Framework\App\StaticResource( $this->state, @@ -204,7 +206,7 @@ public function testCatchExceptionDeveloperMode() { $this->objectManager->expects($this->once()) ->method('get') - ->with('Psr\Log\LoggerInterface') + ->with(\Psr\Log\LoggerInterface::class) ->willReturn($this->logger); $this->logger->expects($this->once()) ->method('critical'); diff --git a/lib/internal/Magento/Framework/App/Utility/Classes.php b/lib/internal/Magento/Framework/App/Utility/Classes.php index 5deac4a06e556..97afaba69a506 100644 --- a/lib/internal/Magento/Framework/App/Utility/Classes.php +++ b/lib/internal/Magento/Framework/App/Utility/Classes.php @@ -271,11 +271,10 @@ public static function resolveVirtualType($className) */ public static function isAutogenerated($className) { - if ( - preg_match( - '/.*\\\\[a-zA-Z0-9]{1,}(Factory|SearchResults|DataBuilder|Extension|ExtensionInterface)$/', - $className - ) + if (preg_match( + '/.*\\\\[a-zA-Z0-9]{1,}(Factory|SearchResults|DataBuilder|Extension|ExtensionInterface)$/', + $className + ) || preg_match('/Magento\\\\[\w]+\\\\(Test\\\\(Page|Fixture))\\\\/', $className) || preg_match('/.*\\\\[a-zA-Z0-9]{1,}\\\\Proxy$/', $className) ) { diff --git a/lib/internal/Magento/Framework/Archive/Helper/File.php b/lib/internal/Magento/Framework/Archive/Helper/File.php index a0e8b3084e855..7882f315e7c94 100644 --- a/lib/internal/Magento/Framework/Archive/Helper/File.php +++ b/lib/internal/Magento/Framework/Archive/Helper/File.php @@ -4,11 +4,9 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** -* Helper class that simplifies files stream reading and writing -*/ + * Helper class that simplifies files stream reading and writing + */ namespace Magento\Framework\Archive\Helper; use Magento\Framework\Exception\LocalizedException; @@ -98,7 +96,10 @@ public function open($mode = 'w+', $chmod = null) if ($this->_isInWriteMode) { if (!is_writable($this->_fileLocation)) { throw new LocalizedException( - new \Magento\Framework\Phrase('Permission denied to write to %1', [$this->_fileLocation]) + new \Magento\Framework\Phrase( + 'Permission denied to write to %1', + [$this->_fileLocation] + ) ); } @@ -199,7 +200,9 @@ protected function _open($mode) $this->_fileHandler = @fopen($this->_filePath, $mode); if (false === $this->_fileHandler) { - throw new LocalizedException(new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath])); + throw new LocalizedException( + new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath]) + ); } } @@ -215,7 +218,9 @@ protected function _write($data) $result = @fwrite($this->_fileHandler, $data); if (false === $result) { - throw new LocalizedException(new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath])); + throw new LocalizedException( + new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath]) + ); } } diff --git a/lib/internal/Magento/Framework/Archive/Helper/File/Gz.php b/lib/internal/Magento/Framework/Archive/Helper/File/Gz.php index 2bc293270aabd..0e779410bb302 100644 --- a/lib/internal/Magento/Framework/Archive/Helper/File/Gz.php +++ b/lib/internal/Magento/Framework/Archive/Helper/File/Gz.php @@ -4,11 +4,9 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** -* Helper class that simplifies gz files stream reading and writing -*/ + * Helper class that simplifies gz files stream reading and writing + */ namespace Magento\Framework\Archive\Helper\File; class Gz extends \Magento\Framework\Archive\Helper\File diff --git a/lib/internal/Magento/Framework/Autoload/Test/Unit/ClassLoaderWrapperTest.php b/lib/internal/Magento/Framework/Autoload/Test/Unit/ClassLoaderWrapperTest.php index be40adcdc0edc..e93ac77283c31 100644 --- a/lib/internal/Magento/Framework/Autoload/Test/Unit/ClassLoaderWrapperTest.php +++ b/lib/internal/Magento/Framework/Autoload/Test/Unit/ClassLoaderWrapperTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Autoload\Test\Unit; use Composer\Autoload\ClassLoader; @@ -32,7 +30,8 @@ class ClassLoaderWrapperTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->autoloaderMock = $this->getMock(\Composer\Autoload\ClassLoader::class); - $this->model = (new ObjectManager($this))->getObject(\Magento\Framework\Autoload\ClassLoaderWrapper::class, + $this->model = (new ObjectManager($this))->getObject( + \Magento\Framework\Autoload\ClassLoaderWrapper::class, [ 'autoloader' => $this->autoloaderMock ] diff --git a/lib/internal/Magento/Framework/Backup/Archive/Tar.php b/lib/internal/Magento/Framework/Backup/Archive/Tar.php index 8610a7e5994f4..9f741a924ae05 100644 --- a/lib/internal/Magento/Framework/Backup/Archive/Tar.php +++ b/lib/internal/Magento/Framework/Backup/Archive/Tar.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Extended version of \Magento\Framework\Archive\Tar that supports filtering * @@ -23,14 +21,15 @@ class Tar extends \Magento\Framework\Archive\Tar protected $_skipFiles = []; /** - * Overridden \Magento\Framework\Archive\Tar::_createTar method that does the same actions as it's parent but filters - * files using \Magento\Framework\Backup\Filesystem\Iterator\Filter + * Overridden \Magento\Framework\Archive\Tar::_createTar method that does the same actions as it's parent but + * filters files using \Magento\Framework\Backup\Filesystem\Iterator\Filter * * @param bool $skipRoot * @param bool $finalize * @return void * * @see \Magento\Framework\Archive\Tar::_createTar() + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function _createTar($skipRoot = false, $finalize = false) { @@ -41,7 +40,10 @@ protected function _createTar($skipRoot = false, $finalize = false) \RecursiveIteratorIterator::SELF_FIRST ); - $iterator = new \Magento\Framework\Backup\Filesystem\Iterator\Filter($filesystemIterator, $this->_skipFiles); + $iterator = new \Magento\Framework\Backup\Filesystem\Iterator\Filter( + $filesystemIterator, + $this->_skipFiles + ); foreach ($iterator as $item) { $this->_setCurrentFile($item->getPathname()); diff --git a/lib/internal/Magento/Framework/Backup/Db/BackupFactory.php b/lib/internal/Magento/Framework/Backup/Db/BackupFactory.php index 4ea115adf9927..c468591ddabe9 100644 --- a/lib/internal/Magento/Framework/Backup/Db/BackupFactory.php +++ b/lib/internal/Magento/Framework/Backup/Db/BackupFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Backup\Db; class BackupFactory @@ -32,8 +30,11 @@ class BackupFactory * @param string $backupInstanceName * @param string $backupDbInstanceName */ - public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, $backupInstanceName, $backupDbInstanceName) - { + public function __construct( + \Magento\Framework\ObjectManagerInterface $objectManager, + $backupInstanceName, + $backupDbInstanceName + ) { $this->_objectManager = $objectManager; $this->_backupInstanceName = $backupInstanceName; $this->_backupDbInstanceName = $backupDbInstanceName; diff --git a/lib/internal/Magento/Framework/Backup/Factory.php b/lib/internal/Magento/Framework/Backup/Factory.php index 6a0837c138952..05182610b0e25 100644 --- a/lib/internal/Magento/Framework/Backup/Factory.php +++ b/lib/internal/Magento/Framework/Backup/Factory.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Backup; class Factory diff --git a/lib/internal/Magento/Framework/Backup/Filesystem.php b/lib/internal/Magento/Framework/Backup/Filesystem.php index 7fe469441eeaf..49db0b1c579b6 100644 --- a/lib/internal/Magento/Framework/Backup/Filesystem.php +++ b/lib/internal/Magento/Framework/Backup/Filesystem.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Backup; use Magento\Framework\App\ObjectManager; @@ -108,7 +106,8 @@ public function create() $filesInfo = $fsHelper->getInfo( $this->getRootDir(), - \Magento\Framework\Backup\Filesystem\Helper::INFO_READABLE | \Magento\Framework\Backup\Filesystem\Helper::INFO_SIZE, + \Magento\Framework\Backup\Filesystem\Helper::INFO_READABLE | + \Magento\Framework\Backup\Filesystem\Helper::INFO_SIZE, $this->getIgnorePaths() ); @@ -162,8 +161,8 @@ public function validateAvailableDiscSpace($backupDir, $size) if ($requiredSpace > $freeSpace) { throw new \Magento\Framework\Backup\Exception\NotEnoughFreeSpace( new \Magento\Framework\Phrase( - 'Warning: necessary space for backup is ' . (ceil($requiredSpace) / 1024) - . 'MB, but your free disc space is ' . (ceil($freeSpace) / 1024) . 'MB.' + 'Warning: necessary space for backup is ' . (ceil($requiredSpace) / 1024) + . 'MB, but your free disc space is ' . (ceil($freeSpace) / 1024) . 'MB.' ) ); } diff --git a/lib/internal/Magento/Framework/Backup/Media.php b/lib/internal/Magento/Framework/Backup/Media.php index c53f035408377..2240ceb664822 100644 --- a/lib/internal/Magento/Framework/Backup/Media.php +++ b/lib/internal/Magento/Framework/Backup/Media.php @@ -5,7 +5,6 @@ */ namespace Magento\Framework\Backup; - /** * Class to work media folder and database backups * diff --git a/lib/internal/Magento/Framework/Cache/Backend/Database.php b/lib/internal/Magento/Framework/Cache/Backend/Database.php index 1f03a0e5d97e1..03af912a330bd 100644 --- a/lib/internal/Magento/Framework/Cache/Backend/Database.php +++ b/lib/internal/Magento/Framework/Cache/Backend/Database.php @@ -4,29 +4,28 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** -Tables declaration: - -CREATE TABLE IF NOT EXISTS `cache` ( - `id` VARCHAR(255) NOT NULL, - `data` mediumblob, - `create_time` int(11), - `update_time` int(11), - `expire_time` int(11), - PRIMARY KEY (`id`), - KEY `IDX_EXPIRE_TIME` (`expire_time`) -)ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `cache_tag` ( - `tag` VARCHAR(255) NOT NULL, - `cache_id` VARCHAR(255) NOT NULL, - KEY `IDX_TAG` (`tag`), - KEY `IDX_CACHE_ID` (`cache_id`), - CONSTRAINT `FK_CORE_CACHE_TAG` FOREIGN KEY (`cache_id`) REFERENCES `cache` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -*/ + * Tables declaration: + * + * CREATE TABLE IF NOT EXISTS `cache` ( + * `id` VARCHAR(255) NOT NULL, + * `data` mediumblob, + * `create_time` int(11), + * `update_time` int(11), + * `expire_time` int(11), + * PRIMARY KEY (`id`), + * KEY `IDX_EXPIRE_TIME` (`expire_time`) + * )ENGINE=InnoDB DEFAULT CHARSET=utf8; + * + * CREATE TABLE IF NOT EXISTS `cache_tag` ( + * `tag` VARCHAR(255) NOT NULL, + * `cache_id` VARCHAR(255) NOT NULL, + * KEY `IDX_TAG` (`tag`), + * KEY `IDX_CACHE_ID` (`cache_id`), + * CONSTRAINT `FK_CORE_CACHE_TAG` FOREIGN KEY (`cache_id`) + * REFERENCES `cache` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + * ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + */ /** * Database cache backend @@ -148,7 +147,10 @@ public function load($id, $doNotTestCacheValidity = false) { if ($this->_options['store_data'] && !$this->_options['infinite_loop_flag']) { $this->_options['infinite_loop_flag'] = true; - $select = $this->_getConnection()->select()->from($this->_getDataTable(), 'data')->where('id=:cache_id'); + $select = $this->_getConnection()->select()->from( + $this->_getDataTable(), + 'data' + )->where('id=:cache_id'); if (!$doNotTestCacheValidity) { $select->where('expire_time=0 OR expire_time>?', time()); @@ -197,7 +199,7 @@ public function test($id) * @param string $data Datas to cache * @param string $id Cache id * @param string[] $tags Array of strings, the cache record will be tagged by each string entry - * @param int|bool $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) + * @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime * @return bool true if no problem */ public function save($data, $id, $tags = [], $specificLifetime = false) @@ -222,7 +224,8 @@ public function save($data, $id, $tags = [], $specificLifetime = false) 'create_time' )},\n {$connection->quoteIdentifier( 'update_time' - )},\n {$expireCol})\n VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE\n {$dataCol}=VALUES({$dataCol}),\n {$expireCol}=VALUES({$expireCol})"; + )},\n {$expireCol})\n VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE\n + {$dataCol}=VALUES({$dataCol}),\n {$expireCol}=VALUES({$expireCol})"; $result = $connection->query($query, [$id, $data, $time, $time, $expire])->rowCount(); } @@ -554,10 +557,10 @@ protected function _cleanByTags($mode, $tags) /** * Clean all cache entries * - * @param $connection + * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection * @return bool */ - private function cleanAll($connection) + private function cleanAll(\Magento\Framework\DB\Adapter\AdapterInterface $connection) { if ($this->_options['store_data']) { $result = $connection->query('TRUNCATE TABLE ' . $this->_getDataTable()); @@ -571,10 +574,10 @@ private function cleanAll($connection) /** * Clean old cache entries * - * @param $connection + * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection * @return bool */ - private function cleanOld($connection) + private function cleanOld(\Magento\Framework\DB\Adapter\AdapterInterface $connection) { if ($this->_options['store_data']) { $result = $connection->delete( diff --git a/lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php b/lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php index c8b96659a6b40..5a4a91c18aa11 100644 --- a/lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php +++ b/lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Cache\Backend; class Eaccelerator extends \Zend_Cache_Backend implements \Zend_Cache_Backend_ExtendedInterface @@ -76,7 +74,7 @@ public function test($id) * @param string $data datas to cache * @param string $id cache id * @param string[] $tags array of strings, the cache record will be tagged by each string entry - * @param int|bool $specificLifetime if != false, set a specific lifetime for this cache record (null => infinite lifetime) + * @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime * @return bool true if no problem */ public function save($data, $id, $tags = [], $specificLifetime = false) @@ -124,7 +122,8 @@ public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = []) break; case \Zend_Cache::CLEANING_MODE_OLD: $this->_log( - "Magento\Framework\Cache\Backend\Eaccelerator::clean() : CLEANING_MODE_OLD is unsupported by the Eaccelerator backend" + "Magento\Framework\Cache\Backend\Eaccelerator::clean() : ". + "CLEANING_MODE_OLD is unsupported by the Eaccelerator backend" ); break; case \Zend_Cache::CLEANING_MODE_MATCHING_TAG: diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php index cdbbc4baed695..403e05dd5fe84 100644 --- a/lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php +++ b/lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * \Magento\Framework\Cache\Core test case */ diff --git a/lib/internal/Magento/Framework/Code/GeneratedFiles.php b/lib/internal/Magento/Framework/Code/GeneratedFiles.php index 75d5ff4b4b73b..20839a2b4b2a7 100644 --- a/lib/internal/Magento/Framework/Code/GeneratedFiles.php +++ b/lib/internal/Magento/Framework/Code/GeneratedFiles.php @@ -64,7 +64,6 @@ public function regenerate() public function cleanGeneratedFiles() { if ($this->write->isExist(self::REGENERATE_FLAG)) { - $enabledCacheTypes = []; //TODO: to be removed in scope of MAGETWO-53476 @@ -133,7 +132,6 @@ private function getEnabledCacheTypes() return $enabledCacheTypes; } - /** * Returns path to env.php file * @@ -183,8 +181,7 @@ private function disableAllCacheTypes() * Enables apppropriate cache types in app/etc/env.php based on the passed in $cacheTypes array * TODO: to be removed in scope of MAGETWO-53476 * - * @param string[] - * + * @param string[] $cacheTypes * @return void */ private function enableCacheTypes($cacheTypes) diff --git a/lib/internal/Magento/Framework/Code/Generator.php b/lib/internal/Magento/Framework/Code/Generator.php index 40f9ac671d765..742b517b25c1f 100644 --- a/lib/internal/Magento/Framework/Code/Generator.php +++ b/lib/internal/Magento/Framework/Code/Generator.php @@ -199,7 +199,7 @@ protected function shouldSkipGeneration($resultEntityType, $sourceClassName, $re { if (!$resultEntityType || !$sourceClassName) { return self::GENERATION_ERROR; - } else if ($this->definedClasses->isClassLoadableFromDisc($resultClass)) { + } elseif ($this->definedClasses->isClassLoadableFromDisc($resultClass)) { $generatedFileName = $this->_ioObject->generateResultFileName($resultClass); /** * Must handle two edge cases: a competing process has generated the class and written it to disc already, @@ -211,7 +211,7 @@ protected function shouldSkipGeneration($resultEntityType, $sourceClassName, $re $this->_ioObject->includeFile($generatedFileName); } return self::GENERATION_SKIP; - } else if (!isset($this->_generatedEntities[$resultEntityType])) { + } elseif (!isset($this->_generatedEntities[$resultEntityType])) { throw new \InvalidArgumentException('Unknown generation entity.'); } return false; diff --git a/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php b/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php index 9e5dff03a919f..ee143d40f49e9 100644 --- a/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php +++ b/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php @@ -252,12 +252,7 @@ protected function _validateData() if (!$this->definedClasses->isClassLoadable($sourceClassName)) { $this->_addError('Source class ' . $sourceClassName . ' doesn\'t exist.'); return false; - } elseif ( - /** - * If makeResultFileDirectory only fails because the file is already created, - * a competing process has generated the file, no exception should be thrown. - */ - !$this->_ioObject->makeResultFileDirectory($resultClassName) + } elseif (!$this->_ioObject->makeResultFileDirectory($resultClassName) && !$this->_ioObject->fileExists($resultDir) ) { $this->_addError('Can\'t create directory ' . $resultDir . '.'); diff --git a/lib/internal/Magento/Framework/Code/Generator/InterfaceGenerator.php b/lib/internal/Magento/Framework/Code/Generator/InterfaceGenerator.php index 13698393353f5..924b7fdd449ec 100644 --- a/lib/internal/Magento/Framework/Code/Generator/InterfaceGenerator.php +++ b/lib/internal/Magento/Framework/Code/Generator/InterfaceGenerator.php @@ -37,7 +37,7 @@ public function generate() } $output .= self::LINE_FEED . '{' . self::LINE_FEED . self::LINE_FEED - . $this->generateMethods() . self::LINE_FEED . '}' . self::LINE_FEED; + . $this->generateMethods() . '}' . self::LINE_FEED; return $output; } diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php index deb3175529d1b..7dcc920e8d03b 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php @@ -93,7 +93,7 @@ public function testWriteResultFileAlreadyExists($resultFileName, $fileExists, $ if (!$exceptionDuringRename) { $renameMockEvent = $this->returnValue(true); - } else if ($fileExists) { + } elseif ($fileExists) { $renameMockEvent = $this->throwException(new FileSystemException(new Phrase('File already exists'))); } else { $exceptionMessage = 'Some error renaming file'; diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php index 9024d56e8a29a..634584c0524dc 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 ff5dda80cbee2..02c1eadbd7e8b 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 d03db534f1837..2476c3aa985b4 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 @@ -28,14 +26,14 @@ class ConstructorArgumentTypesTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->argumentsReaderMock = $this->getMock( + $this->argumentsReaderMock = $this->getMock( \Magento\Framework\Code\Reader\ArgumentsReader::class, [], [], '', false ); - $this->sourceArgumentsReaderMock = $this->getMock( + $this->sourceArgumentsReaderMock = $this->getMock( \Magento\Framework\Code\Reader\SourceArgumentsReader::class, [], [], @@ -74,5 +72,3 @@ public function testValidateWithException() $this->assertTrue($this->model->validate($className)); } } - - diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ContextAggregationTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ContextAggregationTest.php index 53ce41bdef761..bdcea87670e73 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ContextAggregationTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ContextAggregationTest.php @@ -51,7 +51,7 @@ public function testClassArgumentWithAlreadyInjectedInterface() $message = 'Incorrect dependency in class ClassArgumentWithAlreadyInjectedInterface in ' . $this->_fixturePath . PHP_EOL . - '\\InterfaceFirst already exists in context object'; + '\\ThirdInterface already exists in context object'; $this->setExpectedException(\Magento\Framework\Exception\ValidatorException::class, $message); $this->_model->validate('ClassArgumentWithAlreadyInjectedInterface'); 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 32c3a7d674f17..4a4a3f244d3c6 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 698b16992bbfe..14101213125e9 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 27a677e7fe71e..27113dec39edb 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 1542747bc231a..ea290232ee261 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 b059686b3e119..e6bf1e9683c99 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; @@ -44,5 +42,4 @@ public function testMethod2($data = 'test_default', $flag = true); public function testMethod3(); - } diff --git a/lib/internal/Magento/Framework/Communication/Config/Reader/EnvReader/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Reader/EnvReader/Validator.php index 89275ac50886c..9aedbc14978da 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Reader/EnvReader/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Reader/EnvReader/Validator.php @@ -178,8 +178,7 @@ private function validateTopicResponseHandler($configDataItem) ) ); } - if ( - $this->booleanUtils->toBoolean($configDataItem[ConfigInterface::TOPIC_IS_SYNCHRONOUS]) && + if ($this->booleanUtils->toBoolean($configDataItem[ConfigInterface::TOPIC_IS_SYNCHRONOUS]) && count($configDataItem[ConfigInterface::TOPIC_HANDLERS]) != 1 ) { throw new \LogicException( diff --git a/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php b/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php index 0e2d25c09e783..affd1a13abde8 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php +++ b/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php @@ -133,7 +133,7 @@ protected function extractTopics($config) $serviceMethod[ConfigParser::METHOD_NAME], $handlers ); - } else if ($requestSchema && $responseSchema) { + } elseif ($requestSchema && $responseSchema) { $output[$topicName] = [ Config::TOPIC_NAME => $topicName, Config::TOPIC_IS_SYNCHRONOUS => true, @@ -142,7 +142,7 @@ protected function extractTopics($config) Config::TOPIC_RESPONSE => $responseSchema, Config::TOPIC_HANDLERS => $handlers ]; - } else if ($requestSchema) { + } elseif ($requestSchema) { $output[$topicName] = [ Config::TOPIC_NAME => $topicName, Config::TOPIC_IS_SYNCHRONOUS => false, diff --git a/lib/internal/Magento/Framework/Composer/BufferIoFactory.php b/lib/internal/Magento/Framework/Composer/BufferIoFactory.php index 6d080db55d0cc..2518f90bcbc73 100644 --- a/lib/internal/Magento/Framework/Composer/BufferIoFactory.php +++ b/lib/internal/Magento/Framework/Composer/BufferIoFactory.php @@ -15,7 +15,7 @@ class BufferIoFactory { /** * Creates BufferIO instance - * + * * @return BufferIO */ public function create() diff --git a/lib/internal/Magento/Framework/Config/ConverterInterface.php b/lib/internal/Magento/Framework/Config/ConverterInterface.php index 3ecc1ff70cf8c..287bcbc5635b3 100644 --- a/lib/internal/Magento/Framework/Config/ConverterInterface.php +++ b/lib/internal/Magento/Framework/Config/ConverterInterface.php @@ -5,7 +5,6 @@ */ namespace Magento\Framework\Config; - /** * Config DOM-to-array converter interface. * diff --git a/lib/internal/Magento/Framework/Config/Dom.php b/lib/internal/Magento/Framework/Config/Dom.php index 826b50927a2f3..45afa71eb556c 100644 --- a/lib/internal/Magento/Framework/Config/Dom.php +++ b/lib/internal/Magento/Framework/Config/Dom.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Magento configuration XML DOM utility */ @@ -115,7 +113,7 @@ public function __construct( /** * Retrieve array of xml errors * - * @param $errorFormat + * @param string $errorFormat * @return string[] */ private static function getXmlErrors($errorFormat) @@ -242,7 +240,7 @@ protected function _mergeAttributes($baseNode, $mergeNode) */ protected function _getNodePathByParent(\DOMElement $node, $parentPath) { - $prefix = is_null($this->rootNamespace) ? '' : self::ROOT_NAMESPACE_PREFIX . ':'; + $prefix = $this->rootNamespace === null ? '' : self::ROOT_NAMESPACE_PREFIX . ':'; $path = $parentPath . '/' . $prefix . $node->tagName; $idAttribute = $this->nodeMergingConfig->getIdAttribute($path); if (is_array($idAttribute)) { @@ -432,7 +430,7 @@ public function setSchemaFile($schemaFile) */ private function _getAttributeName($attribute) { - if (!is_null($attribute->prefix) && !empty($attribute->prefix)) { + if ($attribute->prefix !== null && !empty($attribute->prefix)) { $attributeName = $attribute->prefix . ':' . $attribute->name; } else { $attributeName = $attribute->name; diff --git a/lib/internal/Magento/Framework/Config/Dom/UrnResolver.php b/lib/internal/Magento/Framework/Config/Dom/UrnResolver.php index 808154e95d171..a6679db5e3ce6 100644 --- a/lib/internal/Magento/Framework/Config/Dom/UrnResolver.php +++ b/lib/internal/Magento/Framework/Config/Dom/UrnResolver.php @@ -37,7 +37,7 @@ public function getRealPath($schema) //urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd $package = $componentRegistrar ->getPath(ComponentRegistrar::MODULE, $matches['module']); - } else if (preg_match($frameworkPattern, $schema, $matches)) { + } elseif (preg_match($frameworkPattern, $schema, $matches)) { //urn:magento:framework:Module/etc/module.xsd //urn:magento:framework-amqp:Module/etc/module.xsd $package = $componentRegistrar diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php index 0fdbbf22e54ca..1369cad90236e 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Config\Test\Unit\Composer; use \Magento\Framework\Config\Composer\Package; diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php index 5c58310e096bb..d9b556567a66c 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php @@ -4,16 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Config\Test\Unit; class DataTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Framework\Config\ReaderInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $reader; + /** @var \Magento\Framework\Config\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $cache; + /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ protected $objectManagerHelper; @@ -36,7 +36,9 @@ public function testGet() $this->reader->expects($this->once())->method('read')->will($this->returnValue($data)); $config = new \Magento\Framework\Config\Data( - $this->reader, $this->cache, $cacheid + $this->reader, + $this->cache, + $cacheid ); $this->assertEquals($data, $config->get()); $this->assertEquals('b', $config->get('a')); diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php index ba102c00027b5..03d3010ad035b 100644 --- a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php +++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Controller\Test\Unit\Result; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; diff --git a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php index dc45ea75e0eb8..d717c919d3b3d 100644 --- a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php +++ b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Css\Test\Unit\PreProcessor\Instruction; use Magento\Framework\Css\PreProcessor\FileGenerator\RelatedGenerator; @@ -38,9 +36,12 @@ class ImportTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->notationResolver = $this->getMock( - \Magento\Framework\View\Asset\NotationResolver\Module::class, [], [], '', false + \Magento\Framework\View\Asset\NotationResolver\Module::class, + [], + [], + '', + false ); $this->asset = $this->getMock(\Magento\Framework\View\Asset\File::class, [], [], '', false); $this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css')); diff --git a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php index 9bc04c8ff33e9..2937e0e348afe 100644 --- a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php +++ b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Css\Test\Unit\PreProcessor\Instruction; use Magento\Framework\Css\PreProcessor\Instruction\MagentoImport; @@ -181,7 +179,10 @@ public function testProcessNoImport() public function testProcessException() { $chain = new \Magento\Framework\View\Asset\PreProcessor\Chain( - $this->asset, '//@magento_import "some/file.css";', 'css', 'path' + $this->asset, + '//@magento_import "some/file.css";', + 'css', + 'path' ); $exception = new \LogicException('Error happened'); $this->assetRepo->expects($this->once()) diff --git a/lib/internal/Magento/Framework/CurrencyFactory.php b/lib/internal/Magento/Framework/CurrencyFactory.php index 75313af3d289b..8ee2ebbd48d7e 100644 --- a/lib/internal/Magento/Framework/CurrencyFactory.php +++ b/lib/internal/Magento/Framework/CurrencyFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework; class CurrencyFactory @@ -24,8 +22,10 @@ class CurrencyFactory * @param ObjectManagerInterface $objectManager * @param string $instanceName */ - public function __construct(ObjectManagerInterface $objectManager, $instanceName = CurrencyInterface::class) - { + public function __construct( + ObjectManagerInterface $objectManager, + $instanceName = CurrencyInterface::class + ) { $this->_objectManager = $objectManager; $this->_instanceName = $instanceName; } diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 9af29ab2c458d..7d9b32bd8358e 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\DB\Adapter\Pdo; use Magento\Framework\Cache\FrontendInterface; @@ -29,6 +27,7 @@ use Magento\Framework\Stdlib\StringUtils; use Magento\Framework\DB\Query\Generator as QueryGenerator; +// @codingStandardsIgnoreStart /** * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.TooManyFields) @@ -37,6 +36,8 @@ */ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface { + // @codingStandardsIgnoreEnd + const TIMESTAMP_FORMAT = 'Y-m-d H:i:s'; const DATETIME_FORMAT = 'Y-m-d H:i:s'; const DATE_FORMAT = 'Y-m-d'; @@ -506,7 +507,9 @@ protected function _query($sql, $bind = []) $pdoException = null; if ($e instanceof \PDOException) { $pdoException = $e; - } elseif (($e instanceof \Zend_Db_Statement_Exception) && ($e->getPrevious() instanceof \PDOException)) { + } elseif (($e instanceof \Zend_Db_Statement_Exception) + && ($e->getPrevious() instanceof \PDOException) + ) { $pdoException = $e->getPrevious(); } @@ -536,7 +539,6 @@ protected function _query($sql, $bind = []) } while ($retry); } - /** * Special handling for PDO query(). * All bind parameter names must begin with ':'. @@ -736,7 +738,6 @@ public function setQueryHook($hook) * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) - * @deprecated */ protected function _splitMultiQuery($sql) @@ -1387,7 +1388,7 @@ protected function _removeDuplicateEntry($table, $fields, $ids) */ public function select() { -// return new Select($this); + // return new Select($this); return $this->selectFactory->create($this); } @@ -1628,9 +1629,7 @@ public function getColumnCreateByDescribe($columnData) if ($columnData['PRIMARY'] === true) { $options['primary'] = true; } - if (!is_null($columnData['DEFAULT']) - && $type != Table::TYPE_TEXT - ) { + if ($columnData['DEFAULT'] !== null && $type != Table::TYPE_TEXT) { $options['default'] = $this->quote($columnData['DEFAULT']); } if (strlen($columnData['SCALE']) > 0) { @@ -1735,7 +1734,7 @@ public function modifyColumnByDdl($tableName, $columnName, $definition, $flushDa { $definition = array_change_key_case($definition, CASE_UPPER); $definition['COLUMN_TYPE'] = $this->_getColumnTypeByDdl($definition); - if (array_key_exists('DEFAULT', $definition) && is_null($definition['DEFAULT'])) { + if (array_key_exists('DEFAULT', $definition) && $definition['DEFAULT'] === null) { unset($definition['DEFAULT']); } @@ -2424,7 +2423,7 @@ protected function _getColumnDefinition($options, $ddlType = null) } else { $cDefault = false; } - } elseif (is_null($cDefault) && $cNullable) { + } elseif ($cDefault === null && $cNullable) { $cDefault = new \Zend_Db_Expr('NULL'); } @@ -2920,7 +2919,7 @@ public function prepareColumnValue(array $column, $value) } // return null - if (is_null($value) && $column['NULLABLE']) { + if ($value === null && $column['NULLABLE']) { return null; } @@ -3185,7 +3184,7 @@ public function getDatePartSql($date) */ public function getSubstringSql($stringExpression, $pos, $len = null) { - if (is_null($len)) { + if ($len === null) { return new \Zend_Db_Expr(sprintf('SUBSTRING(%s, %s)', $stringExpression, $pos)); } return new \Zend_Db_Expr(sprintf('SUBSTRING(%s, %s, %s)', $stringExpression, $pos, $len)); @@ -3810,7 +3809,7 @@ public function __destruct() */ public function getTables($likeCondition = null) { - $sql = is_null($likeCondition) ? 'SHOW TABLES' : sprintf("SHOW TABLES LIKE '%s'", $likeCondition); + $sql = $likeCondition === null ? 'SHOW TABLES' : sprintf("SHOW TABLES LIKE '%s'", $likeCondition); $result = $this->query($sql); $tables = []; while ($row = $result->fetchColumn()) { diff --git a/lib/internal/Magento/Framework/DB/MapperFactory.php b/lib/internal/Magento/Framework/DB/MapperFactory.php index c387c9d73ce38..7a870f7b71f68 100644 --- a/lib/internal/Magento/Framework/DB/MapperFactory.php +++ b/lib/internal/Magento/Framework/DB/MapperFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\DB; /** diff --git a/lib/internal/Magento/Framework/DB/QueryFactory.php b/lib/internal/Magento/Framework/DB/QueryFactory.php index 8783a92ab10d3..ff6265a2a6aa3 100644 --- a/lib/internal/Magento/Framework/DB/QueryFactory.php +++ b/lib/internal/Magento/Framework/DB/QueryFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\DB; /** diff --git a/lib/internal/Magento/Framework/DB/Statement/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Statement/Pdo/Mysql.php index 822694b4a2a4a..390404232d1f3 100644 --- a/lib/internal/Magento/Framework/DB/Statement/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Statement/Pdo/Mysql.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Mysql DB Statement * @@ -15,8 +13,11 @@ use Magento\Framework\DB\Statement\Parameter; +// @codingStandardsIgnoreStart class Mysql extends \Zend_Db_Statement_Pdo { + // @codingStandardsIgnoreEnd + /** * Executes statement with binding values to it. * Allows transferring specific options to DB driver. diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/AbstractMapperTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/AbstractMapperTest.php index c01121595f795..efcc5c81785b4 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/AbstractMapperTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/AbstractMapperTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\DB\Test\Unit; use Magento\Framework\DB\Select; @@ -247,8 +245,10 @@ public function testAddFieldToFilter($field, $condition) ->will($this->returnValue($resultCondition)); if (is_array($field)) { - $resultCondition = '(' . implode(') ' . \Magento\Framework\DB\Select::SQL_OR - . ' (', array_fill(0, count($field), $resultCondition)) . ')'; + $resultCondition = '(' . implode( + ') ' . \Magento\Framework\DB\Select::SQL_OR . ' (', + array_fill(0, count($field), $resultCondition) + ) . ')'; } $this->selectMock->expects($this->once()) diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php index 565548de0a26f..f9d8ae7165eea 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * \Magento\Framework\DB\Adapter\Pdo\Mysql class test */ @@ -17,6 +15,11 @@ use Magento\Framework\Model\ResourceModel\Type\Db\Pdo\Mysql; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +/** + * Mysql test + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class MysqlTest extends \PHPUnit_Framework_TestCase { /** @@ -54,13 +57,8 @@ protected function setUp() $selectFactory = $this->getMockBuilder(\Magento\Framework\DB\SelectFactory::class) ->disableOriginalConstructor() ->getMock(); - -// StringUtils $string, -// DateTime $dateTime, -// LoggerInterface $logger, -// SelectFactory $selectFactory, -// array $config = [] - $this->_mockAdapter = $this->getMock( + + $this->_mockAdapter = $this->getMock( \Magento\Framework\DB\Adapter\Pdo\Mysql::class, ['beginTransaction', 'getTransactionLevel'], [ @@ -82,7 +80,7 @@ protected function setUp() ->method('getTransactionLevel') ->will($this->returnValue(1)); - $this->_adapter = $this->getMock( + $this->_adapter = $this->getMock( \Magento\Framework\DB\Adapter\Pdo\Mysql::class, [ 'getCreateTable', @@ -108,7 +106,7 @@ protected function setUp() true ); - $profiler = $this->getMock( + $profiler = $this->getMock( \Zend_Db_Profiler::class ); @@ -468,9 +466,12 @@ public function testInsertOnDuplicateWithQuotedColumnName() */ public function testAddColumn($options, $expectedQuery) { - $connectionMock = $this->getMock( + $connectionMock = $this->getMock( \Magento\Framework\DB\Adapter\Pdo\Mysql::class, - ['tableColumnExists', '_getTableName', 'rawQuery', 'resetDdlCache', 'quote'], [], '', false + ['tableColumnExists', '_getTableName', 'rawQuery', 'resetDdlCache', 'quote'], + [], + '', + false ); $connectionMock->expects($this->any())->method('_getTableName')->will($this->returnArgument(0)); diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/ExpressionConverterTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/ExpressionConverterTest.php index f8f94d8e49493..ffb9c64142ce6 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/ExpressionConverterTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/ExpressionConverterTest.php @@ -6,7 +6,6 @@ namespace Magento\Framework\DB\Test\Unit; - use Magento\Framework\DB\ExpressionConverter; class ExpressionConverterTest extends \PHPUnit_Framework_TestCase diff --git a/lib/internal/Magento/Framework/Data/AbstractSearchResult.php b/lib/internal/Magento/Framework/Data/AbstractSearchResult.php index 3323bf0315ee2..3fca8a6575a5e 100644 --- a/lib/internal/Magento/Framework/Data/AbstractSearchResult.php +++ b/lib/internal/Magento/Framework/Data/AbstractSearchResult.php @@ -5,7 +5,6 @@ */ namespace Magento\Framework\Data; - /** * Class AbstractSearchResult */ diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php index c4e6797242e19..298c456d7ecdc 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Data\Form\Element; use Magento\Framework\Escaper; @@ -123,7 +121,15 @@ public function getElementHtml() ' '; + $html .= ''; } $html .= ''; diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Radios.php b/lib/internal/Magento/Framework/Data/Form/Element/Radios.php index b35309ecf2ae0..c1e7ebb3356e0 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Radios.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Radios.php @@ -110,6 +110,5 @@ protected function getRadioButtonAttributes($option) } } return $html; - } } diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Time.php b/lib/internal/Magento/Framework/Data/Form/Element/Time.php index fe23e73b1352e..ed40ad84ec125 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Time.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Time.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Form time element * @@ -54,16 +52,16 @@ public function getElementHtml() { $this->addClass('select admin__control-select'); - $value_hrs = 0; - $value_min = 0; - $value_sec = 0; + $valueHrs = 0; + $valueMin = 0; + $valueSec = 0; if ($value = $this->getValue()) { $values = explode(',', $value); if (is_array($values) && count($values) == 3) { - $value_hrs = $values[0]; - $value_min = $values[1]; - $value_sec = $values[2]; + $valueHrs = $values[0]; + $valueMin = $values[1]; + $valueSec = $values[2]; } } @@ -75,7 +73,7 @@ public function getElementHtml() ) . '>' . "\n"; for ($i = 0; $i < 24; $i++) { $hour = str_pad($i, 2, '0', STR_PAD_LEFT); - $html .= ''; } $html .= '' . "\n"; @@ -87,7 +85,7 @@ public function getElementHtml() ) . '>' . "\n"; for ($i = 0; $i < 60; $i++) { $hour = str_pad($i, 2, '0', STR_PAD_LEFT); - $html .= ''; } $html .= '' . "\n"; @@ -99,7 +97,7 @@ public function getElementHtml() ) . '>' . "\n"; for ($i = 0; $i < 60; $i++) { $hour = str_pad($i, 2, '0', STR_PAD_LEFT); - $html .= ''; } $html .= '' . "\n"; diff --git a/lib/internal/Magento/Framework/Data/FormFactory.php b/lib/internal/Magento/Framework/Data/FormFactory.php index 6602b2b609d85..84a47672ef401 100644 --- a/lib/internal/Magento/Framework/Data/FormFactory.php +++ b/lib/internal/Magento/Framework/Data/FormFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Data; /** @@ -54,7 +52,10 @@ public function create(array $data = []) $form = $this->_objectManager->create($this->_instanceName, $data); if (!$form instanceof \Magento\Framework\Data\Form) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('%1 doesn\'t extend \Magento\Framework\Data\Form', [$this->_instanceName]) + new \Magento\Framework\Phrase( + '%1 doesn\'t extend \Magento\Framework\Data\Form', + [$this->_instanceName] + ) ); } return $form; diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php index 09f4c08628e1d..258433dab0e6c 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Data\Test\Unit\Collection; /** @@ -44,10 +42,18 @@ protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->fetchStrategyMock = $this->getMock( - \Magento\Framework\Data\Collection\Db\FetchStrategy\Query::class, ['fetchAll'], [], '', false + \Magento\Framework\Data\Collection\Db\FetchStrategy\Query::class, + ['fetchAll'], + [], + '', + false ); $this->entityFactoryMock = $this->getMock( - \Magento\Framework\Data\Collection\EntityFactory::class, ['create'], [], '', false + \Magento\Framework\Data\Collection\EntityFactory::class, + ['create'], + [], + '', + false ); $this->loggerMock = $this->getMock(\Psr\Log\LoggerInterface::class); $this->collection = new \Magento\Framework\Data\Test\Unit\Collection\DbCollection( @@ -375,7 +381,11 @@ public function testFetchItem() $adapterMock = $this->getMock( \Magento\Framework\DB\Adapter\Pdo\Mysql::class, - ['select', 'query'], [], '', false); + ['select', 'query'], + [], + '', + false + ); $selectMock = $this->getMock( \Magento\Framework\DB\Select::class, [], @@ -558,7 +568,11 @@ public function testToOptionHash() $data = [10 => 'test']; $adapterMock = $this->getMock( \Magento\Framework\DB\Adapter\Pdo\Mysql::class, - ['select', 'query'], [], '', false); + ['select', 'query'], + [], + '', + false + ); $selectMock = $this->getMock( \Magento\Framework\DB\Select::class, [], diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php index a6cdfd23c50e0..de0f9d256c3e8 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Tests for \Magento\Framework\Data\Form\Element\AbstractElement */ @@ -36,19 +34,29 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_factoryMock = $this->getMock( - \Magento\Framework\Data\Form\Element\Factory::class, [], [], '', false + \Magento\Framework\Data\Form\Element\Factory::class, + [], + [], + '', + false ); $this->_collectionFactoryMock = $this->getMock( - \Magento\Framework\Data\Form\Element\CollectionFactory::class, [], [], '', false + \Magento\Framework\Data\Form\Element\CollectionFactory::class, + [], + [], + '', + false ); $this->_escaperMock = $this->getMock(\Magento\Framework\Escaper::class, [], [], '', false); $this->_model = $this->getMockForAbstractClass( - \Magento\Framework\Data\Form\Element\AbstractElement::class, [ + \Magento\Framework\Data\Form\Element\AbstractElement::class, + [ $this->_factoryMock, $this->_collectionFactoryMock, $this->_escaperMock - ]); + ] + ); } /** @@ -58,7 +66,13 @@ public function testAddElement() { $elementId = 11; $elementMock = $this->getMockForAbstractClass( - \Magento\Framework\Data\Form\Element\AbstractElement::class, [], '', false, true, true, ['getId'] + \Magento\Framework\Data\Form\Element\AbstractElement::class, + [], + '', + false, + true, + true, + ['getId'] ); $elementMock->expects($this->once()) ->method('getId') @@ -98,7 +112,11 @@ public function testGetHtmlId() $htmlId = 'some_id'; $formMock = $this->getMock( - \Magento\Framework\Data\Form\AbstractForm::class, ['getHtmlIdPrefix', 'getHtmlIdSuffix'], [], '', false + \Magento\Framework\Data\Form\AbstractForm::class, + ['getHtmlIdPrefix', 'getHtmlIdSuffix'], + [], + '', + false ); $formMock->expects($this->any()) ->method('getHtmlIdPrefix') @@ -168,14 +186,22 @@ public function testRemoveField() $elementId = 'element_id'; $formMock = $this->getMock( - \Magento\Framework\Data\Form\AbstractForm::class, ['removeField'], [], '', false + \Magento\Framework\Data\Form\AbstractForm::class, + ['removeField'], + [], + '', + false ); $formMock->expects($this->once()) ->method('removeField') ->with($elementId); $collectionMock = $this->getMock( - \Magento\Framework\Data\Form\Element\Collection::class, ['remove'], [], '', false + \Magento\Framework\Data\Form\Element\Collection::class, + ['remove'], + [], + '', + false ); $collectionMock->expects($this->once()) ->method('remove') @@ -250,7 +276,8 @@ public function testGetEscapedValueWithoutFilter() { $this->_model->setValue('my \'quoted\' string'); $this->assertEquals( - '<a href="#hash_tag">my \'quoted\' string</a>', $this->_model->getEscapedValue() + '<a href="#hash_tag">my \'quoted\' string</a>', + $this->_model->getEscapedValue() ); } @@ -329,8 +356,10 @@ public function testGetHtmlWithoutRenderer() $this->_model->setForm( $this->getMock(\Magento\Framework\Data\Form\AbstractForm::class, [], [], '', false) ); - $expectedHtml = '
' . "\n" - . '
' . "\n"; + $expectedHtml = '
' + . "\n" + . '
' + . "\n"; $this->assertEquals($expectedHtml, $this->_model->getHtml()); $this->assertEquals(' required-entry _required', $this->_model->getClass()); @@ -407,7 +436,11 @@ public function testGetHtmlContainerIdWithFieldContainerIdPrefix() $id = 'id'; $prefix = 'prefix_'; $formMock = $this->getMock( - \Magento\Framework\Data\Form\AbstractForm::class, ['getFieldContainerIdPrefix'], [], '', false + \Magento\Framework\Data\Form\AbstractForm::class, + ['getFieldContainerIdPrefix'], + [], + '', + false ); $formMock->expects($this->once()) ->method('getFieldContainerIdPrefix') diff --git a/lib/internal/Magento/Framework/DataObject/Copy.php b/lib/internal/Magento/Framework/DataObject/Copy.php index 18b92dc2e15b6..3de2d176089f1 100644 --- a/lib/internal/Magento/Framework/DataObject/Copy.php +++ b/lib/internal/Magento/Framework/DataObject/Copy.php @@ -214,9 +214,9 @@ protected function _setFieldsetFieldValue($target, $targetCode, $value) if ($targetIsArray) { $target[$targetCode] = $value; - } else if ($target instanceof \Magento\Framework\DataObject) { + } elseif ($target instanceof \Magento\Framework\DataObject) { $target->setDataUsingMethod($targetCode, $value); - } else if ($target instanceof \Magento\Framework\Api\ExtensibleDataInterface) { + } elseif ($target instanceof \Magento\Framework\Api\ExtensibleDataInterface) { $this->setAttributeValueFromExtensibleDataObject($target, $targetCode, $value); } elseif ($target instanceof \Magento\Framework\Api\AbstractSimpleObject) { $target->setData($targetCode, $value); diff --git a/lib/internal/Magento/Framework/Encryption/Crypt.php b/lib/internal/Magento/Framework/Encryption/Crypt.php index 98fcb40757802..8ccc77dd60d39 100644 --- a/lib/internal/Magento/Framework/Encryption/Crypt.php +++ b/lib/internal/Magento/Framework/Encryption/Crypt.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Encryption; /** @@ -47,8 +45,12 @@ class Crypt * FALSE fills initial vector with zero bytes to not use it. * @throws \Exception */ - public function __construct($key, $cipher = MCRYPT_BLOWFISH, $mode = MCRYPT_MODE_ECB, $initVector = false) - { + public function __construct( + $key, + $cipher = MCRYPT_BLOWFISH, + $mode = MCRYPT_MODE_ECB, + $initVector = false + ) { $this->_cipher = $cipher; $this->_mode = $mode; $this->_handle = mcrypt_module_open($cipher, '', $mode, ''); @@ -72,7 +74,10 @@ public function __construct($key, $cipher = MCRYPT_BLOWFISH, $mode = MCRYPT_MODE $initVector = str_repeat("\0", $initVectorSize); } elseif (!is_string($initVector) || strlen($initVector) != $initVectorSize) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Init vector must be a string of %1 bytes.', [$initVectorSize]) + new \Magento\Framework\Phrase( + 'Init vector must be a string of %1 bytes.', + [$initVectorSize] + ) ); } $this->_initVector = $initVector; diff --git a/lib/internal/Magento/Framework/Encryption/Helper/Security.php b/lib/internal/Magento/Framework/Encryption/Helper/Security.php index eea9e8d378233..b3bd46f8e8b99 100644 --- a/lib/internal/Magento/Framework/Encryption/Helper/Security.php +++ b/lib/internal/Magento/Framework/Encryption/Helper/Security.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Encryption\Helper; use Zend\Crypt\Utils; diff --git a/lib/internal/Magento/Framework/EntityManager/CallbackHandler.php b/lib/internal/Magento/Framework/EntityManager/CallbackHandler.php index 4f24b32844b8f..4af3228c4780d 100644 --- a/lib/internal/Magento/Framework/EntityManager/CallbackHandler.php +++ b/lib/internal/Magento/Framework/EntityManager/CallbackHandler.php @@ -58,7 +58,6 @@ public function process($entityType) $this->logger->error($e->getMessage(), $e->getTrace()); throw $e; } - } } diff --git a/lib/internal/Magento/Framework/EntityManager/MetadataPool.php b/lib/internal/Magento/Framework/EntityManager/MetadataPool.php index cf5c7383aad7c..0e22e2a6f2fc6 100644 --- a/lib/internal/Magento/Framework/EntityManager/MetadataPool.php +++ b/lib/internal/Magento/Framework/EntityManager/MetadataPool.php @@ -90,7 +90,6 @@ public function getMetadata($entityType) throw new \Exception(sprintf('Unknown entity type: %s requested', $entityType)); } if (!isset($this->registry[$entityType])) { - $this->registry[$entityType] = $this->createMetadata($entityType); } return $this->registry[$entityType]; diff --git a/lib/internal/Magento/Framework/Event/Invoker/InvokerDefault.php b/lib/internal/Magento/Framework/Event/Invoker/InvokerDefault.php index 20743df52198a..1f72f6fc84a28 100644 --- a/lib/internal/Magento/Framework/Event/Invoker/InvokerDefault.php +++ b/lib/internal/Magento/Framework/Event/Invoker/InvokerDefault.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Event\Invoker; use Magento\Framework\Event\Observer; @@ -33,8 +31,10 @@ class InvokerDefault implements \Magento\Framework\Event\InvokerInterface * @param \Magento\Framework\Event\ObserverFactory $observerFactory * @param \Magento\Framework\App\State $appState */ - public function __construct(\Magento\Framework\Event\ObserverFactory $observerFactory, \Magento\Framework\App\State $appState) - { + public function __construct( + \Magento\Framework\Event\ObserverFactory $observerFactory, + \Magento\Framework\App\State $appState + ) { $this->_observerFactory = $observerFactory; $this->_appState = $appState; } @@ -75,7 +75,8 @@ protected function _callObserverMethod($object, $observer) throw new \LogicException( sprintf( 'Observer "%s" must implement interface "%s"', - get_class($object), \Magento\Framework\Event\ObserverInterface::class + get_class($object), + \Magento\Framework\Event\ObserverInterface::class ) ); } diff --git a/lib/internal/Magento/Framework/File/Csv.php b/lib/internal/Magento/Framework/File/Csv.php index 1e8050c04a60e..a0a2822272bec 100644 --- a/lib/internal/Magento/Framework/File/Csv.php +++ b/lib/internal/Magento/Framework/File/Csv.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\File; use Magento\Framework\Filesystem\Driver\File; diff --git a/lib/internal/Magento/Framework/File/CsvMulty.php b/lib/internal/Magento/Framework/File/CsvMulty.php index eb0c65656bc80..2308bd8d632e1 100644 --- a/lib/internal/Magento/Framework/File/CsvMulty.php +++ b/lib/internal/Magento/Framework/File/CsvMulty.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Csv parse * @@ -27,25 +25,23 @@ public function getDataPairs($file, $keyIndex = 0, $valueIndex = 1) { $data = []; $csvData = $this->getData($file); - $line_number = 0; + $lineNumber = 0; foreach ($csvData as $rowData) { - $line_number++; + $lineNumber++; if (isset($rowData[$keyIndex])) { if (isset($data[$rowData[$keyIndex]])) { if (isset($data[$rowData[$keyIndex]]['duplicate'])) { - #array_push($data[$rowData[$keyIndex]]['duplicate'],array('line' => $line_number,'value' => isset($rowData[$valueIndex]) ? $rowData[$valueIndex] : null)); - $data[$rowData[$keyIndex]]['duplicate']['line'] .= ', ' . $line_number; + $data[$rowData[$keyIndex]]['duplicate']['line'] .= ', ' . $lineNumber; } else { - $tmp_value = $data[$rowData[$keyIndex]]['value']; - $tmp_line = $data[$rowData[$keyIndex]]['line']; + $tmpValue = $data[$rowData[$keyIndex]]['value']; + $tmpLine = $data[$rowData[$keyIndex]]['line']; $data[$rowData[$keyIndex]]['duplicate'] = []; - #array_push($data[$rowData[$keyIndex]]['duplicate'],array('line' => $tmp_line.' ,'.$line_number,'value' => $tmp_value)); - $data[$rowData[$keyIndex]]['duplicate']['line'] = $tmp_line . ' ,' . $line_number; - $data[$rowData[$keyIndex]]['duplicate']['value'] = $tmp_value; + $data[$rowData[$keyIndex]]['duplicate']['line'] = $tmpLine . ' ,' . $lineNumber; + $data[$rowData[$keyIndex]]['duplicate']['value'] = $tmpValue; } } else { $data[$rowData[$keyIndex]] = []; - $data[$rowData[$keyIndex]]['line'] = $line_number; + $data[$rowData[$keyIndex]]['line'] = $lineNumber; $data[$rowData[$keyIndex]]['value'] = isset($rowData[$valueIndex]) ? $rowData[$valueIndex] : null; } } diff --git a/lib/internal/Magento/Framework/File/Test/Unit/CsvTest.php b/lib/internal/Magento/Framework/File/Test/Unit/CsvTest.php index 609be97a8ec77..e8081a17c1885 100644 --- a/lib/internal/Magento/Framework/File/Test/Unit/CsvTest.php +++ b/lib/internal/Magento/Framework/File/Test/Unit/CsvTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\File\Test\Unit; use Magento\Framework\Filesystem\Driver\File; diff --git a/lib/internal/Magento/Framework/File/Transfer/Adapter/Http.php b/lib/internal/Magento/Framework/File/Transfer/Adapter/Http.php index 7404cf50fdd0a..863492196debb 100644 --- a/lib/internal/Magento/Framework/File/Transfer/Adapter/Http.php +++ b/lib/internal/Magento/Framework/File/Transfer/Adapter/Http.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\File\Transfer\Adapter; class Http @@ -21,11 +19,13 @@ class Http private $mime; /** - * @param \Magento\Framework\App\Response\Http + * @param \Magento\Framework\App\Response\Http $response * @param \Magento\Framework\File\Mime $mime */ - public function __construct(\Magento\Framework\HTTP\PhpEnvironment\Response $response, \Magento\Framework\File\Mime $mime) - { + public function __construct( + \Magento\Framework\HTTP\PhpEnvironment\Response $response, + \Magento\Framework\File\Mime $mime + ) { $this->response = $response; $this->mime = $mime; } diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/Read.php b/lib/internal/Magento/Framework/Filesystem/Directory/Read.php index be1c5afe101de..311c6c43f1ed0 100644 --- a/lib/internal/Magento/Framework/Filesystem/Directory/Read.php +++ b/lib/internal/Magento/Framework/Filesystem/Directory/Read.php @@ -205,7 +205,6 @@ public function readFile($path, $flag = null, $context = null) { $absolutePath = $this->driver->getAbsolutePath($this->path, $path); return $this->driver->fileGetContents($absolutePath, $flag, $context); - } /** diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php index 30bed420be66c..c5580461f8990 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Filesystem\Io; /** @@ -48,7 +46,9 @@ public function open(array $args = []) } $this->_connection = new \phpseclib\Net\SFTP($host, $port, $args['timeout']); if (!$this->_connection->login($args['username'], $args['password'])) { - throw new \Exception(sprintf("Unable to open SFTP connection as %s@%s", $args['username'], $args['host'])); + throw new \Exception( + sprintf("Unable to open SFTP connection as %s@%s", $args['username'], $args['host']) + ); } } @@ -79,15 +79,15 @@ public function close() public function mkdir($dir, $mode = 0777, $recursive = true) { if ($recursive) { - $no_errors = true; + $noErrors = true; $dirList = explode('/', $dir); reset($dirList); $currentWorkingDir = $this->_connection->pwd(); - while ($no_errors && ($dir_item = next($dirList))) { - $no_errors = $this->_connection->mkdir($dir_item) && $this->_connection->chdir($dir_item); + while ($noErrors && ($dirItem = next($dirList))) { + $noErrors = $this->_connection->mkdir($dirItem) && $this->_connection->chdir($dirItem); } $this->_connection->chdir($currentWorkingDir); - return $no_errors; + return $noErrors; } else { return $this->_connection->mkdir($dir); } @@ -105,7 +105,7 @@ public function mkdir($dir, $mode = 0777, $recursive = true) public function rmdir($dir, $recursive = false) { if ($recursive) { - $no_errors = true; + $noErrors = true; $currentWorkingDir = $this->pwd(); if (!$this->_connection->chdir($dir)) { throw new \Exception("chdir(): {$dir}: Not a directory"); @@ -120,18 +120,18 @@ public function rmdir($dir, $recursive = false) if ($this->_connection->chdir($filename)) { // This is a directory $this->_connection->chdir('..'); - $no_errors = $no_errors && $this->rmdir($filename, $recursive); + $noErrors = $noErrors && $this->rmdir($filename, $recursive); } else { - $no_errors = $no_errors && $this->rm($filename); + $noErrors = $noErrors && $this->rm($filename); } } } - $no_errors = $no_errors && ($this->_connection->chdir( + $noErrors = $noErrors && ($this->_connection->chdir( $currentWorkingDir ) && $this->_connection->rmdir( $dir )); - return $no_errors; + return $noErrors; } else { return $this->_connection->rmdir($dir); } @@ -168,7 +168,7 @@ public function cd($dir) */ public function read($filename, $destination = null) { - if (is_null($destination)) { + if ($destination === null) { $destination = false; } return $this->_connection->get($filename, $destination); diff --git a/lib/internal/Magento/Framework/Filesystem/Test/Unit/File/ExcludeFilterTest.php b/lib/internal/Magento/Framework/Filesystem/Test/Unit/File/ExcludeFilterTest.php index 59e02387aa91a..984afb735b134 100644 --- a/lib/internal/Magento/Framework/Filesystem/Test/Unit/File/ExcludeFilterTest.php +++ b/lib/internal/Magento/Framework/Filesystem/Test/Unit/File/ExcludeFilterTest.php @@ -39,7 +39,7 @@ public function testExclusion() $this->assertTrue(!in_array(BP . '/var/session/', $result), 'Filtered path should not be in array'); } - private function getFilesIterator () + private function getFilesIterator() { $files = [ BP . '/var/', diff --git a/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php b/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php index ad4746a36513c..22fc95bf44068 100644 --- a/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php +++ b/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Filter\Input; class MaliciousCode implements \Zend_Filter_Interface @@ -29,7 +27,8 @@ class MaliciousCode implements \Zend_Filter_Interface //js in the style attribute '/style=[^<]*((expression\s*?\([^<]*?\))|(behavior\s*:))[^<]*(?=\/*\>)/Uis', //js attributes - '/(ondblclick|onclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onload|onunload|onerror)=[^<]*(?=\/*\>)/Uis', + '/(ondblclick|onclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|'. + 'onload|onunload|onerror)=[^<]*(?=\/*\>)/Uis', //tags '/<\/?(script|meta|link|frame|iframe|object).*>/Uis', //base64 usage diff --git a/lib/internal/Magento/Framework/Filter/Template.php b/lib/internal/Magento/Framework/Filter/Template.php index 50a2c4e908c0d..dbe1c15e69d42 100644 --- a/lib/internal/Magento/Framework/Filter/Template.php +++ b/lib/internal/Magento/Framework/Filter/Template.php @@ -318,8 +318,7 @@ protected function getVariable($value, $default = '{no_value_defined}') if ($i == 0 && isset($this->templateVars[$stackVars[$i]['name']])) { // Getting of template value $stackVars[$i]['variable'] = & $this->templateVars[$stackVars[$i]['name']]; - } elseif ( - isset($stackVars[$i - 1]['variable']) + } elseif (isset($stackVars[$i - 1]['variable']) && $stackVars[$i - 1]['variable'] instanceof \Magento\Framework\DataObject ) { // If object calling methods or getting properties @@ -333,8 +332,7 @@ protected function getVariable($value, $default = '{no_value_defined}') ); } elseif ($stackVars[$i]['type'] == 'method') { // Calling of object method - if ( - method_exists($stackVars[$i - 1]['variable'], $stackVars[$i]['name']) + if (method_exists($stackVars[$i - 1]['variable'], $stackVars[$i]['name']) || substr($stackVars[$i]['name'], 0, 3) == 'get' ) { $stackVars[$i]['args'] = $this->getStackArgs($stackVars[$i]['args']); diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index 181783c7b2115..0560be9fde9c4 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * HTTP CURL Adapter * @@ -151,6 +149,7 @@ public function connect($host, $port = 80, $secure = false) return $this->_applyConfig(); } + // @codingStandardsIgnoreStart /** * Send request to the remote server * @@ -191,6 +190,7 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ' return $body; } + // @codingStandardsIgnoreEnd /** * Read response from server @@ -234,7 +234,7 @@ public function close() */ protected function _getResource() { - if (is_null($this->_resource)) { + if ($this->_resource === null) { $this->_resource = curl_init(); } return $this->_resource; diff --git a/lib/internal/Magento/Framework/HTTP/Header.php b/lib/internal/Magento/Framework/HTTP/Header.php index e6371fe38c6cd..d21fb244a55a8 100644 --- a/lib/internal/Magento/Framework/HTTP/Header.php +++ b/lib/internal/Magento/Framework/HTTP/Header.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\HTTP; /** @@ -29,8 +27,10 @@ class Header * @param \Magento\Framework\App\RequestInterface $httpRequest * @param \Magento\Framework\Stdlib\StringUtils $converter */ - public function __construct(\Magento\Framework\App\RequestInterface $httpRequest, \Magento\Framework\Stdlib\StringUtils $converter) - { + public function __construct( + \Magento\Framework\App\RequestInterface $httpRequest, + \Magento\Framework\Stdlib\StringUtils $converter + ) { $this->_request = $httpRequest; $this->_converter = $converter; } diff --git a/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Request.php b/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Request.php index 64f8dd4564e65..2c5f76b8f54a5 100644 --- a/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Request.php +++ b/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Request.php @@ -13,6 +13,12 @@ use Zend\Uri\UriFactory; use Zend\Uri\UriInterface; +/** + * HTTP Request + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) + */ class Request extends \Zend\Http\PhpEnvironment\Request { /**#@+ @@ -415,19 +421,18 @@ public function isSecure() return true; } - return $this->initialRequestSecure($this->SslOffloadHeader()); + return $this->initialRequestSecure($this->sslOffloadHeader()); } - /*** + /** * Get value of SSL offload http header from configuration - defaults to X-Forwarded-Proto * * @return string */ - private function SslOffloadHeader() + private function sslOffloadHeader() { // Lets read from db only one time okay. if ($this->sslOffloadHeader === null) { - // @todo: Untangle Config dependence on Scope, so that this class can be instantiated even if app is not // installed MAGETWO-31756 // Check if a proxy sent a header indicating an initial secure request @@ -565,7 +570,6 @@ public function getPostValue($name = null, $default = null) return $post; } - /** * Set POST parameters * @@ -725,7 +729,7 @@ public function getClientIp($checkProxy = true) { if ($checkProxy && $this->getServer('HTTP_CLIENT_IP') != null) { $ip = $this->getServer('HTTP_CLIENT_IP'); - } else if ($checkProxy && $this->getServer('HTTP_X_FORWARDED_FOR') != null) { + } elseif ($checkProxy && $this->getServer('HTTP_X_FORWARDED_FOR') != null) { $ip = $this->getServer('HTTP_X_FORWARDED_FOR'); } else { $ip = $this->getServer('REMOTE_ADDR'); @@ -781,7 +785,6 @@ public function setRequestUri($requestUri = null) return $this; } - /** * Get base url * diff --git a/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php b/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php index f077635122afd..de940cfebb3ba 100644 --- a/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php +++ b/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php @@ -99,7 +99,7 @@ public function clearHeader($name) /** * Remove all headers - * + * * @return $this */ public function clearHeaders() diff --git a/lib/internal/Magento/Framework/Image/Factory.php b/lib/internal/Magento/Framework/Image/Factory.php index 2239d141d2fc2..e80fca8992270 100644 --- a/lib/internal/Magento/Framework/Image/Factory.php +++ b/lib/internal/Magento/Framework/Image/Factory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Image; use Magento\Framework\ObjectManagerInterface; @@ -26,8 +24,10 @@ class Factory * @param ObjectManagerInterface $objectManager * @param AdapterFactory $adapterFactory */ - public function __construct(ObjectManagerInterface $objectManager, AdapterFactory $adapterFactory) - { + public function __construct( + ObjectManagerInterface $objectManager, + AdapterFactory $adapterFactory + ) { $this->objectManager = $objectManager; $this->adapterFactory = $adapterFactory; } @@ -42,7 +42,9 @@ public function __construct(ObjectManagerInterface $objectManager, AdapterFactor public function create($fileName = null, $adapterName = null) { $adapter = $this->adapterFactory->create($adapterName); - return $this->objectManager->create( - \Magento\Framework\Image::class, ['adapter' => $adapter, 'fileName' => $fileName]); + return $this->objectManager->create( + \Magento\Framework\Image::class, + ['adapter' => $adapter, 'fileName' => $fileName] + ); } } diff --git a/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php b/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php index 0c920717bdf38..60379c41a40e7 100644 --- a/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php +++ b/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Interception\Code\Generator; class Interceptor extends \Magento\Framework\Code\Generator\EntityAbstract @@ -159,8 +157,8 @@ protected function _generateCode() } else { $this->_classGenerator->setExtendedClass($typeName); } - $this->_classGenerator->addTrait('\Magento\Framework\Interception\Interceptor'); - $interfaces[] = '\Magento\Framework\Interception\InterceptorInterface'; + $this->_classGenerator->addTrait('\\'. \Magento\Framework\Interception\Interceptor::class); + $interfaces[] = '\\'. \Magento\Framework\Interception\InterceptorInterface::class; $this->_classGenerator->setImplementedInterfaces($interfaces); return parent::_generateCode(); } diff --git a/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Compiled.php b/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Compiled.php index aa1e2ec5535f9..862e6b22b335f 100644 --- a/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Compiled.php +++ b/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Compiled.php @@ -1,7 +1,7 @@ ioObjectMock = $this->getMock(\Magento\Framework\Code\Generator\Io::class, [], [], '', false); - $this->classGeneratorMock = $this->getMock( + $this->classGeneratorMock = $this->getMock( \Magento\Framework\Code\Generator\CodeGeneratorInterface::class, [], [], @@ -35,7 +33,7 @@ protected function setUp() public function testGetDefaultResultClassName() { // resultClassName should be stdClass_Interceptor - $model = $this->getMock( + $model = $this->getMock( \Magento\Framework\Interception\Code\Generator\Interceptor::class, ['_validateData'], [ diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/InterfaceValidatorTest.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/InterfaceValidatorTest.php index a2660a4561fe9..b4a604b06977a 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/InterfaceValidatorTest.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/InterfaceValidatorTest.php @@ -4,11 +4,14 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Interception\Test\Unit\Code; use \Magento\Framework\Interception\Code\InterfaceValidator; +use \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\ValidPlugin; +use \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\IncompatibleInterface; +use \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\IncorrectSubject; +use \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\ExtraParameters; +use \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\InvalidProceed; class InterfaceValidatorTest extends \PHPUnit_Framework_TestCase { @@ -51,7 +54,7 @@ protected function setUp() public function testValidate() { $this->model->validate( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\ValidPlugin::class, + ValidPlugin::class, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments::class ); } @@ -64,20 +67,20 @@ public function testValidate() public function testValidateIncorrectInterface() { $this->model->validate( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\IncompatibleInterface::class, + IncompatibleInterface::class, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item::class ); } /** * @expectedException \Magento\Framework\Exception\ValidatorException - * @expectedExceptionMessage Invalid [\Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item] $subject type + * @expectedExceptionMessage $subject type * @covers \Magento\Framework\Interception\Code\InterfaceValidator::validate */ public function testValidateIncorrectSubjectType() { $this->model->validate( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\IncorrectSubject::class, + IncorrectSubject::class, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item::class ); } @@ -91,8 +94,8 @@ public function testValidateIncorrectSubjectType() public function testValidateIncompatibleMethodArgumentsCount() { $this->model->validate( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model::class - . '\InterfaceValidator\ItemPlugin\IncompatibleArgumentsCount', + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model::class . + '\InterfaceValidator\ItemPlugin\IncompatibleArgumentsCount', \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item::class ); } @@ -106,8 +109,8 @@ public function testValidateIncompatibleMethodArgumentsCount() public function testValidateIncompatibleMethodArgumentsType() { $this->model->validate( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model::class - . '\InterfaceValidator\ItemPlugin\IncompatibleArgumentsType', + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model::class . + '\InterfaceValidator\ItemPlugin\IncompatibleArgumentsType', \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments::class ); } @@ -120,7 +123,7 @@ public function testValidateIncompatibleMethodArgumentsType() public function testValidateExtraParameters() { $this->model->validate( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\ExtraParameters::class, + ExtraParameters::class, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item::class ); } @@ -133,7 +136,7 @@ public function testValidateExtraParameters() public function testValidateInvalidProceed() { $this->model->validate( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin\InvalidProceed::class, + InvalidProceed::class, \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item::class ); } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php index 992ed838b7c52..c5796325e5b89 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php @@ -3,7 +3,7 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + namespace Magento\Framework\Interception\Test\Unit\Config; require_once __DIR__ . '/../Custom/Module/Model/Item.php'; @@ -120,12 +120,15 @@ public function testHasPluginsWhenDataIsNotCached($expectedResult, $type, $entit \Magento\Framework\Interception\Custom\Module\Model\Backslash\ItemProxy::class ], [ - 'virtual_custom_item', \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item::class, + 'virtual_custom_item', + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item::class, ], ] )); $this->definitionMock->expects($this->any())->method('getClasses')->will($this->returnValue( - [\Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy::class, \Magento\Framework\Interception\Custom\Module\Model\Backslash\ItemProxy::class, + [ + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy::class, + \Magento\Framework\Interception\Custom\Module\Model\Backslash\ItemProxy::class, ] )); $this->relationsMock->expects($this->any())->method('has')->will($this->returnValue($expectedResult)); diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/ExtraParameters.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/ExtraParameters.php index 3de967defdbca..9f742188cfe8e 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/ExtraParameters.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/ExtraParameters.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin; class ExtraParameters @@ -19,7 +17,9 @@ class ExtraParameters * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterGetItem( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item $subject, $name, $surname + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item $subject, + $name, + $surname ) { return $name . $surname; } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/IncompatibleArgumentsCount.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/IncompatibleArgumentsCount.php index ac9f606383941..d48dfaa645bc3 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/IncompatibleArgumentsCount.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/IncompatibleArgumentsCount.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin; class IncompatibleArgumentsCount @@ -19,7 +17,9 @@ class IncompatibleArgumentsCount * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeGetItem( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item $subject, $name, $surname + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item $subject, + $name, + $surname ) { return $name . $surname; } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/IncompatibleArgumentsType.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/IncompatibleArgumentsType.php index c971dfeed7620..81e55a433ac24 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/IncompatibleArgumentsType.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/IncompatibleArgumentsType.php @@ -4,21 +4,22 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin; +use \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments; + class IncompatibleArgumentsType { /** - * @param \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments $subject + * @param ItemWithArguments $subject * @param array $names * @return int * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeGetItem( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments $subject, array $names + ItemWithArguments $subject, + array $names ) { return count($names); } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/InvalidProceed.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/InvalidProceed.php index 7244816430882..c5eb2f23a3fd8 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/InvalidProceed.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/InvalidProceed.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin; class InvalidProceed @@ -19,7 +17,9 @@ class InvalidProceed * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundGetItem( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item $subject, $name, $surname + \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\Item $subject, + $name, + $surname ) { return $name . $surname; } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/ValidPlugin.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/ValidPlugin.php index 821b8bdf93de9..3a3d8ea4591b0 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/ValidPlugin.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Custom/Module/Model/InterfaceValidator/ItemPlugin/ValidPlugin.php @@ -4,40 +4,42 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemPlugin; +use \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments; + class ValidPlugin { /** - * @param \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments $subject + * @param ItemWithArguments $subject * @param string $result * @return string * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterGetItem( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments $subject, $result + ItemWithArguments $subject, + $result ) { return $result . '!'; } /** - * @param \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments $subject + * @param ItemWithArguments $subject * @param $name * @return string * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeGetItem( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments $subject, $name + ItemWithArguments $subject, + $name ) { return '|' . $name; } /** - * @param \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments $subject + * @param ItemWithArguments $subject * @param Closure $proceed * @param string $name * @return string @@ -45,7 +47,7 @@ public function beforeGetItem( * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundGetItem( - \Magento\Framework\Interception\Test\Unit\Custom\Module\Model\InterfaceValidator\ItemWithArguments $subject, + ItemWithArguments $subject, \Closure $proceed, $name ) { diff --git a/lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php index 5af8e61b2fc26..d6f63bc470349 100644 --- a/lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Locale\Test\Unit; class ConfigTest extends \PHPUnit_Framework_TestCase @@ -91,7 +89,7 @@ public function testGetAllowedLocalesNoDataArray() public function testGetAllowedLocalesGivenDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject( + ->getObject( \Magento\Framework\Locale\Config::class, [ 'data' => [ @@ -117,7 +115,7 @@ public function testGetAllowedLocalesGivenDataArray() public function testGetAllowedLocalesGivenRedundantDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject( + ->getObject( \Magento\Framework\Locale\Config::class, [ 'data' => [ @@ -159,7 +157,7 @@ public function testGetAllowedCurrenciesNoDataArray() public function testGetAllowedCurrenciesGivenDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject( + ->getObject( \Magento\Framework\Locale\Config::class, [ 'data' => [ @@ -185,7 +183,7 @@ public function testGetAllowedCurrenciesGivenDataArray() public function testGetAllowedCurrenciesGivenRedundantDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject( + ->getObject( \Magento\Framework\Locale\Config::class, [ 'data' => [ diff --git a/lib/internal/Magento/Framework/Locale/Test/Unit/CurrencyTest.php b/lib/internal/Magento/Framework/Locale/Test/Unit/CurrencyTest.php index 5883276fa1fe3..ab65f41ebeaa8 100644 --- a/lib/internal/Magento/Framework/Locale/Test/Unit/CurrencyTest.php +++ b/lib/internal/Magento/Framework/Locale/Test/Unit/CurrencyTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Locale\Test\Unit; use Magento\Framework\Locale\Currency; @@ -58,7 +56,7 @@ protected function setUp() ->getMock(); $this->testCurrencyObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject( + ->getObject( \Magento\Framework\Locale\Currency::class, [ 'eventManager' => $this->mockEventManager, diff --git a/lib/internal/Magento/Framework/Locale/TranslatedLists.php b/lib/internal/Magento/Framework/Locale/TranslatedLists.php index a9724176f198e..2993025e1162e 100644 --- a/lib/internal/Magento/Framework/Locale/TranslatedLists.php +++ b/lib/internal/Magento/Framework/Locale/TranslatedLists.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Locale; use Magento\Framework\Locale\Bundle\CurrencyBundle; @@ -26,6 +24,7 @@ class TranslatedLists implements ListsInterface protected $localeResolver; /** + * @param \Magento\Framework\Locale\ConfigInterface $config * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param string $locale */ @@ -107,10 +106,10 @@ public function getOptionTimezones() foreach ($zones as $code) { $options[] = [ 'label' => \IntlTimeZone::createTimeZone($code)->getDisplayName( - false, - \IntlTimeZone::DISPLAY_LONG, - $locale - ) . ' (' . $code . ')', + false, + \IntlTimeZone::DISPLAY_LONG, + $locale + ) . ' (' . $code . ')', 'value' => $code, ]; } diff --git a/lib/internal/Magento/Framework/Message/Factory.php b/lib/internal/Magento/Framework/Message/Factory.php index 56d010da58521..33ea925ae4768 100644 --- a/lib/internal/Magento/Framework/Message/Factory.php +++ b/lib/internal/Magento/Framework/Message/Factory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Message; use Magento\Framework\ObjectManagerInterface; @@ -63,7 +61,9 @@ public function create($type, $text = null) $message = $this->objectManager->create($className, $text === null ? [] : ['text' => $text]); if (!$message instanceof MessageInterface) { - throw new \InvalidArgumentException($className . ' doesn\'t implement \Magento\Framework\Message\MessageInterface'); + throw new \InvalidArgumentException( + $className . ' doesn\'t implement \Magento\Framework\Message\MessageInterface' + ); } return $message; diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php index 34815c996d163..dd0b104a48ef0 100644 --- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php @@ -184,7 +184,7 @@ public function setData($key, $value = null) { if (is_array($key)) { $key = $this->filterCustomAttributes($key); - } else if ($key == self::CUSTOM_ATTRIBUTES) { + } elseif ($key == self::CUSTOM_ATTRIBUTES) { $filteredData = $this->filterCustomAttributes([self::CUSTOM_ATTRIBUTES => $value]); $value = $filteredData[self::CUSTOM_ATTRIBUTES]; } diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php index 6c82dafb6c44e..f33116af065fd 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php @@ -4,17 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Model\ResourceModel\Db\Collection; -use Magento\Framework\App\ResourceConnection\SourceProviderInterface; + +use \Magento\Framework\App\ResourceConnection\SourceProviderInterface; +use \Magento\Framework\Data\Collection\AbstractDb; /** * Abstract Resource Collection * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class AbstractCollection extends \Magento\Framework\Data\Collection\AbstractDb - implements SourceProviderInterface +abstract class AbstractCollection extends AbstractDb implements SourceProviderInterface { /** * Model name @@ -458,7 +457,9 @@ public function getResourceModelName() public function getResource() { if (empty($this->_resource)) { - $this->_resource = \Magento\Framework\App\ObjectManager::getInstance()->create($this->getResourceModelName()); + $this->_resource = \Magento\Framework\App\ObjectManager::getInstance()->create( + $this->getResourceModelName() + ); } return $this->_resource; } diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/CreateEntityRow.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/CreateEntityRow.php index 27d683b85835a..2303ef7f7622b 100755 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/CreateEntityRow.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/CreateEntityRow.php @@ -36,7 +36,6 @@ protected function prepareData(EntityMetadata $metadata, $data) { $output = []; foreach ($metadata->getEntityConnection()->describeTable($metadata->getEntityTable()) as $column) { - if ($column['DEFAULT'] == 'CURRENT_TIMESTAMP' /*|| $column['IDENTITY']*/) { continue; } diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/UpdateEntityRow.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/UpdateEntityRow.php index e22e19ef0e1b5..c9aea954f7014 100755 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/UpdateEntityRow.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/UpdateEntityRow.php @@ -37,7 +37,6 @@ protected function prepareData(EntityMetadata $metadata, $data) { $output = []; foreach ($metadata->getEntityConnection()->describeTable($metadata->getEntityTable()) as $column) { - if ($column['DEFAULT'] == 'CURRENT_TIMESTAMP' || $column['IDENTITY']) { continue; } diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/Mysql.php b/lib/internal/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/Mysql.php index 8b6a2c23386ff..529e709a158ff 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/Mysql.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Model\ResourceModel\Type\Db\Pdo; use Magento\Framework\App\ResourceConnection\ConnectionAdapterInterface; @@ -13,8 +11,11 @@ use Magento\Framework\DB\SelectFactory; use Magento\Framework\Stdlib; +// @codingStandardsIgnoreStart class Mysql extends \Magento\Framework\Model\ResourceModel\Type\Db implements ConnectionAdapterInterface { + // @codingStandardsIgnoreEnd + /** * @var Stdlib\StringUtils */ @@ -31,7 +32,7 @@ class Mysql extends \Magento\Framework\Model\ResourceModel\Type\Db implements Co protected $connectionConfig; /** - * @var + * @var SelectFactory */ protected $selectFactory; diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php index 13a9ed5be4f92..011463ab56741 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Model\Test\Unit; use Magento\Framework\Api\AttributeValue; diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php index e4748e46ccdb4..1e29abf531c36 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php @@ -6,7 +6,6 @@ namespace Magento\Framework\Model\Test\Unit; - class AbstractModelTest extends \PHPUnit_Framework_TestCase { /** @@ -93,7 +92,6 @@ protected function setUp() $this->resourceMock->expects($this->any()) ->method('getConnection') ->will($this->returnValue($this->connectionMock)); - } public function testDelete() diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/AbstractDbTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/AbstractDbTest.php index d13bcdc539aa8..0539392441b19 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/AbstractDbTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/AbstractDbTest.php @@ -4,9 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Model\Test\Unit\ResourceModel\Db; + use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Adapter\DuplicateException; use Magento\Framework\Model\AbstractModel; @@ -138,7 +137,8 @@ public function testGetIdFieldname() { $data = 'MainTableName'; $idFieldNameProperty = new \ReflectionProperty( - AbstractDb::class, '_idFieldName' + AbstractDb::class, + '_idFieldName' ); $idFieldNameProperty->setAccessible(true); $idFieldNameProperty->setValue($this->_model, $data); @@ -170,8 +170,7 @@ public function testGetMainTable($tableName, $expectedResult) $this->_resourcesMock->expects($this->once()) ->method('getTableName') ->with($expectedResult) - ->will($this->returnValue($expectedResult) - ); + ->will($this->returnValue($expectedResult)); $this->assertEquals($expectedResult, $this->_model->getMainTable()); } @@ -311,8 +310,7 @@ public function testDelete() ); $this->_resourcesMock->expects($this->any()) ->method('getConnection') - ->will($this->returnValue($connectionInterfaceMock) - ); + ->will($this->returnValue($connectionInterfaceMock)); $abstractModelMock->expects($this->once())->method('getData')->willReturn(['data' => 'value']); $connectionMock = $this->getMock(AdapterInterface::class); @@ -415,8 +413,7 @@ public function testGetDataChanged($getOriginData, $expected) $this->_resourcesMock->expects($this->once()) ->method('getTableName') ->with('table') - ->will($this->returnValue('tableName') - ); + ->will($this->returnValue('tableName')); $abstractModelMock->expects($this->at(0))->method('getOrigData')->will($this->returnValue(true)); $abstractModelMock->expects($this->at(1))->method('getOrigData')->will($this->returnValue($getOriginData)); $connectionInterfaceMock->expects($this->any())->method('describeTable')->with('tableName')->will( @@ -433,6 +430,9 @@ public function hasDataChangedDataProvider() ]; } + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function testPrepareDataForUpdate() { $connectionMock = $this->getMock(AdapterInterface::class, [], [], '', false); @@ -472,8 +472,7 @@ public function testPrepareDataForUpdate() $data = 'tableName'; $this->_resourcesMock->expects($this->any()) ->method('getConnection') - ->will($this->returnValue($connectionMock) - ); + ->will($this->returnValue($connectionMock)); $this->_resourcesMock->expects($this->any())->method('getTableName')->with($data)->will( $this->returnValue('tableName') ); @@ -502,7 +501,9 @@ public function testPrepareDataForUpdate() $abstractModelMock->afterLoad(); $this->assertEquals($abstractModelMock->getData(), $abstractModelMock->getStoredData()); $newData = ['value' => 'Test Value New']; - $this->_model->expects($this->atLeastOnce())->method('_prepareDataForTable')->will($this->returnValue($newData)); + $this->_model->expects($this->atLeastOnce()) + ->method('_prepareDataForTable') + ->will($this->returnValue($newData)); $abstractModelMock->addData($newData); $this->assertNotEquals($abstractModelMock->getData(), $abstractModelMock->getStoredData()); $abstractModelMock->isObjectNew(false); @@ -571,8 +572,7 @@ public function testSaveNewObject($pkIncrement) ->willReturn($connectionMock); $idFieldName = 'id_field_name'; - $model->expects($this->once())->method('_prepareDataForSave')->willReturn([$idFieldName => 'id',]); - + $model->expects($this->once())->method('_prepareDataForSave')->willReturn([$idFieldName => 'id']); // Test expectations // Only get object's id field name if not PK autoincrement diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php index d458810732b6b..34fb92fc815f4 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php @@ -4,12 +4,9 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Model\Test\Unit\ResourceModel\Db\Collection; use Magento\Framework\DB\Select; -use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Framework\DataObject as MagentoObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Framework\ObjectManagerInterface; @@ -215,7 +212,11 @@ public function testGetSelect($idFieldNameRet, $getPartRet, $expected) ->method('getPart') ->will($this->returnValue($getPartRet)); - $this->selectMock->expects($this->once())->method('setPart')->with(\Magento\Framework\DB\Select::COLUMNS, $expected); + $this->selectMock + ->expects($this->once()) + ->method('setPart') + ->with(\Magento\Framework\DB\Select::COLUMNS, $expected); + $this->assertTrue($this->uut->getSelect() instanceof Select); } @@ -410,34 +411,3 @@ public function testSave() $this->assertTrue($this->uut->save() instanceof Uut); } } - -/** - * Pattern type: Public Morozov - */ -class Uut extends AbstractCollection -{ - public function wereFieldsToSelectChanged() - { - return $this->_fieldsToSelectChanged; - } - - public function getFieldsToSelect() - { - return $this->_fieldsToSelect; - } - - public function setFieldsToSelect(array $fields) - { - $this->_fieldsToSelect = $fields; - } - - public function setResource($resource) - { - $this->_resource = $resource; - } - - public function getJoinedTables() - { - return $this->_joinedTables; - } -} diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/Uut.php b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/Uut.php new file mode 100644 index 0000000000000..de64f93747cd5 --- /dev/null +++ b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/Uut.php @@ -0,0 +1,40 @@ +_fieldsToSelectChanged; + } + + public function getFieldsToSelect() + { + return $this->_fieldsToSelect; + } + + public function setFieldsToSelect(array $fields) + { + $this->_fieldsToSelect = $fields; + } + + public function setResource($resource) + { + $this->_resource = $resource; + } + + public function getJoinedTables() + { + return $this->_joinedTables; + } +} diff --git a/lib/internal/Magento/Framework/Module/DependencyChecker.php b/lib/internal/Magento/Framework/Module/DependencyChecker.php index 92adbd6fbb7bf..fa2c165a2928a 100644 --- a/lib/internal/Magento/Framework/Module/DependencyChecker.php +++ b/lib/internal/Magento/Framework/Module/DependencyChecker.php @@ -106,7 +106,7 @@ private function checkDependencyGraph($isEnable, $moduleNames, $enabledModules) if (isset($paths[$module])) { if ($isEnable && !in_array($module, $enabledModules)) { $dependenciesMissing[$module] = $paths[$module]; - } else if (!$isEnable && in_array($module, $enabledModules)) { + } elseif (!$isEnable && in_array($module, $enabledModules)) { $dependenciesMissing[$module] = array_reverse($paths[$module]); } } diff --git a/lib/internal/Magento/Framework/Module/ModuleResource.php b/lib/internal/Magento/Framework/Module/ModuleResource.php index 42a14ac74d3ec..acedd79548d67 100644 --- a/lib/internal/Magento/Framework/Module/ModuleResource.php +++ b/lib/internal/Magento/Framework/Module/ModuleResource.php @@ -4,14 +4,14 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Module; +use \Magento\Framework\Model\ResourceModel\Db\AbstractDb; + /** * Resource Model */ -class ModuleResource extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb implements \Magento\Framework\Module\ResourceInterface +class ModuleResource extends AbstractDb implements ResourceInterface { /** * Database versions @@ -49,7 +49,9 @@ protected function _construct() */ protected function _loadVersion($needType) { - if ($needType == 'db' && is_null(self::$schemaVersions) || $needType == 'data' && is_null(self::$dataVersions)) { + if ($needType == 'db' && self::$schemaVersions === null || + $needType == 'data' && self::$dataVersions === null + ) { self::$schemaVersions = []; // Db version column always exists self::$dataVersions = null; @@ -61,7 +63,7 @@ protected function _loadVersion($needType) foreach ($rowset as $row) { self::$schemaVersions[$row['module']] = $row['schema_version']; if (array_key_exists('data_version', $row)) { - if (is_null(self::$dataVersions)) { + if (self::$dataVersions === null) { self::$dataVersions = []; } self::$dataVersions[$row['module']] = $row['data_version']; diff --git a/lib/internal/Magento/Framework/Module/Setup/MigrationFactory.php b/lib/internal/Magento/Framework/Module/Setup/MigrationFactory.php index dd8067278728e..9521ecd905938 100644 --- a/lib/internal/Magento/Framework/Module/Setup/MigrationFactory.php +++ b/lib/internal/Magento/Framework/Module/Setup/MigrationFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Module\Setup; /** diff --git a/lib/internal/Magento/Framework/Module/Status.php b/lib/internal/Magento/Framework/Module/Status.php index 040067b2c8153..4fdc5c5325bda 100644 --- a/lib/internal/Magento/Framework/Module/Status.php +++ b/lib/internal/Magento/Framework/Module/Status.php @@ -81,7 +81,7 @@ public function __construct( * @param string[] $modulesToBeChanged * @param string[] $currentlyEnabledModules * @param bool $prettyMessage - * + * * @return string[] */ public function checkConstraints( diff --git a/lib/internal/Magento/Framework/Mview/ActionFactory.php b/lib/internal/Magento/Framework/Mview/ActionFactory.php index 77b0c89c8cc39..f4fd28bb12693 100644 --- a/lib/internal/Magento/Framework/Mview/ActionFactory.php +++ b/lib/internal/Magento/Framework/Mview/ActionFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mview; class ActionFactory @@ -34,7 +32,9 @@ public function get($className) { $action = $this->objectManager->get($className); if (!$action instanceof ActionInterface) { - throw new \InvalidArgumentException($className . ' doesn\'t implement \Magento\Framework\Mview\ActionInterface'); + throw new \InvalidArgumentException( + $className . ' doesn\'t implement \Magento\Framework\Mview\ActionInterface' + ); } return $action; diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/Config/Data/ProxyTest.php b/lib/internal/Magento/Framework/Mview/Test/Unit/Config/Data/ProxyTest.php index 34ebdcca3f136..907bf9c5039c8 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/Config/Data/ProxyTest.php +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/Config/Data/ProxyTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mview\Test\Unit\Config\Data; use \Magento\Framework\Mview\Config\Data\Proxy; @@ -31,7 +29,11 @@ protected function setUp() { $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); $this->dataMock = $this->getMock( - \Magento\Framework\Mview\Config\Data::class, [], [], '', false + \Magento\Framework\Mview\Config\Data::class, + [], + [], + '', + false ); } @@ -46,7 +48,8 @@ public function testMergeShared() ->with(['some_config']); $this->model = new Proxy( - $this->objectManagerMock, \Magento\Framework\Mview\Config\Data::class, + $this->objectManagerMock, + \Magento\Framework\Mview\Config\Data::class, true ); @@ -64,7 +67,8 @@ public function testMergeNonShared() ->with(['some_config']); $this->model = new Proxy( - $this->objectManagerMock, \Magento\Framework\Mview\Config\Data::class, + $this->objectManagerMock, + \Magento\Framework\Mview\Config\Data::class, false ); @@ -83,7 +87,8 @@ public function testGetShared() ->will($this->returnValue('some_value')); $this->model = new Proxy( - $this->objectManagerMock, \Magento\Framework\Mview\Config\Data::class, + $this->objectManagerMock, + \Magento\Framework\Mview\Config\Data::class, true ); @@ -102,7 +107,8 @@ public function testGetNonShared() ->will($this->returnValue('some_value')); $this->model = new Proxy( - $this->objectManagerMock, \Magento\Framework\Mview\Config\Data::class, + $this->objectManagerMock, + \Magento\Framework\Mview\Config\Data::class, false ); diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Mview/Test/Unit/ConfigTest.php index 52925e4a5a0e2..26105fef93c84 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/ConfigTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mview\Test\Unit; use \Magento\Framework\Mview\Config; @@ -24,8 +22,12 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->dataMock = $this->getMock( - \Magento\Framework\Mview\Config\Data::class, [], [], '', false + $this->dataMock = $this->getMock( + \Magento\Framework\Mview\Config\Data::class, + [], + [], + '', + false ); $this->model = new Config( $this->dataMock diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/View/CollectionTest.php b/lib/internal/Magento/Framework/Mview/Test/Unit/View/CollectionTest.php index d92241871423e..7353353359473 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/View/CollectionTest.php +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/View/CollectionTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mview\Test\Unit\View; class CollectionTest extends \PHPUnit_Framework_TestCase @@ -36,7 +34,12 @@ public function testLoadDataAndGetViewsByStateMode() )->disableOriginalConstructor()->getMock(); $state = $this->getMockForAbstractClass( - \Magento\Framework\Mview\View\StateInterface::class, [], '', false, false, true, + \Magento\Framework\Mview\View\StateInterface::class, + [], + '', + false, + false, + true, ['getViewId', 'getMode', '__wakeup'] ); @@ -51,7 +54,12 @@ public function testLoadDataAndGetViewsByStateMode() ); $view = $this->getMockForAbstractClass( - \Magento\Framework\Mview\ViewInterface::class, [], '', false, false, true, + \Magento\Framework\Mview\ViewInterface::class, + [], + '', + false, + false, + true, ['load', 'setState', 'getState', '__wakeup'] ); diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionFactoryTest.php b/lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionFactoryTest.php index 79d8e8d419e93..7d809825a585b 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionFactoryTest.php +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionFactoryTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mview\Test\Unit\View; use \Magento\Framework\Mview\View\SubscriptionFactory; @@ -31,7 +29,10 @@ protected function setUp() public function testCreate() { $subscriptionInterfaceMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\View\SubscriptionInterface::class, [], '', false + \Magento\Framework\Mview\View\SubscriptionInterface::class, + [], + '', + false ); $this->objectManagerMock->expects($this->once()) ->method('create') diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionTest.php b/lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionTest.php index 2cbf5da0bfbbb..f9b6392662a84 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionTest.php +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mview\Test\Unit\View; use \Magento\Framework\Mview\View\Subscription; @@ -39,7 +37,14 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->connectionMock = $this->getMock(\Magento\Framework\DB\Adapter\Pdo\Mysql::class, [], [], '', false); + $this->connectionMock = $this->getMock( + \Magento\Framework\DB\Adapter\Pdo\Mysql::class, + [], + [], + '', + false + ); + $this->resourceMock = $this->getMock( \Magento\Framework\App\ResourceConnection::class, [], @@ -58,13 +63,30 @@ protected function setUp() ->willReturn($this->connectionMock); $this->triggerFactoryMock = $this->getMock( - \Magento\Framework\DB\Ddl\TriggerFactory::class, [], [], '', false, false + \Magento\Framework\DB\Ddl\TriggerFactory::class, + [], + [], + '', + false, + false ); $this->viewCollectionMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\View\CollectionInterface::class, [], '', false, false, true, [] + \Magento\Framework\Mview\View\CollectionInterface::class, + [], + '', + false, + false, + true, + [] ); $this->viewMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\ViewInterface::class, [], '', false, false, true, [] + \Magento\Framework\Mview\ViewInterface::class, + [], + '', + false, + false, + true, + [] ); $this->resourceMock->expects($this->any()) @@ -157,7 +179,13 @@ public function testCreate() ->will($this->returnSelf()); $changelogMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\View\ChangelogInterface::class, [], '', false, false, true, [] + \Magento\Framework\Mview\View\ChangelogInterface::class, + [], + '', + false, + false, + true, + [] ); $changelogMock->expects($this->exactly(3)) ->method('getName') @@ -175,7 +203,13 @@ public function testCreate() ->will($this->returnValue($triggerMock)); $otherChangelogMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\View\ChangelogInterface::class, [], '', false, false, true, [] + \Magento\Framework\Mview\View\ChangelogInterface::class, + [], + '', + false, + false, + true, + [] ); $otherChangelogMock->expects($this->exactly(3)) ->method('getName') @@ -185,7 +219,13 @@ public function testCreate() ->will($this->returnValue('entity_id')); $otherViewMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\ViewInterface::class, [], '', false, false, true, [] + \Magento\Framework\Mview\ViewInterface::class, + [], + '', + false, + false, + true, + [] ); $otherViewMock->expects($this->exactly(1)) ->method('getId') @@ -248,7 +288,13 @@ public function testRemove() ->will($this->returnValue($triggerMock)); $otherChangelogMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\View\ChangelogInterface::class, [], '', false, false, true, [] + \Magento\Framework\Mview\View\ChangelogInterface::class, + [], + '', + false, + false, + true, + [] ); $otherChangelogMock->expects($this->exactly(3)) ->method('getName') @@ -258,7 +304,13 @@ public function testRemove() ->will($this->returnValue('entity_id')); $otherViewMock = $this->getMockForAbstractClass( - \Magento\Framework\Mview\ViewInterface::class, [], '', false, false, true, [] + \Magento\Framework\Mview\ViewInterface::class, + [], + '', + false, + false, + true, + [] ); $otherViewMock->expects($this->exactly(1)) ->method('getId') diff --git a/lib/internal/Magento/Framework/Mview/View.php b/lib/internal/Magento/Framework/Mview/View.php index 16d88767e508c..90d85947e8f5b 100644 --- a/lib/internal/Magento/Framework/Mview/View.php +++ b/lib/internal/Magento/Framework/Mview/View.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mview; use Magento\Framework\Mview\View\ChangelogTableNotExistsException; diff --git a/lib/internal/Magento/Framework/Mview/View/Subscription.php b/lib/internal/Magento/Framework/Mview/View/Subscription.php index 7dd440ae9a4aa..cac109d427dd9 100644 --- a/lib/internal/Magento/Framework/Mview/View/Subscription.php +++ b/lib/internal/Magento/Framework/Mview/View/Subscription.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mview\View; use Magento\Framework\App\ResourceConnection; @@ -154,7 +152,9 @@ public function remove() protected function getLinkedViews() { if (!$this->linkedViews) { - $viewList = $this->viewCollection->getViewsByStateMode(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED); + $viewList = $this->viewCollection->getViewsByStateMode( + \Magento\Framework\Mview\View\StateInterface::MODE_ENABLED + ); foreach ($viewList as $view) { /** @var \Magento\Framework\Mview\ViewInterface $view */ diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php index e1ac605e802ff..62043e1389733 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\ObjectManager\Code\Generator; /** diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php index 0c825a5ed5ac5..09ec376377fb9 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\ObjectManager\Code\Generator; use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface; @@ -24,9 +22,9 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract /** * No Such Entity Exception */ - const NO_SUCH_ENTITY_EXCEPTION = '\\Magento\Framework\Exception\NoSuchEntityException'; - const INPUT_EXCEPTION = '\\Magento\Framework\Exception\InputException'; - const SEARCH_CRITERIA = '\\Magento\Framework\Api\SearchCriteria'; + const NO_SUCH_ENTITY_EXCEPTION = \Magento\Framework\Exception\NoSuchEntityException::class; + const INPUT_EXCEPTION = \Magento\Framework\Exception\InputException::class; + const SEARCH_CRITERIA = \Magento\Framework\Api\SearchCriteria::class; /** * Retrieve class properties @@ -137,6 +135,7 @@ protected function _getCollectionFactoryClassName() return str_replace('Interface', '', $this->getSourceClassName()) . 'SearchResultInterfaceFactory'; } + /** * Returns source persistor class name * @@ -145,9 +144,9 @@ protected function _getCollectionFactoryClassName() protected function _getPersistorClassName() { $target = $this->getSourceClassName(); -// if (substr($target, -9) == 'Interface') { -// $target = substr($target, 1, strlen($target) -9); -// } + // if (substr($target, -9) == 'Interface') { + // $target = substr($target, 1, strlen($target) -9); + // } return $target . 'Persistor'; } diff --git a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php index 40959aa196694..af324937ccba5 100644 --- a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php +++ b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php @@ -7,8 +7,6 @@ * */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\ObjectManager; use Magento\Framework\Api\Code\Generator\Mapper as MapperGenerator; @@ -78,8 +76,12 @@ class DefinitionFactory * @param string $generationDir * @param string $definitionFormat */ - public function __construct(DriverInterface $filesystemDriver, $definitionDir, $generationDir, $definitionFormat) - { + public function __construct( + DriverInterface $filesystemDriver, + $definitionDir, + $generationDir, + $definitionFormat + ) { $this->_filesystemDriver = $filesystemDriver; $this->_definitionDir = $definitionDir; $this->_generationDir = $generationDir; diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/_files/ConfigDomMock.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/_files/ConfigDomMock.php index 265367641e796..9fed71539a650 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/_files/ConfigDomMock.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/_files/ConfigDomMock.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - class ConfigDomMock extends \PHPUnit_Framework_TestCase { /** @@ -15,8 +13,13 @@ class ConfigDomMock extends \PHPUnit_Framework_TestCase * @param $perFileSchema * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function __construct($initialContents, $validationState, $idAttributes, $typeAttribute, $perFileSchema) - { + public function __construct( + $initialContents, + $validationState, + $idAttributes, + $typeAttribute, + $perFileSchema + ) { $this->assertEquals('first content item', $initialContents); $this->assertEquals('xsi:type', $typeAttribute); } diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/RuntimeTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/RuntimeTest.php index cb274f845b668..af59e9fbccdd3 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/RuntimeTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/RuntimeTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\ObjectManager\Test\Unit\Relations; require_once __DIR__ . '/../_files/Child.php'; diff --git a/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/CompositeTest.php b/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/CompositeTest.php index cb453ef2cd4c5..c4bfa678e5582 100644 --- a/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/CompositeTest.php +++ b/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/CompositeTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Phrase\Test\Unit\Renderer; use \Magento\Framework\Phrase\Renderer\Composite; @@ -53,27 +51,27 @@ public function testRender() $this->rendererOne->expects( $this->once() )->method( - 'render' - )->with( - [$text], - $arguments - )->will( - $this->returnValue($resultAfterFirst) - ); + 'render' + )->with( + [$text], + $arguments + )->will( + $this->returnValue($resultAfterFirst) + ); $this->rendererTwo->expects( $this->once() )->method( - 'render' - )->with( - [ + 'render' + )->with( + [ $text, $resultAfterFirst, ], - $arguments - )->will( - $this->returnValue($resultAfterSecond) - ); + $arguments + )->will( + $this->returnValue($resultAfterSecond) + ); $this->assertEquals($resultAfterSecond, $this->object->render([$text], $arguments)); } diff --git a/lib/internal/Magento/Framework/Pricing/Render/RendererPool.php b/lib/internal/Magento/Framework/Pricing/Render/RendererPool.php index 8f3c117baa722..fd10890422b0e 100644 --- a/lib/internal/Magento/Framework/Pricing/Render/RendererPool.php +++ b/lib/internal/Magento/Framework/Pricing/Render/RendererPool.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Pricing\Render; use Magento\Framework\Pricing\Amount\AmountInterface; @@ -79,7 +77,9 @@ public function createPriceRender( $renderBlock = $this->getLayout()->createBlock($renderClassName, '', $arguments); if (!$renderBlock instanceof PriceBoxRenderInterface) { throw new \InvalidArgumentException( - 'Block "' . $renderClassName . '" must implement \Magento\Framework\Pricing\Render\PriceBoxRenderInterface' + 'Block "' . + $renderClassName . + '" must implement \Magento\Framework\Pricing\Render\PriceBoxRenderInterface' ); } $renderBlock->setTemplate($this->getRenderBlockTemplate($type, $priceCode)); @@ -142,7 +142,9 @@ public function createAmountRender( $amountBlock = $this->getLayout()->createBlock($renderClassName, '', $arguments); if (!$amountBlock instanceof AmountRenderInterface) { throw new \InvalidArgumentException( - 'Block "' . $renderClassName . '" must implement \Magento\Framework\Pricing\Render\AmountRenderInterface' + 'Block "' . + $renderClassName . + '" must implement \Magento\Framework\Pricing\Render\AmountRenderInterface' ); } $amountBlock->setTemplate($this->getAmountRenderBlockTemplate($type, $priceCode)); @@ -156,8 +158,8 @@ public function createAmountRender( */ public function getAdjustmentRenders(SaleableInterface $saleableItem = null, PriceInterface $price = null) { - $itemType = is_null($saleableItem) ? 'default' : $saleableItem->getTypeId(); - $priceType = is_null($price) ? 'default' : $price->getPriceCode(); + $itemType = $saleableItem === null ? 'default' : $saleableItem->getTypeId(); + $priceType = $price === null ? 'default' : $price->getPriceCode(); $fallbackPattern = [ "{$itemType}/adjustments/{$priceType}", diff --git a/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/Stub.php b/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/Stub.php index a082bdbdb3c0f..d4da63fe216f0 100644 --- a/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/Stub.php +++ b/lib/internal/Magento/Framework/Pricing/Test/Unit/Price/Stub.php @@ -6,7 +6,8 @@ namespace Magento\Framework\Pricing\Test\Unit\Price; -use Magento\Framework\Pricing\Price\AbstractPrice; +use Magento\Framework\Pricing\Price\AbstractPrice; + /** * Class Stub for testing abstract class AbstractPrice * diff --git a/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php b/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php index 9a0dfcd7099ee..4e86bf2c869a3 100644 --- a/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php +++ b/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php @@ -133,7 +133,7 @@ public function toHtmlDataProvider() 'data' => ['css_classes' => 'some_css_class'], 'price_code' => 'test_price', 'css_classes' => 'some_css_class price-test_price' - ]]; + ]]; } public function testGetSaleableItem() diff --git a/lib/internal/Magento/Framework/Profiler/Driver/Factory.php b/lib/internal/Magento/Framework/Profiler/Driver/Factory.php index 5975f60f41ddb..392cecad548e5 100644 --- a/lib/internal/Magento/Framework/Profiler/Driver/Factory.php +++ b/lib/internal/Magento/Framework/Profiler/Driver/Factory.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Profiler\Driver; use Magento\Framework\Profiler\DriverInterface; @@ -65,7 +63,10 @@ public function create(array $config = null) $driver = new $class($config); if (!$driver instanceof DriverInterface) { throw new \InvalidArgumentException( - sprintf("Driver class \"%s\" must implement \Magento\Framework\Profiler\DriverInterface.", get_class($driver)) + sprintf( + "Driver class \"%s\" must implement \Magento\Framework\Profiler\DriverInterface.", + get_class($driver) + ) ); } return $driver; diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Field/FieldFactory.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Field/FieldFactory.php index 66cbe02334fa1..f1fa918884f29 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Field/FieldFactory.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Field/FieldFactory.php @@ -6,7 +6,6 @@ namespace Magento\Framework\Search\Adapter\Mysql\Field; - class FieldFactory { /** diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Field/FieldInterface.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Field/FieldInterface.php index f069646d9fdaa..f81a3bb22f4e8 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Field/FieldInterface.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Field/FieldInterface.php @@ -6,7 +6,6 @@ namespace Magento\Framework\Search\Adapter\Mysql\Field; - interface FieldInterface { const TYPE_FLAT = 1; diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/MatchContainer.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/MatchContainer.php index ff216b2a39c11..3a044dabb75bc 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/MatchContainer.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/MatchContainer.php @@ -6,7 +6,6 @@ namespace Magento\Framework\Search\Adapter\Mysql\Query; - use Magento\Framework\Search\Request\QueryInterface; // @codeCoverageIgnore @@ -17,6 +16,7 @@ class MatchContainer * @var QueryInterface */ private $request; + /** * @var string */ diff --git a/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php index 1df7cfa69ca83..c8ddd288db2b6 100644 --- a/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Test class for \Magento\Framework\Session\Config */ diff --git a/lib/internal/Magento/Framework/Session/Test/Unit/_files/mock_session_regenerate_id.php b/lib/internal/Magento/Framework/Session/Test/Unit/_files/mock_session_regenerate_id.php index 0988bc20ae8d2..8984eafbee30d 100644 --- a/lib/internal/Magento/Framework/Session/Test/Unit/_files/mock_session_regenerate_id.php +++ b/lib/internal/Magento/Framework/Session/Test/Unit/_files/mock_session_regenerate_id.php @@ -22,4 +22,4 @@ function session_regenerate_id($var) return true; } return call_user_func_array('\session_regenerate_id', func_get_args()); -} \ No newline at end of file +} diff --git a/lib/internal/Magento/Framework/Setup/SampleData/State.php b/lib/internal/Magento/Framework/Setup/SampleData/State.php index e222940f3f14b..006fde8140e26 100644 --- a/lib/internal/Magento/Framework/Setup/SampleData/State.php +++ b/lib/internal/Magento/Framework/Setup/SampleData/State.php @@ -123,7 +123,6 @@ protected function openStream($mode = 'w') $stream = $directoryWrite->openFile($fileName, $mode); } return $stream; - } /** diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php b/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php index b5049edd721c7..f3b521a6084d3 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Stdlib\DateTime; /** diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/CookieScopeTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/CookieScopeTest.php index 28dcd4447b37e..2d456a7eeeecd 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/CookieScopeTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/CookieScopeTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Stdlib\Test\Unit\Cookie; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -117,7 +115,8 @@ public function testGetSensitiveCookieMetadataDefaults() SensitiveCookieMetadata::KEY_HTTP_ONLY => true, SensitiveCookieMetadata::KEY_SECURE => true, ], - $cookieScope->getSensitiveCookieMetadata()->__toArray()); + $cookieScope->getSensitiveCookieMetadata()->__toArray() + ); } /** @@ -297,7 +296,7 @@ protected function createCookieScope($params = []) */ public function createSensitiveMetadata($metadata = []) { - return $this->objectManager->getObject( + return $this->objectManager->getObject( \Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata::class, ['metadata' => $metadata, 'request' => $this->requestMock] ); @@ -311,7 +310,7 @@ public function createSensitiveMetadata($metadata = []) */ public function createPublicMetadata($metadata = []) { - return $this->objectManager->getObject( + return $this->objectManager->getObject( \Magento\Framework\Stdlib\Cookie\PublicCookieMetadata::class, ['metadata' => $metadata] ); @@ -325,7 +324,7 @@ public function createPublicMetadata($metadata = []) */ public function createCookieMetadata($metadata = []) { - return $this->objectManager->getObject( + return $this->objectManager->getObject( \Magento\Framework\Stdlib\Cookie\CookieMetadata::class, ['metadata' => $metadata] ); diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php index ddb3214705c18..255b2ebc5100f 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php @@ -4,19 +4,18 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - // @codingStandardsIgnoreStart namespace { $mockTranslateSetCookie = false; } -namespace Magento\Framework\Stdlib\Test\Unit\Cookie { - // @codingStandardsIgnoreEnd +namespace Magento\Framework\Stdlib\Test\Unit\Cookie +{ use Magento\Framework\Stdlib\Cookie\PhpCookieManager; use Magento\Framework\Exception\InputException; use Magento\Framework\Stdlib\Cookie\FailureToSendException; use Magento\Framework\Stdlib\Cookie\CookieSizeLimitReachedException; + // @codingStandardsIgnoreEnd /** * Test PhpCookieManager @@ -49,7 +48,7 @@ class PhpCookieManagerTest extends \PHPUnit_Framework_TestCase /** * Mapping from constant names to functions that handle the assertions. */ - static $functionTestAssertionMapping = [ + protected static $functionTestAssertionMapping = [ self::DELETE_COOKIE_NAME => 'self::assertDeleteCookie', self::DELETE_COOKIE_NAME_NO_METADATA => 'self::assertDeleteCookieWithNoMetadata', self::SENSITIVE_COOKIE_NAME_NO_METADATA_HTTPS => 'self::assertSensitiveCookieWithNoMetaDataHttps', @@ -75,6 +74,7 @@ class PhpCookieManagerTest extends \PHPUnit_Framework_TestCase * @var \Magento\Framework\Stdlib\Cookie\PhpCookieManager */ protected $cookieManager; + /** * @var \PHPUnit_Framework_MockObject_MockObject|CookieScopeInterface */ @@ -233,7 +233,7 @@ public function testSetSensitiveCookieNoMetadata($cookieName, $secure) [ 'request' => $this->requestMock ] - ); + ); $this->scopeMock->expects($this->once()) ->method('getSensitiveCookieMetadata') ->with() diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeFormatterTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeFormatterTest.php index af62ec1812943..48c9071568de1 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeFormatterTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeFormatterTest.php @@ -31,7 +31,6 @@ protected function setUp() $this->localeResolverMock->expects($this->any()) ->method('getLocale') ->willReturn('fr-FR'); - } /** diff --git a/lib/internal/Magento/Framework/Test/Unit/App/ResourceConnectionTest.php b/lib/internal/Magento/Framework/Test/Unit/App/ResourceConnectionTest.php index 9cbdea93cf4fc..d70714a83469e 100644 --- a/lib/internal/Magento/Framework/Test/Unit/App/ResourceConnectionTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/App/ResourceConnectionTest.php @@ -92,6 +92,5 @@ public function testCloseConnection() $this->configMock->expects(self::once())->method('getConnectionName')->with('default'); $this->unit->closeConnection('default'); - } } diff --git a/lib/internal/Magento/Framework/Test/Unit/Message/PhraseFactoryTest.php b/lib/internal/Magento/Framework/Test/Unit/Message/PhraseFactoryTest.php index e5103fee2c7c3..86687ba1d0bc8 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Message/PhraseFactoryTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Message/PhraseFactoryTest.php @@ -52,5 +52,4 @@ public function dataProvider() ], ]; } - } diff --git a/lib/internal/Magento/Framework/Test/Unit/ShellTest.php b/lib/internal/Magento/Framework/Test/Unit/ShellTest.php index d61d2f28829c7..604fa975c62a8 100644 --- a/lib/internal/Magento/Framework/Test/Unit/ShellTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/ShellTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Test\Unit; class ShellTest extends \PHPUnit_Framework_TestCase @@ -54,7 +52,10 @@ protected function _testExecuteCommand(\Magento\Framework\Shell $shell, $command public function testExecute($command, $commandArgs, $expectedResult) { $this->_testExecuteCommand( - new \Magento\Framework\Shell($this->commandRenderer, $this->logger), $command, $commandArgs, $expectedResult + new \Magento\Framework\Shell($this->commandRenderer, $this->logger), + $command, + $commandArgs, + $expectedResult ); } diff --git a/lib/internal/Magento/Framework/Test/Unit/UrlTest.php b/lib/internal/Magento/Framework/Test/Unit/UrlTest.php index 939e9a39bea58..8aad9675f9a8e 100644 --- a/lib/internal/Magento/Framework/Test/Unit/UrlTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/UrlTest.php @@ -4,9 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Test\Unit; + use Magento\Framework\Url\HostChecker; /** @@ -647,7 +646,8 @@ public function testGetConfigDataWithSecureIsForcedParam() ->method('getValue') ->with( 'web/secure/base_url_secure_forced', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->scopeMock + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->scopeMock ) ->will($this->returnValue('http://localhost/')); $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') diff --git a/lib/internal/Magento/Framework/Test/Unit/ValidatorFactoryTest.php b/lib/internal/Magento/Framework/Test/Unit/ValidatorFactoryTest.php index 2c8dca01988e7..f82ceedb8e45f 100644 --- a/lib/internal/Magento/Framework/Test/Unit/ValidatorFactoryTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/ValidatorFactoryTest.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Test\Unit; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -24,7 +22,7 @@ protected function setUp() { $objectManager = new ObjectManager($this); $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); - $this->model = $objectManager->getObject( + $this->model = $objectManager->getObject( \Magento\Framework\ValidatorFactory::class, ['objectManager' => $this->objectManagerMock] ); diff --git a/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/ExtensionGeneratorAutoloader.php b/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/ExtensionGeneratorAutoloader.php index 4e0fcac1fdff2..f139ae88a997f 100644 --- a/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/ExtensionGeneratorAutoloader.php +++ b/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/ExtensionGeneratorAutoloader.php @@ -57,7 +57,7 @@ public function load($className) if ($this->isExtension($className)) { $content = "namespace $namespace;\n\nclass $justTypeName implements " . "{$justTypeName}Interface\n{\n\n}"; - } else if ($this->isExtensionInterface($className)) { + } elseif ($this->isExtensionInterface($className)) { $content = "namespace $namespace;\n\ninterface $justTypeName extends " . "\\Magento\\Framework\\Api\\ExtensionAttributesInterface \n{\n\n}"; } diff --git a/lib/internal/Magento/Framework/Translate/Adapter.php b/lib/internal/Magento/Framework/Translate/Adapter.php index a529cb77695fe..f4229ff77d851 100644 --- a/lib/internal/Magento/Framework/Translate/Adapter.php +++ b/lib/internal/Magento/Framework/Translate/Adapter.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Magento translate adapter */ @@ -31,6 +29,7 @@ public function translate($messageId, $locale = null) } } + // @codingStandardsIgnoreStart /** * Translate message string. * @@ -47,4 +46,5 @@ public function __() } return $string; } + // @codingStandardsIgnoreEnd } diff --git a/lib/internal/Magento/Framework/Translate/AdapterInterface.php b/lib/internal/Magento/Framework/Translate/AdapterInterface.php index f29f4c77565fa..bfff761cd7827 100644 --- a/lib/internal/Magento/Framework/Translate/AdapterInterface.php +++ b/lib/internal/Magento/Framework/Translate/AdapterInterface.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Translate; /** @@ -24,6 +22,7 @@ interface AdapterInterface */ public function translate($messageId, $locale = null); + // @codingStandardsIgnoreStart /** * Translate string * @@ -31,4 +30,5 @@ public function translate($messageId, $locale = null); * @SuppressWarnings(PHPMD.ShortMethodName) */ public function __(); + // @codingStandardsIgnoreEnd } diff --git a/lib/internal/Magento/Framework/Translate/Inline.php b/lib/internal/Magento/Framework/Translate/Inline.php index 6ba3cb9dcb330..d8e2bf9e4a655 100644 --- a/lib/internal/Magento/Framework/Translate/Inline.php +++ b/lib/internal/Magento/Framework/Translate/Inline.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Translate; class Inline implements \Magento\Framework\Translate\InlineInterface @@ -242,7 +240,11 @@ protected function stripInlineTranslations(&$body) } } else { if (is_string($body)) { - $body = preg_replace('#' . \Magento\Framework\Translate\Inline\ParserInterface::REGEXP_TOKEN . '#', '$1', $body); + $body = preg_replace( + '#' . \Magento\Framework\Translate\Inline\ParserInterface::REGEXP_TOKEN . '#', + '$1', + $body + ); } } return $this; diff --git a/lib/internal/Magento/Framework/Url.php b/lib/internal/Magento/Framework/Url.php index 30af3528b2bab..48c191dae8ae5 100644 --- a/lib/internal/Magento/Framework/Url.php +++ b/lib/internal/Magento/Framework/Url.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework; use Magento\Framework\Url\HostChecker; @@ -41,6 +39,7 @@ * - query_array: array('param1'=>'value1', 'param2'=>'value2') * - fragment: (#)'fragment-anchor' * + * @codingStandardsIgnoreStart * URL structure: * * https://user:password@host:443/base_path/[base_script][scopeview_path]route_name/controller_name/action_name/param1/value1?query_param=query_value#fragment @@ -48,6 +47,7 @@ * \__________________C___________________/ \__________________D_________________/ \_____E_____/ * \_____________F______________/ \___________________________G______________________/ * \___________________________________________________H____________________________________________________/ + * @codingStandardsIgnoreEnd * * - A: authority * - B: path @@ -143,6 +143,7 @@ class Url extends \Magento\Framework\DataObject implements \Magento\Framework\Ur * @var \Magento\Framework\Url\RouteParamsResolverFactory */ private $_routeParamsResolverFactory; + /** * @var \Magento\Framework\Url\ScopeResolverInterface */ @@ -280,7 +281,7 @@ public function setUseSession($useSession) */ public function getUseSession() { - if (is_null($this->_useSession)) { + if ($this->_useSession === null) { $this->_useSession = $this->_sidResolver->getUseSessionInUrl(); } return $this->_useSession; @@ -295,7 +296,7 @@ public function getUseSession() */ public function getConfigData($key, $prefix = null) { - if (is_null($prefix)) { + if ($prefix === null) { $prefix = 'web/' . ($this->_isSecure() ? 'secure' : 'unsecure') . '/'; } $path = $prefix . $key; @@ -573,7 +574,7 @@ protected function _getRoutePath($routeParams = []) $routePath = $this->_getActionPath(); if ($this->_getRouteParams()) { foreach ($this->_getRouteParams() as $key => $value) { - if (is_null($value) || false === $value || '' === $value || !is_scalar($value)) { + if ($value === null || false === $value || '' === $value || !is_scalar($value)) { continue; } $routePath .= $key . '/' . $value . '/'; @@ -845,7 +846,7 @@ function ($item) use (&$isCached) { ); } - if(!$isCached) { + if (!$isCached) { return $this->getUrlModifier()->execute( $this->createUrl($routePath, $routeParams) ); @@ -943,7 +944,7 @@ private function createUrl($routePath = null, array $routeParams = null) $this->_queryParamsResolver->unsetData('query_params'); } - if (!is_null($fragment)) { + if ($fragment !== null) { $url .= '#' . $this->getEscaper()->encodeUrlParam($fragment); } $this->getRouteParamsResolver()->unsetData('secure'); @@ -1077,9 +1078,12 @@ function ($match) { public function useSessionIdForUrl($secure = false) { $key = 'use_session_id_for_url_' . (int)$secure; - if (is_null($this->getData($key))) { + if ($this->getData($key) === null) { $httpHost = $this->_request->getHttpHost(); - $urlHost = parse_url($this->_getScope()->getBaseUrl(UrlInterface::URL_TYPE_LINK, $secure), PHP_URL_HOST); + $urlHost = parse_url( + $this->_getScope()->getBaseUrl(UrlInterface::URL_TYPE_LINK, $secure), + PHP_URL_HOST + ); if ($httpHost != $urlHost) { $this->setData($key, true); diff --git a/lib/internal/Magento/Framework/UrlFactory.php b/lib/internal/Magento/Framework/UrlFactory.php index ac7876a66a757..a419ccb576e75 100644 --- a/lib/internal/Magento/Framework/UrlFactory.php +++ b/lib/internal/Magento/Framework/UrlFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework; class UrlFactory @@ -24,8 +22,10 @@ class UrlFactory * @param ObjectManagerInterface $objectManager * @param string $instanceName */ - public function __construct(ObjectManagerInterface $objectManager, $instanceName = UrlInterface::class) - { + public function __construct( + ObjectManagerInterface $objectManager, + $instanceName = UrlInterface::class + ) { $this->_objectManager = $objectManager; $this->_instanceName = $instanceName; } diff --git a/lib/internal/Magento/Framework/Validator/Builder.php b/lib/internal/Magento/Framework/Validator/Builder.php index e31a2c86d9238..602681c04d762 100644 --- a/lib/internal/Magento/Framework/Validator/Builder.php +++ b/lib/internal/Magento/Framework/Validator/Builder.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Validator; use Magento\Framework\Validator\Constraint\OptionInterface; @@ -257,7 +255,11 @@ protected function _createConstraint(array $data) } if (\Magento\Framework\Validator\Config::CONSTRAINT_TYPE_PROPERTY == $data['type']) { - $result = new \Magento\Framework\Validator\Constraint\Property($validator, $data['property'], $data['alias']); + $result = new \Magento\Framework\Validator\Constraint\Property( + $validator, + $data['property'], + ['alias'] + ); } else { $result = $this->_constraintFactory->create(['validator' => $validator, 'alias' => $data['alias']]); } @@ -286,7 +288,10 @@ protected function _createConstraintValidator(array $data) // Check validator type if (!$validator instanceof \Magento\Framework\Validator\ValidatorInterface) { throw new \InvalidArgumentException( - sprintf('Constraint class "%s" must implement \Magento\Framework\Validator\ValidatorInterface', $data['class']) + sprintf( + 'Constraint class "%s" must implement \Magento\Framework\Validator\ValidatorInterface', + $data['class'] + ) ); } @@ -300,8 +305,10 @@ protected function _createConstraintValidator(array $data) * @param array $options * @return void */ - protected function _configureConstraintValidator(\Magento\Framework\Validator\ValidatorInterface $validator, array $options) - { + protected function _configureConstraintValidator( + \Magento\Framework\Validator\ValidatorInterface $validator, + array $options + ) { // Call all validator methods according to configuration if (isset($options['methods'])) { foreach ($options['methods'] as $methodData) { diff --git a/lib/internal/Magento/Framework/Validator/Constraint/Property.php b/lib/internal/Magento/Framework/Validator/Constraint/Property.php index c40e3c1237e64..a56abebca8392 100644 --- a/lib/internal/Magento/Framework/Validator/Constraint/Property.php +++ b/lib/internal/Magento/Framework/Validator/Constraint/Property.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Validator\Constraint; class Property extends \Magento\Framework\Validator\Constraint @@ -33,8 +31,8 @@ public function __construct(\Magento\Framework\Validator\ValidatorInterface $val } /** - * Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or \ArrayAccess or array - * is passed + * Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or + * \ArrayAccess or array is passed * * @param mixed $value * @return mixed diff --git a/lib/internal/Magento/Framework/Validator/ConstraintFactory.php b/lib/internal/Magento/Framework/Validator/ConstraintFactory.php index 1077f21bfa2bd..813961eb640ae 100644 --- a/lib/internal/Magento/Framework/Validator/ConstraintFactory.php +++ b/lib/internal/Magento/Framework/Validator/ConstraintFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Factory class for \Magento\Framework\Validator\Constraint */ @@ -33,8 +31,10 @@ class ConstraintFactory * @param \Magento\Framework\ObjectManagerInterface $objectManager * @param string $instanceName */ - public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, $instanceName = \Magento\Framework\Validator\Constraint::class) - { + public function __construct( + \Magento\Framework\ObjectManagerInterface $objectManager, + $instanceName = \Magento\Framework\Validator\Constraint::class + ) { $this->_objectManager = $objectManager; $this->_instanceName = $instanceName; } diff --git a/lib/internal/Magento/Framework/Validator/Factory.php b/lib/internal/Magento/Framework/Validator/Factory.php index d2e3837d13138..3fc93eeabe191 100644 --- a/lib/internal/Magento/Framework/Validator/Factory.php +++ b/lib/internal/Magento/Framework/Validator/Factory.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Validator; use Magento\Framework\Cache\FrontendInterface; @@ -63,6 +61,8 @@ public function __construct( /** * Init cached list of validation files + * + * @return void */ protected function _initializeConfigList() { @@ -109,8 +109,10 @@ public function getValidatorConfig() { $this->_initializeConfigList(); $this->_initializeDefaultTranslator(); - return $this->_objectManager->create( - \Magento\Framework\Validator\Config::class, ['configFiles' => $this->_configFiles]); + return $this->_objectManager->create( + \Magento\Framework\Validator\Config::class, + ['configFiles' => $this->_configFiles] + ); } /** diff --git a/lib/internal/Magento/Framework/View/Asset/LockerProcess.php b/lib/internal/Magento/Framework/View/Asset/LockerProcess.php index e8938211fecbf..f378a4286ea1f 100644 --- a/lib/internal/Magento/Framework/View/Asset/LockerProcess.php +++ b/lib/internal/Magento/Framework/View/Asset/LockerProcess.php @@ -105,7 +105,6 @@ private function isProcessLocked() return false; } } catch (FileSystemException $e) { - return false; } diff --git a/lib/internal/Magento/Framework/View/Asset/Minification.php b/lib/internal/Magento/Framework/View/Asset/Minification.php index 1e32e32b99676..3263a810936b2 100644 --- a/lib/internal/Magento/Framework/View/Asset/Minification.php +++ b/lib/internal/Magento/Framework/View/Asset/Minification.php @@ -79,8 +79,7 @@ public function addMinifiedSign($filename) { $extension = pathinfo($filename, PATHINFO_EXTENSION); - if ( - $this->isEnabled($extension) && + if ($this->isEnabled($extension) && !$this->isExcluded($filename) && !$this->isMinifiedFilename($filename) ) { @@ -99,8 +98,7 @@ public function removeMinifiedSign($filename) { $extension = pathinfo($filename, PATHINFO_EXTENSION); - if ( - $this->isEnabled($extension) && + if ($this->isEnabled($extension) && !$this->isExcluded($filename) && $this->isMinifiedFilename($filename) ) { diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Chain.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Chain.php index b4fe2f0d1cd8f..ca9d15f0856a5 100644 --- a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Chain.php +++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Chain.php @@ -188,7 +188,6 @@ public function assertValid() { if ($this->contentType !== $this->targetContentType && empty($this->compatibleTypes[$this->targetContentType][$this->contentType])) { - throw new \LogicException( "The requested asset type was '{$this->targetContentType}', but ended up with '{$this->contentType}'" ); diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Minify.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Minify.php index 7f0f1e53846cd..70f1f4cfe15f1 100644 --- a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Minify.php +++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Minify.php @@ -43,8 +43,7 @@ public function __construct(AdapterInterface $adapter, Minification $minificatio */ public function process(PreProcessor\Chain $chain) { - if ( - $this->minification->isEnabled(pathinfo($chain->getTargetAssetPath(), PATHINFO_EXTENSION)) && + if ($this->minification->isEnabled(pathinfo($chain->getTargetAssetPath(), PATHINFO_EXTENSION)) && $this->minification->isMinifiedFilename($chain->getTargetAssetPath()) && !$this->minification->isMinifiedFilename($chain->getOrigAssetPath()) ) { diff --git a/lib/internal/Magento/Framework/View/Element/Message/MessageConfigurationsPool.php b/lib/internal/Magento/Framework/View/Element/Message/MessageConfigurationsPool.php index dc262265984f5..d020e16779dc4 100644 --- a/lib/internal/Magento/Framework/View/Element/Message/MessageConfigurationsPool.php +++ b/lib/internal/Magento/Framework/View/Element/Message/MessageConfigurationsPool.php @@ -24,15 +24,13 @@ public function __construct( array_walk( $configurationsMap, function (array &$configuration) { - if ( - !isset($configuration['renderer']) + if (!isset($configuration['renderer']) || !is_string($configuration['renderer']) ) { throw new \InvalidArgumentException('Renderer should be defined.'); } - if ( - isset($configuration['data']) + if (isset($configuration['data']) && !is_array($configuration['data']) ) { throw new \InvalidArgumentException('Data should be of array type.'); diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/Config/DomMerger.php b/lib/internal/Magento/Framework/View/Element/UiComponent/Config/DomMerger.php index ed8d4b3c461d5..d150c606777f1 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/Config/DomMerger.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/Config/DomMerger.php @@ -208,7 +208,7 @@ protected function nestedMerge(\DOMXPath $rootDomXPath, \DOMNodeList $insertedNo if ($this->isMergeContext($insertedXPath)) { if ($this->isTextNode($insertedItem) && $this->isTextNode($rootItem)) { $rootItem->nodeValue = $insertedItem->nodeValue; - } else if (!$this->isContextXPath([$rootItemXPath, $insertedXPath]) + } elseif (!$this->isContextXPath([$rootItemXPath, $insertedXPath]) && !$this->hasIdAttribute($rootItem) && !$this->hasIdAttribute($insertedItem) ) { diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php b/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php index 8741f9a1267fa..69348cbdaf4fb 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php @@ -323,9 +323,9 @@ protected function setAcceptType() $rawAcceptType = $this->request->getHeader('Accept'); if (strpos($rawAcceptType, 'json') !== false) { $this->acceptType = 'json'; - } else if (strpos($rawAcceptType, 'html') !== false) { + } elseif (strpos($rawAcceptType, 'html') !== false) { $this->acceptType = 'html'; - } else if (strpos($rawAcceptType, 'xml') !== false) { + } elseif (strpos($rawAcceptType, 'xml') !== false) { $this->acceptType = 'xml'; } } diff --git a/lib/internal/Magento/Framework/View/Layout.php b/lib/internal/Magento/Framework/View/Layout.php index 3334967c8da83..db447bf96f145 100755 --- a/lib/internal/Magento/Framework/View/Layout.php +++ b/lib/internal/Magento/Framework/View/Layout.php @@ -495,7 +495,6 @@ protected function displayElement($name) $display = $this->structure->getAttribute($name, 'display'); if ($display === '' || $display === false || $display === null || filter_var($display, FILTER_VALIDATE_BOOLEAN)) { - return true; } return false; diff --git a/lib/internal/Magento/Framework/View/Layout/GeneratorPool.php b/lib/internal/Magento/Framework/View/Layout/GeneratorPool.php index 828f0584a2065..540684fe928ea 100644 --- a/lib/internal/Magento/Framework/View/Layout/GeneratorPool.php +++ b/lib/internal/Magento/Framework/View/Layout/GeneratorPool.php @@ -5,7 +5,6 @@ */ namespace Magento\Framework\View\Layout; - /** * Pool of generators for structural elements */ @@ -156,8 +155,7 @@ protected function reorderElements( $element[ScheduledStructure::ELEMENT_OFFSET_OR_SIBLING] ); - if ( - isset($siblingElement[ScheduledStructure::ELEMENT_NAME]) + if (isset($siblingElement[ScheduledStructure::ELEMENT_NAME]) && $structure->hasElement($siblingElement[ScheduledStructure::ELEMENT_NAME]) ) { $this->reorderElements( diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php index 3ecd30b7e0bfa..651e5f8e3641b 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php @@ -361,7 +361,7 @@ protected function renderAssetHtml(\Magento\Framework\View\Asset\PropertyGroup $ /** * Get asset content type - * + * * @param \Magento\Framework\View\Asset\AssetInterface $asset * @return string */ diff --git a/lib/internal/Magento/Framework/View/Page/Config/Structure.php b/lib/internal/Magento/Framework/View/Page/Config/Structure.php index 4ab89319f6d82..15dd082ff18c3 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Structure.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Structure.php @@ -6,7 +6,6 @@ namespace Magento\Framework\View\Page\Config; - /** * Page config structure model */ diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php index 137a9d36374cb..fba22cf997207 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php @@ -14,6 +14,8 @@ /** * Class Compiler + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Compiler implements CompilerInterface { @@ -102,7 +104,7 @@ public function compile(\DOMNode $node, DataObject $processedObject, DataObject $compiler = $this->getElementCompiler($node->nodeName); if (null !== $compiler) { $compiler->compile($this, $node, $processedObject, $context); - } else if ($node->hasChildNodes()) { + } elseif ($node->hasChildNodes()) { foreach ($this->getChildNodes($node) as $child) { $this->compile($child, $processedObject, $context); } diff --git a/lib/internal/Magento/Framework/View/TemplateEnginePool.php b/lib/internal/Magento/Framework/View/TemplateEnginePool.php index 6b4305d7f2b46..c041d4d1bc557 100644 --- a/lib/internal/Magento/Framework/View/TemplateEnginePool.php +++ b/lib/internal/Magento/Framework/View/TemplateEnginePool.php @@ -5,7 +5,6 @@ */ namespace Magento\Framework\View; - class TemplateEnginePool { /** diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/MinificationTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/MinificationTest.php index 21a27f33cad18..f82eae75a3cf3 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/MinificationTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/MinificationTest.php @@ -53,7 +53,6 @@ protected function setUp() */ public function testIsEnabled() { - } /** diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/ModuleTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/ModuleTest.php index 0ba45a729d916..8e7ad15bb0b2c 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/ModuleTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/ModuleTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\Asset\NotationResolver; class ModuleTest extends \PHPUnit_Framework_TestCase @@ -51,7 +49,10 @@ public function testConvertModuleNotationToPathNoModularSeparator() * @dataProvider convertModuleNotationToPathModularSeparatorDataProvider */ public function testConvertModuleNotationToPathModularSeparator( - $assetRelPath, $relatedFieldId, $similarRelPath, $expectedResult + $assetRelPath, + $relatedFieldId, + $similarRelPath, + $expectedResult ) { $similarAsset = $this->getMock(\Magento\Framework\View\Asset\File::class, [], [], '', false); $similarAsset->expects($this->any()) diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/SourceTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/SourceTest.php index 2a704650aa9dd..3aa5a8cd82b4b 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/SourceTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/SourceTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\Asset; use Magento\Framework\App\Filesystem\DirectoryList; @@ -79,16 +77,25 @@ class SourceTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->preProcessorPool = $this->getMock( - \Magento\Framework\View\Asset\PreProcessor\Pool::class, [], [], '', false + \Magento\Framework\View\Asset\PreProcessor\Pool::class, + [], + [], + '', + false ); $this->viewFileResolution = $this->getMock( - \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile::class, [], [], '', false + \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile::class, + [], + [], + '', + false ); $this->theme = $this->getMockForAbstractClass(\Magento\Framework\View\Design\ThemeInterface::class); /** @var \Magento\Framework\App\Config\ScopeConfigInterface $config */ $this->chainFactory = $this->getMockBuilder( - \Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface::class) + \Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface::class + ) ->getMock(); $this->chain = $this->getMockBuilder(\Magento\Framework\View\Asset\PreProcessor\Chain::class) ->disableOriginalConstructor() diff --git a/lib/internal/Magento/Framework/View/Test/Unit/BlockPoolTest.php b/lib/internal/Magento/Framework/View/Test/Unit/BlockPoolTest.php index b93e9b7a0e045..9f058d325c6a7 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/BlockPoolTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/BlockPoolTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit; use \Magento\Framework\View\BlockPool; diff --git a/lib/internal/Magento/Framework/View/Test/Unit/DataSourcePoolTest.php b/lib/internal/Magento/Framework/View/Test/Unit/DataSourcePoolTest.php index ca74870a715ab..a65ee3f5ce1f2 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/DataSourcePoolTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/DataSourcePoolTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit; use \Magento\Framework\View\DataSourcePool; @@ -33,9 +31,11 @@ protected function setUp() $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->dataSourcePool = $objectManager->getObject( - \Magento\Framework\View\DataSourcePool::class, [ + \Magento\Framework\View\DataSourcePool::class, + [ 'blockFactory' => $this->blockFactory - ]); + ] + ); } /** diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Design/FileResolution/Fallback/Resolver/AlternativeTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Design/FileResolution/Fallback/Resolver/AlternativeTest.php index 98946634477cb..1c2b51bc71fcc 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Design/FileResolution/Fallback/Resolver/AlternativeTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Design/FileResolution/Fallback/Resolver/AlternativeTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\Design\FileResolution\Fallback\Resolver; use \Magento\Framework\View\Design\FileResolution\Fallback\Resolver\Alternative; @@ -58,8 +56,11 @@ protected function setUp() */ public function testConstructorException(array $alternativeExtensions) { - $this->setExpectedException('\InvalidArgumentException', "\$alternativeExtensions must be an array with format:" - . " array('ext1' => array('ext1', 'ext2'), 'ext3' => array(...)]"); + $this->setExpectedException( + '\InvalidArgumentException', + "\$alternativeExtensions must be an array with format:" + . " array('ext1' => array('ext1', 'ext2'), 'ext3' => array(...)]" + ); $readFactory = $this->getMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class, [], [], '', false); $rulePool = $this->getMock(\Magento\Framework\View\Design\Fallback\RulePool::class, [], [], '', false); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Design/Theme/ImageTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Design/Theme/ImageTest.php index 82bd042feb93e..8da698e48a413 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Design/Theme/ImageTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Design/Theme/ImageTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Test theme image model */ @@ -70,7 +68,11 @@ protected function setUp() ); $this->_rootDirectoryMock = $this->getMock( \Magento\Framework\Filesystem\Directory\Write::class, - ['isExist', 'copyFile', 'getRelativePath', 'delete'], [], '', false, false + ['isExist', 'copyFile', 'getRelativePath', 'delete'], + [], + '', + false, + false ); $this->_filesystemMock = $this->getMock( \Magento\Framework\Filesystem::class, @@ -107,14 +109,16 @@ protected function setUp() $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->_model = $objectManager->getObject( - \Magento\Framework\View\Design\Theme\Image::class, [ + \Magento\Framework\View\Design\Theme\Image::class, + [ 'filesystem' => $this->_filesystemMock, 'imageFactory' => $imageFactory, 'uploader' => $this->_uploaderMock, 'themeImagePath' => $this->imagePathMock, 'logger' => $logger, 'theme' => $this->_themeMock - ]); + ] + ); } protected function tearDown() diff --git a/lib/internal/Magento/Framework/View/Test/Unit/DesignLoaderTest.php b/lib/internal/Magento/Framework/View/Test/Unit/DesignLoaderTest.php index 58331e32deda4..7662eb9eca50f 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/DesignLoaderTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/DesignLoaderTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit; class DesignLoaderTest extends \PHPUnit_Framework_TestCase diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php index 68cb485f571dd..431ca76fc8f15 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\Element; use Magento\Framework\View\Element\AbstractBlock; diff --git a/lib/internal/Magento/Framework/View/Test/Unit/File/Collector/Decorator/ModuleDependencyTest.php b/lib/internal/Magento/Framework/View/Test/Unit/File/Collector/Decorator/ModuleDependencyTest.php index 38e585cce7928..de1683618db16 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/File/Collector/Decorator/ModuleDependencyTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/File/Collector/Decorator/ModuleDependencyTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\File\Collector\Decorator; class ModuleDependencyTest extends \PHPUnit_Framework_TestCase @@ -33,7 +31,8 @@ protected function setUp() ->method('getNames') ->will($this->returnValue(['Fixture_ModuleB', 'Fixture_ModuleA'])); $this->_model = new \Magento\Framework\View\File\Collector\Decorator\ModuleDependency( - $this->_fileSource, $this->_moduleListMock + $this->_fileSource, + $this->_moduleListMock ); } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/File/Collector/Decorator/ModuleOutputTest.php b/lib/internal/Magento/Framework/View/Test/Unit/File/Collector/Decorator/ModuleOutputTest.php index 83be2ee7ac10e..00f8bb8e615cc 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/File/Collector/Decorator/ModuleOutputTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/File/Collector/Decorator/ModuleOutputTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\File\Collector\Decorator; class ModuleOutputTest extends \PHPUnit_Framework_TestCase @@ -37,7 +35,8 @@ protected function setUp() ['Module_OutputDisabled', false], ])); $this->_model = new \Magento\Framework\View\File\Collector\Decorator\ModuleOutput( - $this->_fileSource, $this->_moduleManager + $this->_fileSource, + $this->_moduleManager ); } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/File/FileListTest.php b/lib/internal/Magento/Framework/View/Test/Unit/File/FileListTest.php index 7cf14156d5656..7d57917e3fb26 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/File/FileListTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/File/FileListTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\File; class FileListTest extends \PHPUnit_Framework_TestCase @@ -107,8 +105,8 @@ public function testReplace() $this->equalTo($files), $this->equalTo([ $this->_baseFile->getFileIdentifier() => $this->_baseFile, - $this->_themeFile->getFileIdentifier() => $this->_themeFile, ] - )) + $this->_themeFile->getFileIdentifier() => $this->_themeFile, ]) + ) ->will($this->returnValue($result)); $this->assertNull($this->_model->replace($files)); $this->assertSame($result, $this->_model->getAll()); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/FileSystemTest.php b/lib/internal/Magento/Framework/View/Test/Unit/FileSystemTest.php index 7ab094d7b3f3f..e62c2d1d1c93e 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/FileSystemTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/FileSystemTest.php @@ -4,13 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Test for view filesystem model */ namespace Magento\Framework\View\Test\Unit; +use \Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile; + class FileSystemTest extends \PHPUnit_Framework_TestCase { /** @@ -39,7 +39,7 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase protected $_staticFileResolution; /** - * @var \Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile|\PHPUnit_Framework_MockObject_MockObject + * @var EmailTemplateFile|\PHPUnit_Framework_MockObject_MockObject */ protected $_emailTemplateFileResolution; @@ -50,25 +50,47 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_fileResolution = $this->getMock( - \Magento\Framework\View\Design\FileResolution\Fallback\File::class, [], - [], '', false + $this->_fileResolution = $this->getMock( + \Magento\Framework\View\Design\FileResolution\Fallback\File::class, + [], + [], + '', + false ); - $this->_templateFileResolution = $this->getMock( - \Magento\Framework\View\Design\FileResolution\Fallback\TemplateFile::class, [], [], '', false + $this->_templateFileResolution = $this->getMock( + \Magento\Framework\View\Design\FileResolution\Fallback\TemplateFile::class, + [], + [], + '', + false ); - $this->_localeFileResolution = $this->getMock( - \Magento\Framework\View\Design\FileResolution\Fallback\LocaleFile::class, [], [], '', false + $this->_localeFileResolution = $this->getMock( + \Magento\Framework\View\Design\FileResolution\Fallback\LocaleFile::class, + [], + [], + '', + false ); - $this->_staticFileResolution = $this->getMock( - \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile::class, [], [], '', false + $this->_staticFileResolution = $this->getMock( + \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile::class, + [], + [], + '', + false ); - $this->_emailTemplateFileResolution = $this->getMock( - \Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile::class, [], [], '', false + $this->_emailTemplateFileResolution = $this->getMock( + EmailTemplateFile::class, + [], + [], + '', + false ); - $this->_assetRepo = $this->getMock( + $this->_assetRepo = $this->getMock( \Magento\Framework\View\Asset\Repository::class, - ['extractScope', 'updateDesignParams', 'createAsset'], [], '', false + ['extractScope', 'updateDesignParams', 'createAsset'], + [], + '', + false ); $this->_model = new \Magento\Framework\View\FileSystem( @@ -85,9 +107,14 @@ public function testGetFilename() { $params = [ 'area' => 'some_area', - 'themeModel' => $this->getMock( - \Magento\Framework\View\Design\ThemeInterface::class, [], [], '', false, false - ), + 'themeModel' => $this->getMock( + \Magento\Framework\View\Design\ThemeInterface::class, + [], + [], + '', + false, + false + ), 'module' => 'Some_Module', //It should be set in \Magento\Framework\View\Asset\Repository::extractScope // but PHPUnit has troubles with passing arguments by reference ]; @@ -112,9 +139,14 @@ public function testGetTemplateFileName() { $params = [ 'area' => 'some_area', - 'themeModel' => $this->getMock( - \Magento\Framework\View\Design\ThemeInterface::class, [], [], '', false, false - ), + 'themeModel' => $this->getMock( + \Magento\Framework\View\Design\ThemeInterface::class, + [], + [], + '', + false, + false + ), 'module' => 'Some_Module', //It should be set in \Magento\Framework\View\Asset\Repository::extractScope // but PHPUnit has troubles with passing arguments by reference ]; @@ -139,7 +171,7 @@ public function testGetLocaleFileName() { $params = [ 'area' => 'some_area', - 'themeModel' => $this->getMock( + 'themeModel' => $this->getMock( \Magento\Framework\View\Design\ThemeInterface::class, [], [], @@ -165,7 +197,7 @@ public function testGetViewFile() { $params = [ 'area' => 'some_area', - 'themeModel' => $this->getMock( + 'themeModel' => $this->getMock( \Magento\Framework\View\Design\ThemeInterface::class, [], [], @@ -263,8 +295,13 @@ public function testGetEmailTemplateFile() $locale = \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE; $params = [ 'area' => 'some_area', - 'themeModel' => $this->getMock( - \Magento\Framework\View\Design\ThemeInterface::class, [], [], '', false, false + 'themeModel' => $this->getMock( + \Magento\Framework\View\Design\ThemeInterface::class, + [], + [], + '', + false, + false ), 'module' => 'Some_Module', 'locale' => $locale diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Generator/BlockTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Generator/BlockTest.php index 2dfe9f607dd32..84542fad2d592 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Generator/BlockTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Generator/BlockTest.php @@ -151,8 +151,7 @@ public function testProcess( ->with($testArgumentData['argument']) ->willReturn($argumentData['argument']); } else { - $argumentInterpreter->expects($this->never())->method('evaluate') - ; + $argumentInterpreter->expects($this->never())->method('evaluate'); } /** @var \Magento\Framework\View\Element\BlockFactory|\PHPUnit_Framework_MockObject_MockObject $blockFactory */ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/MoveTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/MoveTest.php index 34d8be322935b..95591f194f46e 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/MoveTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/MoveTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\Layout\Reader; use Magento\Framework\View\Layout\ScheduledStructure; @@ -77,9 +75,9 @@ public function processDataProvider() { return [ 'move_before' => [ - 'element' => new \Magento\Framework\View\Layout\Element(' - - '), + 'element' => new \Magento\Framework\View\Layout\Element( + '' + ), 'destination' => 'product.info', 'siblingName' => 'before.block', 'isAfter' => false, @@ -87,9 +85,9 @@ public function processDataProvider() 'parentElement' => new \Magento\Framework\View\Layout\Element(''), ], 'move_after' => [ - 'element' => new \Magento\Framework\View\Layout\Element(' - - '), + 'element' => new \Magento\Framework\View\Layout\Element( + '' + ), 'destination' => 'product.info', 'siblingName' => 'after.block', 'isAfter' => true, diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/XsdTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/XsdTest.php index 224727d9953c0..beccf1994bed8 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/XsdTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/XsdTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\Layout; class XsdTest extends \PHPUnit_Framework_TestCase diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Result/LayoutTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Result/LayoutTest.php index ab97670dd6105..5fde3f3389c07 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Result/LayoutTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Result/LayoutTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\View\Test\Unit\Result; /** @@ -52,7 +50,7 @@ protected function setUp() $context->expects($this->any())->method('getEventManager')->will($this->returnValue($this->eventManager)); $this->resultLayout = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject( + ->getObject( \Magento\Framework\View\Result\Layout::class, ['context' => $context, 'translateInline' => $this->translateInline] ); @@ -105,7 +103,12 @@ public function testAddUpdate() * @dataProvider renderResultDataProvider */ public function testRenderResult( - $httpCode, $headerName, $headerValue, $replaceHeader, $setHttpResponseCodeCount, $setHeaderCount + $httpCode, + $headerName, + $headerValue, + $replaceHeader, + $setHttpResponseCodeCount, + $setHeaderCount ) { $layoutOutput = 'output'; diff --git a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/_files/simple.phtml b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/_files/simple.phtml index 246ec95b2280e..7395ac755ef91 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/_files/simple.phtml +++ b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/_files/simple.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> testMethod(); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/result.css b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/result.css index 0801b5a8cea1e..7d597feaebfd9 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/result.css +++ b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/result.css @@ -7,3 +7,4 @@ body {background: url(../two/another/body.gif);} a {background: url(data:image/png;)} li {background: url("https://example.com/absolute.gif");} ol.favicon {background: url(../two/another/Magento_Theme::favicon.ico)} /* base file */ + diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/resultImport.css b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/resultImport.css index 77aafa417e9c9..a945e71975ded 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/resultImport.css +++ b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/resultImport.css @@ -8,3 +8,4 @@ body {background: url(body.gif);} p {background: url(1.gif?param);} h1 {background: url('../h1.gif#param');} h2 {background: url(../images/h2.gif?test);} + diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/resultNormalized.css b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/resultNormalized.css index b63220a25bff6..cfc19e479b205 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/resultNormalized.css +++ b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/resultNormalized.css @@ -7,3 +7,4 @@ body {background: url(../two/another/body.gif);} a {background: url(data:image/png;)} li {background: url("https://example.com/absolute.gif");} ol.favicon {background: url(../two/another/Magento_Theme::favicon.ico)} /* base file */ + diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/source.css b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/source.css index 42b4c50c4efe8..e14240ea71017 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/source.css +++ b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/source.css @@ -7,3 +7,4 @@ body {background: url(body.gif);} a {background: url(data:image/png;)} li {background: url("https://example.com/absolute.gif");} ol.favicon {background: url(Magento_Theme::favicon.ico)} /* base file */ + diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/sourceImport.css b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/sourceImport.css index b1593c0b789a2..791e452811779 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/sourceImport.css +++ b/lib/internal/Magento/Framework/View/Test/Unit/Url/_files/sourceImport.css @@ -7,3 +7,4 @@ body {background: url(body.gif);} p {background: url(1.gif?param);} @import url("deep/recursive.css"); h1 {background: url('../h1.gif#param');} h2 {background: url(../images/h2.gif?test);} + diff --git a/lib/internal/Magento/Framework/Webapi/ErrorProcessor.php b/lib/internal/Magento/Framework/Webapi/ErrorProcessor.php index b3e01634347d2..6716eb4a1a1e6 100644 --- a/lib/internal/Magento/Framework/Webapi/ErrorProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ErrorProcessor.php @@ -165,8 +165,7 @@ public function maskException(\Exception $exception) */ public function renderException(\Exception $exception, $httpCode = self::DEFAULT_ERROR_HTTP_CODE) { - if ( - $this->_appState->getMode() == State::MODE_DEVELOPER || + if ($this->_appState->getMode() == State::MODE_DEVELOPER || $exception instanceof \Magento\Framework\Webapi\Exception ) { $this->renderErrorMessage($exception->getMessage(), $exception->getTraceAsString(), $httpCode); diff --git a/lib/internal/Magento/Framework/Webapi/Rest/Request.php b/lib/internal/Magento/Framework/Webapi/Rest/Request.php index 8de7a2c9ffd0d..9380ed4a8fe84 100644 --- a/lib/internal/Magento/Framework/Webapi/Rest/Request.php +++ b/lib/internal/Magento/Framework/Webapi/Rest/Request.php @@ -130,7 +130,6 @@ public function getBodyParams() if ($this->getContent()) { $this->_bodyParams = (array)$this->_getDeserializer()->deserialize((string)$this->getContent()); } - } return $this->_bodyParams; } diff --git a/lib/internal/Magento/Framework/Webapi/Rest/Request/ParamOverriderInterface.php b/lib/internal/Magento/Framework/Webapi/Rest/Request/ParamOverriderInterface.php index e19f8e14d7d05..f0f25bff26cf0 100644 --- a/lib/internal/Magento/Framework/Webapi/Rest/Request/ParamOverriderInterface.php +++ b/lib/internal/Magento/Framework/Webapi/Rest/Request/ParamOverriderInterface.php @@ -15,7 +15,7 @@ * invoked could have a signature of "getAddresses($customerId)", but in the webapi.xml, the $customerId parameter * would be forced to be the customer id of the current authenticated user. * - * The forced override parameter configuration is in the webapi.xml. + * The forced override parameter configuration is in the webapi.xml. * * * %customer_id% diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index 9e1d50ec7ed29..4f3235f50e35f 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -258,9 +258,9 @@ private function processCustomAttribute($customAttribute) if (!$customAttributeCode && !isset($customAttribute[AttributeValue::VALUE])) { throw new SerializationException(new Phrase('There is an empty custom attribute specified.')); - } else if (!$customAttributeCode) { + } elseif (!$customAttributeCode) { throw new SerializationException(new Phrase('A custom attribute is specified without an attribute code.')); - } else if (!isset($customAttribute[AttributeValue::VALUE])) { + } elseif (!isset($customAttribute[AttributeValue::VALUE])) { throw new SerializationException( new Phrase('Value is not set for attribute code "' . $customAttributeCode . '"') ); diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php index 0ebb6d9be4f3d..0f2fc6cef4b9d 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Webapi\Test\Unit; use Magento\Framework\Webapi\ServiceInputProcessor; @@ -67,7 +65,8 @@ function ($className) use ($objectManager) { $cache->expects($this->any())->method('load')->willReturn(false); $this->customAttributeTypeLocator = $this->getMockBuilder( - \Magento\Eav\Model\EavCustomAttributeTypeLocator::class) + \Magento\Eav\Model\EavCustomAttributeTypeLocator::class + ) ->disableOriginalConstructor() ->getMock(); @@ -460,7 +459,7 @@ protected function getObjectWithCustomAttributes($type, $value = []) { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $customAttributeValue = null; - switch($type) { + switch ($type) { case 'integer': $customAttributeValue = $value; break; diff --git a/pub/test.php b/pub/test.php new file mode 100644 index 0000000000000..c0e02c04c699b --- /dev/null +++ b/pub/test.php @@ -0,0 +1,11 @@ +