Skip to content

Commit

Permalink
Update packges
Browse files Browse the repository at this point in the history
  • Loading branch information
Bukashk0zzz committed Dec 4, 2019
1 parent bcc6e32 commit a1a6bb2
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 58 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
phpunit.xml
composer.lock
.php_cs.cache
.phpunit.result.cache
1 change: 1 addition & 0 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ return PhpCsFixer\Config::create()
'blank_line_after_opening_tag' => false,
'phpdoc_to_comment' => false,
'phpdoc_no_empty_return' => false,
'no_superfluous_phpdoc_tags' => false,
'strict_param' => true,
'doctrine_annotation_indentation' => true,
'mb_str_functions' => true,
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ language: php
sudo: false

php:
- 7.1
- 7.2
- 7.4

before_script:
- composer self-update
Expand Down
8 changes: 4 additions & 4 deletions Annotation/FilterAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ final class FilterAnnotation implements Annotation
private $filter;

/**
* @var mixed[] Options
* @var array<mixed> Options
*/
private $options;

/**
* Constructor
*
* @param mixed[] $parameters Filter parameters
* @param array<mixed> $parameters Filter parameters
*/
public function __construct(array $parameters)
{
Expand Down Expand Up @@ -79,15 +79,15 @@ public function setFilter($filter): FilterAnnotation
}

/**
* @return mixed[]|null
* @return array<mixed>|null
*/
public function getOptions(): ?array
{
return $this->options;
}

/**
* @param mixed[]|null $options
* @param array<mixed>|null $options
*
* @return FilterAnnotation
*/
Expand Down
2 changes: 1 addition & 1 deletion Form/EventListener/FilterListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(Filter $filterService)
}

/**
* @return string[]
* @return array<string>
*/
public static function getSubscribedEvents(): array
{
Expand Down
2 changes: 1 addition & 1 deletion Form/Extension/FormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getExtendedType()
/**
* {@inheritdoc}
*/
public static function getExtendedTypes()
public static function getExtendedTypes(): iterable
{
return [FormType::class];
}
Expand Down
4 changes: 2 additions & 2 deletions Service/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function filterEntity($object): void
}

/**
* @param string $class
* @param mixed[]|null $options
* @param string $class
* @param array<mixed>|null $options
*
* @return \Zend\Filter\FilterInterface
*/
Expand Down
19 changes: 9 additions & 10 deletions Tests/Annotation/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,51 +38,50 @@ public function testAllOptions(): void

/**
* Test annotation without any option
*
* @expectedException \LogicException
*/
public function testAnnotationWithoutOptions(): void
{
$this->expectException(\LogicException::class);
new FilterAnnotation([]);
}

/**
* Test annotation with wrong type for `filter` option
*
* @expectedException \InvalidArgumentException
*/
public function testWrongTypeForFilterOption(): void
{
$this->expectException(\InvalidArgumentException::class);

new FilterAnnotation(['filter' => 123]);
}

/**
* Test annotation with wrong zend filter class for `filter` option
*
* @expectedException \InvalidArgumentException
*/
public function testWrongFilterClassForFilterOption(): void
{
$this->expectException(\InvalidArgumentException::class);

new FilterAnnotation(['filter' => 'test']);
}

/**
* Test annotation with wrong type for `value` option
*
* @expectedException \InvalidArgumentException
*/
public function testWrongTypeForValueOption(): void
{
$this->expectException(\InvalidArgumentException::class);

new FilterAnnotation(['value' => 123]);
}

/**
* Test annotation with wrong type for `options` option
*
* @expectedException \TypeError
*/
public function testWrongTypeForOptionsOption(): void
{
$this->expectException(\TypeError::class);

new FilterAnnotation(['filter' => 'StringTrim', 'options' => 123]);
}
}
4 changes: 2 additions & 2 deletions Tests/DependencyInjection/Bukashk0zzzFilterExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Bukashk0zzzFilterExtensionTest extends TestCase
private $container;

/**
* {@inheritdoc}
* Setup
*/
protected function setUp()
protected function setUp(): void
{
$this->extension = new Bukashk0zzzFilterExtension();
$this->container = new ContainerBuilder();
Expand Down
12 changes: 7 additions & 5 deletions Tests/EventListener/FilterSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\ORM\Event\LifecycleEventArgs;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -26,7 +28,7 @@ public function testPersist(): void
$lifeCycleEvent = $this->mockEvent('LifecycleEventArgs');
$lifeCycleEvent->expects(static::once())->method('getEntity')->willReturn($user);

/** @var \Doctrine\ORM\Event\LifecycleEventArgs $lifeCycleEvent */
/** @var LifecycleEventArgs $lifeCycleEvent */
$subscriber = new FilterSubscriber($filter);
$subscriber->prePersist($lifeCycleEvent);
}
Expand All @@ -42,7 +44,7 @@ public function testUpdate(): void
$lifeCycleEvent = $this->mockEvent('LifecycleEventArgs');
$lifeCycleEvent->expects(static::once())->method('getEntity')->willReturn($user);

