Skip to content

Commit

Permalink
Update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Bukashk0zzz committed Jan 31, 2019
1 parent 13cf61c commit 1728ca1
Show file tree
Hide file tree
Showing 20 changed files with 34 additions and 166 deletions.
14 changes: 4 additions & 10 deletions Annotation/FilterAnnotation.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Annotation;

Expand Down Expand Up @@ -47,9 +39,11 @@ public function __construct(array $parameters)
$this->setFilter($parameters['filter']);
}

if (\array_key_exists('options', $parameters)) {
$this->setOptions($parameters['options']);
if (!\array_key_exists('options', $parameters)) {
return;
}

$this->setOptions($parameters['options']);
}

/**
Expand Down
8 changes: 0 additions & 8 deletions Bukashk0zzzFilterBundle.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle;

Expand Down
8 changes: 0 additions & 8 deletions DependencyInjection/Bukashk0zzzFilterExtension.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\DependencyInjection;

Expand Down
8 changes: 0 additions & 8 deletions DependencyInjection/Configuration.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\DependencyInjection;

Expand Down
8 changes: 0 additions & 8 deletions EventListener/FilterSubscriber.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\EventListener;

Expand Down
8 changes: 0 additions & 8 deletions Form/EventListener/FilterListener.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Form\EventListener;

Expand Down
8 changes: 0 additions & 8 deletions Form/Extension/FormTypeExtension.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Form\Extension;

Expand Down
30 changes: 14 additions & 16 deletions Service/Filter.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Service;

Expand Down Expand Up @@ -46,18 +38,23 @@ public function filterEntity($object): void
}

$reflectionClass = ClassUtils::newReflectionClass(\get_class($object));

foreach ($reflectionClass->getProperties() as $property) {
foreach ($this->annotationReader->getPropertyAnnotations($property) as $annotation) {
if ($annotation instanceof FilterAnnotation) {
$property->setAccessible(true);
$value = $property->getValue($object);
if (!($annotation instanceof FilterAnnotation)) {
continue;
}

if ($value) {
$filter = $annotation->getFilter();
$options = $annotation->getOptions();
$property->setValue($object, $this->getZendInstance($filter, $options)->filter($value));
}
$property->setAccessible(true);
$value = $property->getValue($object);

if (!$value) {
continue;
}

$filter = $annotation->getFilter();
$options = $annotation->getOptions();
$property->setValue($object, $this->getZendInstance($filter, $options)->filter($value));
}
}
}
Expand All @@ -74,6 +71,7 @@ protected function getZendInstance(string $class, ?array $options): FilterInterf
$filter = new $class();

$abstractFilterClass = AbstractFilter::class;

if (!$filter instanceof $abstractFilterClass) {
throw new \InvalidArgumentException("Filter class must extend $abstractFilterClass: $class");
}
Expand Down
8 changes: 0 additions & 8 deletions Tests/Annotation/FilterTest.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Annotation;

Expand Down
8 changes: 0 additions & 8 deletions Tests/DependencyInjection/Bukashk0zzzFilterExtensionTest.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzFilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\DependencyInjection;

Expand Down
12 changes: 1 addition & 11 deletions Tests/EventListener/FilterSubscriberTest.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\EventListener;

Expand Down Expand Up @@ -77,11 +69,9 @@ public function testSubscription(): void
*/
private function mockEvent(string $eventType): \PHPUnit_Framework_MockObject_MockObject
{
$lifeCycleEvent = $this->createPartialMock(
return $this->createPartialMock(
'\Doctrine\ORM\Event\\'.$eventType,
['getEntityManager', 'getEntity', 'getEntityChangeSet']
);

return $lifeCycleEvent;
}
}
8 changes: 0 additions & 8 deletions Tests/Fixtures/BadUser.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Fixtures;

Expand Down
8 changes: 0 additions & 8 deletions Tests/Fixtures/User.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Fixtures;

Expand Down
8 changes: 0 additions & 8 deletions Tests/Fixtures/UserType.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Fixtures;

Expand Down
8 changes: 0 additions & 8 deletions Tests/Form/AbstractFormTypeExtension.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Form;

Expand Down
8 changes: 0 additions & 8 deletions Tests/Form/FormTypeExtensionBadTest.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Form;

Expand Down
8 changes: 0 additions & 8 deletions Tests/Form/FormTypeExtensionTest.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Form;

Expand Down
8 changes: 0 additions & 8 deletions Tests/Form/FormTypeExtensionWithoutFilterTest.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Form;

Expand Down
8 changes: 0 additions & 8 deletions Tests/Service/FilterTest.php
@@ -1,12 +1,4 @@
<?php declare(strict_types = 1);
/*
* This file is part of the FilterBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bukashk0zzz\FilterBundle\Tests\Service;

Expand Down
16 changes: 15 additions & 1 deletion ruleset.xml
Expand Up @@ -20,7 +20,16 @@
<exclude name="SlevomatCodingStandard.Namespaces.UseOnlyWhitelistedNamespaces"/>
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation.NonFullyQualifiedClassName"/>
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions"/>
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName"/>
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName"/>
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectLinesCountBetweenDifferentAnnotationsTypes"/>
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment.MultiLinePropertyComment"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator.DisallowedShortTernaryOperator"/>
<exclude name="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators.DisallowedPreIncrementOperator"/>
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses.UselessParentheses"/>
<exclude name="SlevomatCodingStandard.Classes.TraitUseSpacing.IncorrectLinesCountBeforeFirstUse"/>
<exclude name="SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"/>
</rule>

<rule ref="SlevomatCodingStandard.Types.EmptyLinesAroundTypeBraces">
Expand Down Expand Up @@ -60,9 +69,14 @@
<severity>0</severity>
</rule>

<rule ref="Zend.NamingConventions.ValidVariableName.MemberVarContainsNumbers">
<severity>0</severity>
</rule>

<arg name="colors"/>
<arg name="encoding" value="utf-8"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="128" />

<exclude-pattern>vendor/</exclude-pattern>

Expand Down

0 comments on commit 1728ca1

Please sign in to comment.