Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 4f70920

Browse files
authored
Merge pull request #17 from LinioIT/feat/chore-upgrade
chore: upgrading dependencies and PHP version from 7.0 to 7.4
2 parents 3e2a0b4 + 7814554 commit 4f70920

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+413
-564
lines changed

.php-cs-fixer.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__ . '/src')
5+
->in(__DIR__ . '/tests');
6+
7+
$config = new PhpCsFixer\Config();
8+
$config
9+
->setRiskyAllowed(true)
10+
->setRules(
11+
[
12+
'@Symfony' => true,
13+
'array_syntax' => ['syntax' => 'short'],
14+
'blank_line_after_opening_tag' => true,
15+
'concat_space' => ['spacing' => 'one'],
16+
'declare_strict_types' => true,
17+
'list_syntax' => ['syntax' => 'short'],
18+
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
19+
'modernize_types_casting' => true,
20+
'multiline_whitespace_before_semicolons' => true,
21+
'no_useless_else' => true,
22+
'no_useless_return' => true,
23+
'ordered_imports' => true,
24+
'phpdoc_align' => false,
25+
'phpdoc_order' => true,
26+
'php_unit_construct' => true,
27+
'php_unit_dedicate_assert' => true,
28+
'single_line_comment_style' => true,
29+
'ternary_to_null_coalescing' => true,
30+
]
31+
)
32+
->setFinder($finder)
33+
->setUsingCache(true)
34+
->setRiskyAllowed(true);
35+
36+
return $config;

.php_cs

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

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@
55
"type": "library",
66
"license": "BSD-3-Clause",
77
"require": {
8-
"php": "^7.0",
8+
"php": "^7.4",
99
"psr/http-message": "^1.0",
1010
"linio/microlog": "^1.0",
11-
"linio/util": "^2.1",
11+
"linio/util": "^3.0",
1212
"particle/filter": "^1.4",
1313
"particle/validator": "^2.1",
1414
"monolog/monolog": "^1.20",
1515
"zendframework/zend-expressive": "^1.0",
1616
"zendframework/zend-expressive-router": "^1.1"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^5.4 || ^7.0",
20-
"friendsofphp/php-cs-fixer": "^2.4",
21-
"eloquent/phony-phpunit": "^1.0 || ^4.0"
19+
"ext-json": "*",
20+
"phpunit/phpunit": "^9.5",
21+
"phpspec/prophecy-phpunit": "^2.0",
22+
"friendsofphp/php-cs-fixer": "^3.0",
23+
"eloquent/phony-phpunit": "^7.1"
2224
},
2325
"autoload": {
2426
"files": [
@@ -30,7 +32,8 @@
3032
},
3133
"autoload-dev": {
3234
"psr-4": {
33-
"Linio\\TestAssets\\": "tests/assets"
35+
"Linio\\TestAssets\\": "tests/assets",
36+
"Linio\\Common\\Expressive\\Tests\\": "tests/"
3437
}
3538
}
3639
}

phpunit.xml.dist

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.4/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
backupGlobals="false"
6-
beStrictAboutCoversAnnotation="true"
7-
beStrictAboutOutputDuringTests="true"
8-
beStrictAboutTestsThatDoNotTestAnything="true"
9-
beStrictAboutTodoAnnotatedTests="true"
10-
verbose="true">
11-
<testsuite>
12-
<directory suffix="Test.php">tests</directory>
1+
<?xml version="1.0"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
beStrictAboutCoversAnnotation="true"
7+
beStrictAboutOutputDuringTests="true"
8+
beStrictAboutTodoAnnotatedTests="true"
9+
verbose="true"
10+
>
11+
<coverage processUncoveredFiles="true">
12+
<include>
13+
<directory suffix=".php">src</directory>
14+
</include>
15+
</coverage>
16+
17+
<testsuites>
18+
<testsuite name="Linio\\Common\\Expressive\\">
19+
<directory>./tests</directory>
1320
</testsuite>
21+
</testsuites>
1422

15-
<filter>
16-
<whitelist processUncoveredFilesFromWhitelist="true">
17-
<directory suffix=".php">src</directory>
18-
</whitelist>
19-
</filter>
23+
<!--<logging>-->
24+
<!--<log type="coverage-clover" target="coverage.xml"/>-->
25+
<!--</logging>-->
2026
</phpunit>

src/Exception/Base/ClientException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
class ClientException extends DomainException
88
{
9-
const DEFAULT_STATUS_CODE = 400;
9+
public const DEFAULT_STATUS_CODE = 400;
1010
}

