Skip to content

Commit 7e6f8ae

Browse files
author
Oleksii Korshenko
authored
MAGETWO-67508: Fixed coding standard violations in the Framework\Validator namespace #9251
2 parents 8a702c8 + b5aceb5 commit 7e6f8ae

File tree

4 files changed

+36
-25
lines changed

4 files changed

+36
-25
lines changed

lib/internal/Magento/Framework/Validator/Builder.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* See COPYING.txt for license details.
77
*/
88

9-
// @codingStandardsIgnoreFile
10-
119
namespace Magento\Framework\Validator;
1210

1311
use Magento\Framework\Validator\Constraint\OptionInterface;
@@ -257,7 +255,11 @@ protected function _createConstraint(array $data)
257255
}
258256

259257
if (\Magento\Framework\Validator\Config::CONSTRAINT_TYPE_PROPERTY == $data['type']) {
260-
$result = new \Magento\Framework\Validator\Constraint\Property($validator, $data['property'], $data['alias']);
258+
$result = new \Magento\Framework\Validator\Constraint\Property(
259+
$validator,
260+
$data['property'],
261+
$data['alias']
262+
);
261263
} else {
262264
$result = $this->_constraintFactory->create(['validator' => $validator, 'alias' => $data['alias']]);
263265
}
@@ -286,7 +288,10 @@ protected function _createConstraintValidator(array $data)
286288
// Check validator type
287289
if (!$validator instanceof \Magento\Framework\Validator\ValidatorInterface) {
288290
throw new \InvalidArgumentException(
289-
sprintf('Constraint class "%s" must implement \Magento\Framework\Validator\ValidatorInterface', $data['class'])
291+
sprintf(
292+
'Constraint class "%s" must implement \Magento\Framework\Validator\ValidatorInterface',
293+
$data['class']
294+
)
290295
);
291296
}
292297

@@ -300,8 +305,10 @@ protected function _createConstraintValidator(array $data)
300305
* @param array $options
301306
* @return void
302307
*/
303-
protected function _configureConstraintValidator(\Magento\Framework\Validator\ValidatorInterface $validator, array $options)
304-
{
308+
protected function _configureConstraintValidator(
309+
\Magento\Framework\Validator\ValidatorInterface $validator,
310+
array $options
311+
) {
305312
// Call all validator methods according to configuration
306313
if (isset($options['methods'])) {
307314
foreach ($options['methods'] as $methodData) {

lib/internal/Magento/Framework/Validator/Constraint/Property.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* See COPYING.txt for license details.
77
*/
88

9-
// @codingStandardsIgnoreFile
10-
119
namespace Magento\Framework\Validator\Constraint;
1210

1311
class Property extends \Magento\Framework\Validator\Constraint
@@ -33,8 +31,8 @@ public function __construct(\Magento\Framework\Validator\ValidatorInterface $val
3331
}
3432

3533
/**
36-
* Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or \ArrayAccess or array
37-
* is passed
34+
* Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or
35+
* \ArrayAccess or array is passed
3836
*
3937
* @param mixed $value
4038
* @return mixed

lib/internal/Magento/Framework/Validator/ConstraintFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* Factory class for \Magento\Framework\Validator\Constraint
119
*/
@@ -33,8 +31,10 @@ class ConstraintFactory
3331
* @param \Magento\Framework\ObjectManagerInterface $objectManager
3432
* @param string $instanceName
3533
*/
36-
public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, $instanceName = \Magento\Framework\Validator\Constraint::class)
37-
{
34+
public function __construct(
35+
\Magento\Framework\ObjectManagerInterface $objectManager,
36+
$instanceName = \Magento\Framework\Validator\Constraint::class
37+
) {
3838
$this->_objectManager = $objectManager;
3939
$this->_instanceName = $instanceName;
4040
}

lib/internal/Magento/Framework/Validator/Factory.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Framework\Validator;
78

89
use Magento\Framework\Cache\FrontendInterface;
910

10-
/**
11-
* @codingStandardsIgnoreFile
12-
*/
1311
class Factory
1412
{
15-
/**
16-
* Cache key
17-
*/
13+
/** cache key */
1814
const CACHE_KEY = __CLASS__;
1915

2016
/**
@@ -73,14 +69,19 @@ public function __construct(
7369

7470
/**
7571
* Init cached list of validation files
72+
*
73+
* @return void
7674
*/
7775
protected function _initializeConfigList()
7876
{
7977
if (!$this->_configFiles) {
8078
$this->_configFiles = $this->cache->load(self::CACHE_KEY);
8179
if (!$this->_configFiles) {
8280
$this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml');
83-
$this->cache->save($this->getSerializer()->serialize($this->_configFiles->toArray()), self::CACHE_KEY);
81+
$this->cache->save(
82+
$this->getSerializer()->serialize($this->_configFiles->toArray()),
83+
self::CACHE_KEY
84+
);
8485
} else {
8586
$filesArray = $this->getSerializer()->unserialize($this->_configFiles);
8687
$this->_configFiles = $this->getFileIteratorFactory()->create(array_keys($filesArray));
@@ -121,7 +122,9 @@ public function getValidatorConfig()
121122
$this->_initializeConfigList();
122123
$this->_initializeDefaultTranslator();
123124
return $this->_objectManager->create(
124-
\Magento\Framework\Validator\Config::class, ['configFiles' => $this->_configFiles]);
125+
\Magento\Framework\Validator\Config::class,
126+
['configFiles' => $this->_configFiles]
127+
);
125128
}
126129

127130
/**
@@ -161,7 +164,9 @@ public function createValidator($entityName, $groupName, array $builderConfig =
161164
private function getSerializer()
162165
{
163166
if ($this->serializer === null) {
164-
$this->serializer = $this->_objectManager->get(\Magento\Framework\Serialize\SerializerInterface::class);
167+
$this->serializer = $this->_objectManager->get(
168+
\Magento\Framework\Serialize\SerializerInterface::class
169+
);
165170
}
166171
return $this->serializer;
167172
}
@@ -175,8 +180,9 @@ private function getSerializer()
175180
private function getFileIteratorFactory()
176181
{
177182
if ($this->fileIteratorFactory === null) {
178-
$this->fileIteratorFactory = $this->_objectManager
179-
->get(\Magento\Framework\Config\FileIteratorFactory::class);
183+
$this->fileIteratorFactory = $this->_objectManager->get(
184+
\Magento\Framework\Config\FileIteratorFactory::class
185+
);
180186
}
181187
return $this->fileIteratorFactory;
182188
}

0 commit comments

Comments
 (0)