Skip to content

Commit 82ed6bb

Browse files
authored
Merge pull request #70 from MortalFlesh/feature/use-php-74
Require php 7.4 and update dependencies
2 parents 64413fd + f20182d commit 82ed6bb

38 files changed

+120
-178
lines changed

.coveralls.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
php-version: ['7.3']
15+
php-version: ['7.4']
1616
dependencies: ['']
1717
include:
18-
- { php-version: '7.3', dependencies: '--prefer-lowest --prefer-stable' }
18+
- { php-version: '7.4', dependencies: '--prefer-lowest --prefer-stable' }
1919

2020
name: Unit tests - PHP ${{ matrix.dependencies }}
2121

@@ -65,7 +65,7 @@ jobs:
6565
- name: Setup PHP
6666
uses: shivammathur/setup-php@v2
6767
with:
68-
php-version: '7.3'
68+
php-version: '7.4'
6969
extensions: mbstring, intl
7070

7171
- name: Install dependencies

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
/vendor/
33
composer.lock
44

5+
.phpunit.result.cache
56
/reports/

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<!-- There should always be "Unreleased" section at the beginning. -->
55

66
## Unreleased
7+
- Require php 7.4 and update dependencies
78

89
## 2.1.0 - 2020-11-11
910
- Add **Filter**