src/Exception/Base/DomainException.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class DomainException extends SplDomainException
1212
{
13-
const DEFAULT_STATUS_CODE = 500;
13+
public const DEFAULT_STATUS_CODE = 500;
1414

1515
/**
1616
* @var string
@@ -23,11 +23,7 @@ class DomainException extends SplDomainException
2323
private $errors;
2424

2525
/**
26-
* @param string $token
27-
* @param int $statusCode
28-
* @param string $message
2926
* @param array $errors An array of arrays containing either or both keys "field" and "message"
30-
* @param Exception $previous
3127
*/
3228
public function __construct(
3329
string $token,
@@ -43,17 +39,11 @@ public function __construct(
4339
parent::__construct($message, $statusCode, $previous);
4440
}
4541

46-
/**
47-
* @return string
48-
*/
4942
public function getToken(): string
5043
{
5144
return $this->token;
5245
}
5346

54-
/**
55-
* @return array
56-
*/
5747
public function getErrors(): array
5848
{
5949
return $this->errors;

src/Exception/Base/NotFoundException.php

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

99
class NotFoundException extends ClientException
1010
{
11-
/**
12-
* @param string $message
13-
* @param array $errors
14-
*/
1511
public function __construct(string $message = ExceptionTokens::ENTITY_NOT_FOUND, array $errors = [])
1612
{
1713
parent::__construct(ExceptionTokens::ENTITY_NOT_FOUND, ClientException::DEFAULT_STATUS_CODE, $message, $errors);

src/Exception/ExceptionTokens.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
class ExceptionTokens
88
{
9-
const CONTENT_TYPE_NOT_SUPPORTED = 'CONTENT_TYPE_NOT_SUPPORTED';
10-
const INVALID_REQUEST = 'INVALID_REQUEST';
11-
const ENTITY_NOT_FOUND = 'ENTITY_NOT_FOUND';
12-
const RUNTIME_EXCEPTION = 'RUNTIME_EXCEPTION';
13-
const AN_ERROR_HAS_OCCURRED = 'AN_ERROR_HAS_OCCURRED';
14-
const MIDDLEWARE_RUN_OUT_OF_ORDER = 'MIDDLEWARE_RUN_OUT_OF_ORDER';
15-
const VALIDATION_RULES_NOT_FOUND = 'VALIDATION_RULES_NOT_FOUND';
16-
const REQUEST_BODY_EMPTY_OR_NOT_CONVERTED_TO_ARRAY = 'REQUEST_BODY_EMPTY_OR_NOT_CONVERTED_TO_ARRAY';
17-
const ROUTE_NOT_FOUND = 'ROUTE_NOT_FOUND';
9+
public const CONTENT_TYPE_NOT_SUPPORTED = 'CONTENT_TYPE_NOT_SUPPORTED';
10+
public const INVALID_REQUEST = 'INVALID_REQUEST';
11+
public const ENTITY_NOT_FOUND = 'ENTITY_NOT_FOUND';
12+
public const RUNTIME_EXCEPTION = 'RUNTIME_EXCEPTION';
13+
public const AN_ERROR_HAS_OCCURRED = 'AN_ERROR_HAS_OCCURRED';
14+
public const MIDDLEWARE_RUN_OUT_OF_ORDER = 'MIDDLEWARE_RUN_OUT_OF_ORDER';
15+
public const VALIDATION_RULES_NOT_FOUND = 'VALIDATION_RULES_NOT_FOUND';
16+
public const REQUEST_BODY_EMPTY_OR_NOT_CONVERTED_TO_ARRAY = 'REQUEST_BODY_EMPTY_OR_NOT_CONVERTED_TO_ARRAY';
17+
public const ROUTE_NOT_FOUND = 'ROUTE_NOT_FOUND';
1818
}

src/Filter/FilterRules.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,5 @@
88

99
interface FilterRules
1010
{
11-
/**
12-
* @param Filter $filter
13-
* @param array $input
14-
*/
1511
public function buildRules(Filter $filter, array $input);
1612
}

src/Filter/FilterRulesFactory.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,15 @@
99

1010
class FilterRulesFactory
1111
{
12-
/**
13-
* @var ContainerInterface
14-
*/
15-
private $container;
12+
private ContainerInterface $container;
1613

17-
/**
18-
* @param ContainerInterface $container
19-
*/
2014
public function __construct(ContainerInterface $container)
2115
{
2216
$this->container = $container;
2317
}
2418

2519
/**
26-
* @param string $filterRulesClass
27-
*
2820
* @throws NotFoundException
29-
*
30-
* @return FilterRules
3121
*/
3222
public function make(string $filterRulesClass): FilterRules
3323
{

0 commit comments

Comments
 (0)