/** @var \Doctrine\ORM\Event\LifecycleEventArgs $lifeCycleEvent */
/** @var LifecycleEventArgs $lifeCycleEvent */
$subscriber = new FilterSubscriber($filter);
$subscriber->preUpdate($lifeCycleEvent);
}
Expand All @@ -65,13 +67,13 @@ public function testSubscription(): void
*
* @param string $eventType
*
* @return \PHPUnit_Framework_MockObject_MockObject
* @return MockObject
*/
private function mockEvent(string $eventType): \PHPUnit_Framework_MockObject_MockObject
private function mockEvent(string $eventType): MockObject
{
return $this->createPartialMock(
'\Doctrine\ORM\Event\\'.$eventType,
['getEntityManager', 'getEntity', 'getEntityChangeSet']
['getEntityManager', 'getEntity']
);
}
}
4 changes: 2 additions & 2 deletions Tests/Form/AbstractFormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ abstract class AbstractFormTypeExtension extends TypeTestCase
protected $autoFilter = true;

/**
* {@inheritdoc}
* @return array<mixed>
*/
protected function getExtensions()
protected function getExtensions(): array
{
return \array_merge(parent::getExtensions(), [
new FilterExtension(new Filter(new CachedReader(new AnnotationReader(), new ArrayCache())), $this->autoFilter),
Expand Down
4 changes: 2 additions & 2 deletions Tests/Form/FormTypeExtensionBadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class FormTypeExtensionBadTest extends AbstractFormTypeExtension
{
/**
* Test annotation with wrong zend filter class for `filter` option
*
* @expectedException \InvalidArgumentException
*/
public function testWrongFilterClassForFilterOption(): void
{
$this->expectException(\InvalidArgumentException::class);

$user = new BadUser();
$form = $this->factory->create(UserType::class, $user, ['data_class' => BadUser::class]);
$form->submit([
Expand Down
4 changes: 2 additions & 2 deletions Tests/Form/FormTypeExtensionWithoutFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
class FormTypeExtensionWithoutFilterTest extends AbstractFormTypeExtension
{
/**
* {@inheritdoc}
* Setup
*/
public function setUp()
public function setUp(): void
{
$this->autoFilter = false;
parent::setUp();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Service/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class FilterTest extends TestCase
protected $filter;

/**
* {@inheritdoc}
* Setup
*/
protected function setUp()
protected function setUp(): void
{
$this->filter = new Filter(new CachedReader(new AnnotationReader(), new ArrayCache()));
}
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
"issues": "https://github.com/bukashk0zzz/FilterBundle/issues"
},
"require": {
"php": ">=7.1.0",
"symfony/dependency-injection": "^3.3|^4.0",
"symfony/config": "^3.3|^4.0",
"symfony/http-kernel": "^3.3|^4.0",
"symfony/form": "^3.3|^4.0",
"symfony/yaml": "^3.3|^4.0",
"php": ">=7.2.0",
"symfony/dependency-injection": "^4.0|^5.0",
"symfony/config": "^4.0|^5.0",
"symfony/http-kernel": "^4.0|^5.0",
"symfony/form": "^4.0|^5.0",
"symfony/yaml": "^4.0|^5.0",
"doctrine/orm": "^2.5",
"zendframework/zend-filter": "^2.6"
},
"require-dev": {
"escapestudios/symfony2-coding-standard": "^3.0",
"slevomat/coding-standard": "^4.0",
"slevomat/coding-standard": "^5.0",
"friendsofphp/php-cs-fixer": "^2.3",
"phpunit/phpunit": "^6.2"
"phpunit/phpunit": "^8.4"
},
"autoload": {
"psr-4": {
Expand Down
25 changes: 10 additions & 15 deletions ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="Bukashk0zzz">
<description>Bukashk0zzz coding standard.</description>
<ruleset name="Coding standard">
<description>Coding standard.</description>

<rule ref="./vendor/escapestudios/symfony2-coding-standard/Symfony"/>
<rule ref="./vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml" />
Expand All @@ -24,21 +24,20 @@
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectLinesCountBetweenDifferentAnnotationsTypes"/>
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment.MultiLinePropertyComment"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses.UselessParentheses"/>
<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.TraitUseSpacing.IncorrectLinesCountBeforeFirstUse"/>
<exclude name="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces.NoEmptyLineAfterOpeningBrace"/>
<exclude name="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces.NoEmptyLineBeforeClosingBrace"/>
<exclude name="SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator.UselessTernaryOperator"/>
<exclude name="SlevomatCodingStandard.Functions.TrailingCommaInCall.MissingTrailingComma"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"/>
</rule>

<rule ref="SlevomatCodingStandard.Types.EmptyLinesAroundTypeBraces">
<properties>
<property name="linesCountAfterOpeningBrace" value="0"/>
<property name="linesCountBeforeClosingBrace" value="0"/>
</properties>
</rule>

<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="allowFullyQualifiedExceptions" value="true"/>
Expand Down Expand Up @@ -69,10 +68,6 @@
<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"/>
Expand Down

0 comments on commit a1a6bb2

Please sign in to comment.