composer.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@
44
"description": "Parser/builder for filters from API query parameters.",
55
"license": "MIT",
66
"require": {
7-
"php": "^7.3",
7+
"php": "^7.4",
88
"ext-mbstring": "*",
9-
"beberlei/assert": "^2.9 || ^3.0",
10-
"mf/collections-php": "^4.0"
9+
"beberlei/assert": "^3.0",
10+
"mf/collections-php": "^5.0"
1111
},
1212
"require-dev": {
1313
"doctrine/orm": "^2.7",
1414
"ergebnis/composer-normalize": "^2.5",
15-
"lmc/coding-standard": "^2.0",
16-
"mockery/mockery": "^1.3",
17-
"php-coveralls/php-coveralls": "^2.2",
15+
"lmc/coding-standard": "^3.0",
16+
"mockery/mockery": "^1.4",
1817
"php-parallel-lint/php-parallel-lint": "^1.2",
1918
"phpstan/extension-installer": "^1.0",
2019
"phpstan/phpstan": "^0.12.23",
2120
"phpstan/phpstan-beberlei-assert": "^0.12.2",
2221
"phpstan/phpstan-mockery": "^0.12.5",
23-
"phpunit/phpunit": "^7.5"
22+
"phpunit/phpunit": "^9.5"
2423
},
2524
"suggest": {
2625
"doctrine/orm": "To allow applying filters directly to QueryBuilder"
@@ -48,9 +47,9 @@
4847
"@cs",
4948
"@phpstan"
5049
],
51-
"cs": "vendor/bin/ecs check --ansi src/ tests/",
50+
"cs": "vendor/bin/ecs check --ansi src/ tests/ ecs.php",
5251
"fix": [
53-
"vendor/bin/ecs check --ansi --clear-cache --fix src/ tests/",
52+
"vendor/bin/ecs check --ansi --clear-cache --fix src/ tests/ ecs.php",
5453
"@composer normalize"
5554
],
5655
"lint": [

easy-coding-standard.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

ecs.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Lmc\CodingStandard\Sniffs\Naming\ClassNameSuffixByParentSniff;
6+
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
7+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
8+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
9+
use Symplify\EasyCodingStandard\ValueObject\Option;
10+
11+
return static function (ContainerConfigurator $containerConfigurator): void {
12+
$parameters = $containerConfigurator->parameters();
13+
14+
$parameters->set(
15+
Option::SKIP,
16+
['SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff.ReferencedGeneralException' => ['tests/Exception/*.php']]
17+
);
18+
19+
$containerConfigurator->import(__DIR__ . '/vendor/lmc/coding-standard/ecs.php');
20+
21+
$services = $containerConfigurator->services();
22+
23+
$services->set(PhpUnitTestAnnotationFixer::class)
24+
->call('configure', [['style' => 'annotation']]);
25+
26+
$services->set(ClassNameSuffixByParentSniff::class)
27+
->property('extraParentTypesToSuffixes', ['*ApplicatorInterface' => 'Applicator']);
28+
29+
$services->set(NoSuperfluousPhpdocTagsFixer::class)
30+
->call('configure', [['allow_mixed' => true]]);
31+
};

phpstan.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ parameters:
44
paths:
55
- src/
66
- tests/
7+
8+
ignoreErrors:
9+
- '#Parameter \#1 \$expected of method PHPUnit\\Framework\\Assert::assertInstanceOf\(\) expects class\-string<object>, string given.#'

phpunit.xml.dist

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
colors="true"
77
bootstrap="vendor/autoload.php"
88
>
9+
10+
<coverage>
11+
<include>
12+
<directory suffix=".php">src</directory>
13+
</include>
14+
<report>
15+
<clover outputFile="./reports/clover.xml"/>
16+
<html outputDirectory="./reports" highLowerBound="90"/>
17+
</report>
18+
</coverage>
19+
920
<php>
1021
<!-- E_ALL = 30719 -->
1122
<ini name="error_reporting" value="30719"/>
@@ -17,15 +28,7 @@
1728
</testsuite>
1829
</testsuites>
1930

20-
<filter>
21-
<whitelist>
22-
<directory suffix=".php">src</directory>
23-
</whitelist>
24-
</filter>
25-
2631
<logging>
27-
<log type="coverage-html" target="./reports" highLowerBound="90"/>
28-
<log type="coverage-clover" target="./reports/clover.xml"/>
29-
<log type="junit" target="./reports/junit.xml"/>
32+
<junit outputFile="./reports/junit.xml"/>
3033
</logging>
3134
</phpunit>

src/ApiFilter.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,10 @@
2121

2222
class ApiFilter
2323
{
24-
/** @var Functions */
25-
private $functions;
26-
/** @var QueryParametersParser */
27-
private $parser;
28-
/** @var FilterApplicator */
29-
private $applicator;
30-
/** @var FunctionCreator */
31-
private $functionCreator;
24+
private Functions $functions;
25+
private QueryParametersParser $parser;
26+
private FilterApplicator $applicator;
27+
private FunctionCreator $functionCreator;
3228

3329
public function __construct()
3430
{

src/Entity/ParameterDefinition.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@
88

99
class ParameterDefinition
1010
{
11-
/** @var string */
12-
private $name;
13-
/** @var string */
14-
private $filter;
15-
/** @var string */
16-
private $column;
17-
/** @var ?Value */
18-
private $defaultValue;
11+
private string $name;
12+
private string $filter;
13+
private string $column;
14+
private ?Value $defaultValue;
1915

2016
/**
2117
* Shortcut for creating parameter with just a name and a default value

src/Exception/InvalidArgumentException.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66

77
class InvalidArgumentException extends \InvalidArgumentException implements ApiFilterExceptionInterface, AssertionFailedException
88
{
9-
/** @var null|string */
10-
private $propertyPath;
9+
private ?string $propertyPath;
1110
/** @var mixed */
1211
private $value;
13-
/** @var array */
14-
private $constraints;
12+
private array $constraints;
1513

1614
/**
1715
* @param mixed $value

src/Filter/AbstractFilter.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@
77

88
abstract class AbstractFilter implements FilterInterface
99
{
10-
/** @var string */
11-
private $title;
12-
/** @var string */
13-
private $column;
14-
/** @var Value */
15-
private $value;
16-
/** @var ?string */
17-
private $fullTitle;
10+
private string $title;
11+
private string $column;
12+
private Value $value;
13+
private ?string $fullTitle = null;
1814

1915
public function __construct(string $title, string $column, Value $value)
2016
{

src/Filter/FilterWithOperator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
class FilterWithOperator extends AbstractFilter
88
{
9-
/** @var string */
10-
private $operator;
9+
private string $operator;
1110

1211
public function __construct(string $column, Value $value, string $operator, string $title)
1312
{

src/Filters/Filters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class Filters implements FiltersInterface
1717
{
1818
/** @var IList<FilterInterface> */
19-
private $filters;
19+
private IList $filters;
2020

2121
/** @param FilterInterface[] $filters */
2222
public static function from(array $filters): FiltersInterface

src/Service/FilterApplicator.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818
class FilterApplicator
1919
{
2020
/** @var PrioritizedCollection|ApplicatorInterface[] */
21-
private $applicators;
22-
/** @var Functions */
23-
private $functions;
24-
/** @var FiltersInterface */
25-
private $filters;
21+
private PrioritizedCollection $applicators;
22+
private Functions $functions;
23+
private ?FiltersInterface $filters = null;
2624

2725
public function __construct(Functions $functions)
2826
{

src/Service/FunctionCreator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
class FunctionCreator
1616
{
17-
/** @var FilterFactory */
18-
private $filterFactory;
17+
private FilterFactory $filterFactory;
1918

2019
public function __construct(FilterFactory $filterFactory)
2120
{

src/Service/Functions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class Functions
1515
private const FUNCTION_NAME_TYPE = 'string';
1616

1717
/** @var IMap<string, callable> */
18-
private $functions;
18+
private IMap $functions;
1919
/** @var IMap<string, array> */
20-
private $functionParameters;
20+
private IMap $functionParameters;
2121
/** @var IMap<string, array<ParameterDefinition>> */
22-
private $parameterDefinitions;
22+
private IMap $parameterDefinitions;
2323
/** @var array<string, string> parameterName => functionName */
24-
private $registeredParameters;
24+
private array $registeredParameters;
2525

2626
public function __construct()
2727
{

src/Service/Parser/AbstractParser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
abstract class AbstractParser implements ParserInterface
1111
{
12-
/** @var FilterFactory */
13-
private $filterFactory;
12+
private FilterFactory $filterFactory;
1413

1514
public function __construct(FilterFactory $filterFactory)
1615
{

src/Service/Parser/FunctionParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class FunctionParser extends AbstractParser
1919
{
2020
/** @var PrioritizedCollection|FunctionParserInterface[] */
21-
private $parsers;
21+
private PrioritizedCollection $parsers;
2222

2323
public function __construct(FilterFactory $filterFactory, Functions $functions)
2424
{

src/Service/Parser/FunctionParser/AbstractFunctionParser.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ abstract class AbstractFunctionParser extends AbstractParser implements Function
1414
private const ERROR_MULTIPLE_FUNCTION_CALL = 'It is not allowed to call one function multiple times.';
1515
protected const ERROR_FUNCTION_DEFINITION_BY_TUPLE_WITHOUT_TUPLE_VALUES = 'Function definition by a tuple must have a tuple value.';
1616

17-
/** @var Functions */
18-
protected $functions;
19-
/** @var ?array */
20-
private $queryParameters;
17+
protected Functions $functions;
18+
private ?array $queryParameters = null;
2119
/** @var IMap<string,bool>|IMap|null */
22-
private $alreadyParsedFunctions;
20+
private ?IMap $alreadyParsedFunctions;
2321
/** @var IMap<string,bool>|IMap|null */
24-
private $alreadyParsedColumns;
22+
private ?IMap $alreadyParsedColumns;
2523

2624
public function __construct(FilterFactory $filterFactory, Functions $functions)
2725
{

src/Service/Parser/FunctionParser/ImplicitFunctionDefinitionByValueParser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
class ImplicitFunctionDefinitionByValueParser extends AbstractFunctionParser
88
{
9-
/** @var ?bool */
10-
private $isAllImplicitFunctionDefinitionsChecked;
9+
private ?bool $isAllImplicitFunctionDefinitionsChecked;
1110

1211
public function setCommonValues(
1312
array $queryParameters,

0 commit comments

Comments
 (0)