Skip to content

Commit 22bf1ca

Browse files
authored
bump dependencies and CI (#15)
* bump versions and CI * bump versions and CI * bump prophecy-phpunit * update scrutinizer config * update revision for scrutinizer * minimum version php 8.2 * cleanup code * properly handle null json * bump phpunit * bump phpunit * fix phpstan stuff * update no_superfluous_phpdoc_tags cs fixer rule * update collection package
1 parent 9e46a21 commit 22bf1ca

38 files changed

+119
-253
lines changed

.github/workflows/php.yml

+20-8
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@ on:
1010
jobs:
1111
test:
1212

13-
name: Test PHP ${{ matrix.php-versions }}
13+
name: Test PHP ${{ matrix.php.version }} ${{ matrix.php.composer_flags }}
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
php-versions: ['8.0', '8.1', '8.2']
17+
php:
18+
- version: '8.2'
19+
composer_flags: --prefer-lowest
20+
- version: '8.3'
21+
composer_flags: --prefer-lowest
22+
- version: '8.4'
23+
composer_flags: --prefer-lowest
24+
- version: '8.2'
25+
composer_flags: --prefer-stable
26+
- version: '8.3'
27+
composer_flags: --prefer-stable
28+
- version: '8.4'
29+
composer_flags: --prefer-stable
1830

1931
steps:
2032
- uses: actions/checkout@v3
@@ -27,7 +39,7 @@ jobs:
2739
- name: Setup PHP
2840
uses: shivammathur/setup-php@v2
2941
with:
30-
php-version: ${{ matrix.php-versions }}
42+
php-version: ${{ matrix.php.version }}
3143
extensions: curl, mbstring, intl, libxml, simplexml
3244
coverage: xdebug
3345

@@ -40,17 +52,17 @@ jobs:
4052
uses: actions/cache@v3
4153
with:
4254
path: ${{ steps.composer-cache-dir.outputs.dir }}
43-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
44-
restore-keys: ${{ runner.os }}-composer-
55+
key: ${{ runner.os }}-composer-${{ matrix.php.composer_flags }}-${{ hashFiles('**/composer.json') }}
56+
restore-keys: ${{ runner.os }}-composer-${{ matrix.php.composer_flags }}-
4557

4658
- name: Install dependencies
47-
run: (test -d vendor && echo vendor directory exists) || composer install --prefer-dist --no-progress --no-suggest
59+
run: (test -d vendor && echo vendor directory exists) || composer update ${{ matrix.php.composer_flags }} --no-progress --no-suggest
4860

4961
- name: Run PHPUnit
5062
run: ./bin/phpunit --coverage-text --coverage-clover clover.xml
5163

5264
- name: Upload Scrutinizer coverage
53-
if: matrix.php-versions == '8.0'
65+
if: matrix.php.version == '8.2' && matrix.php.composer_flags == '--prefer-stable'
5466
uses: sudo-bot/action-scrutinizer@latest
5567
with:
56-
cli-args: "--format=php-clover clover.xml"
68+
cli-args: "--format=php-clover clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ composer.lock
88
/.coveralls.yml
99
/clover.xml
1010
/coveralls-upload.json
11+
/rector.php

.php-cs-fixer.dist.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'no_singleline_whitespace_before_semicolons' => true,
2323
'no_spaces_after_function_name' => true,
2424
'no_spaces_around_offset' => true,
25-
'no_superfluous_phpdoc_tags' => false,
25+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => false, 'allow_unused_params' => true],
2626
'no_unused_imports' => true,
2727
'no_useless_else' => true,
2828
'no_whitespace_before_comma_in_array' => true,
@@ -38,7 +38,6 @@
3838
'phpdoc_types_order' => ['null_adjustment' => 'always_first'],
3939
'protected_to_private' => true,
4040
'single_blank_line_at_eof' => true,
41-
'single_blank_line_before_namespace' => true,
4241
'single_line_comment_style' => false,
4342
'single_line_throw' => false,
4443
'single_quote' => false,

.scrutinizer.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build:
2+
image: default-bionic
23
nodes:
34
analysis:
45
project_setup:

composer.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
"description": "A library to manage patch requests",
44
"keywords": ["rest", "patch", "api", "symfony", "bundle"],
55
"require": {
6-
"php": "^8.0",
6+
"php": "^8.2",
77
"ext-json": "*",
8-
"symfony/property-access": "^4.0 || ^5.0 || ^6.0",
9-
"symfony/http-foundation": "^4.0 || ^5.0 || ^6.0",
10-
"symfony/options-resolver": "^4.0 || ^5.0 || ^6.0",
11-
"symfony/dependency-injection": "^4.0 || ^5.0 || ^6.0",
12-
"symfony/http-kernel": "^4.0 || ^5.0 || ^6.0",
13-
"symfony/config": "^4.0 || ^5.0 || ^6.0",
14-
"symfony/event-dispatcher": "^4.0 || ^5.0 || ^6.0",
15-
"mattiabasone/phpcollection": "^0.7.0"
8+
"symfony/property-access": "^6.0 || ^7.0",
9+
"symfony/http-foundation": "^6.0 || ^7.0",
10+
"symfony/options-resolver": "^6.0 || ^7.0",
11+
"symfony/dependency-injection": "^6.0 || ^7.0",
12+
"symfony/http-kernel": "^6.0 || ^7.0",
13+
"symfony/config": "^6.0 || ^7.0",
14+
"symfony/event-dispatcher": "^6.0 || ^7.0",
15+
"mattiabasone/phpcollection": "^1.0.0"
1616
},
1717
"require-dev": {
18-
"friendsofphp/php-cs-fixer": "^3.1",
19-
"phpunit/phpunit": "^9.5",
18+
"friendsofphp/php-cs-fixer": "^3.70",
19+
"phpunit/phpunit": "^11.5",
2020
"mockery/mockery": "^1.4",
2121
"yohang/finite": "^1.2",
2222
"doctrine/orm": "^2.9",
23-
"phpspec/prophecy-phpunit": "^2.0",
23+
"phpspec/prophecy-phpunit": "^2.3",
2424
"phpstan/phpstan": "^1.0",
2525
"phpstan/phpstan-doctrine": "^1.0",
2626
"phpstan/phpstan-mockery": "^1.0"

phpstan.neon

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ parameters:
66
level: 6 #https://phpstan.org/user-guide/rule-levels
77
paths:
88
- src
9-
- tests
10-
checkGenericClassInNonGenericObjectType: false
119
ignoreErrors:
1210
- '#no value type specified in iterable type#'
1311
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\)#'
14-
- '#Call to an undefined method Prophecy\\Prophecy#'
1512
- '#Method Cypress\\PatchManager\\OperationMatcher::getUnmatchedOperations\(\) should return PhpCollection\\Sequence but returns PhpCollection\\AbstractSequence#'
16-
- '#Property Cypress\\PatchManager\\Tests\\FakeObjects\\Subject(A|B)::\$a is never read, only written#'
13+
- '#Property Cypress\\PatchManager\\Exception\\InvalidJsonRequestContent::\$message has no type specified#'

phpunit.xml.dist

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
3-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4-
backupGlobals = "false"
5-
backupStaticAttributes = "false"
6-
colors = "true"
7-
convertErrorsToExceptions = "true"
8-
convertNoticesToExceptions = "true"
9-
convertWarningsToExceptions = "true"
10-
processIsolation = "false"
11-
stopOnFailure = "false" >
12-
13-
<coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
3+
backupGlobals="false"
4+
colors= "true"
5+
displayDetailsOnTestsThatTriggerDeprecations="true"
6+
displayDetailsOnTestsThatTriggerErrors="true"
7+
displayDetailsOnTestsThatTriggerNotices="true"
8+
displayDetailsOnTestsThatTriggerWarnings="true"
9+
displayDetailsOnPhpunitDeprecations="true"
10+
processIsolation="false"
11+
stopOnFailure= "false"
12+
>
13+
<source>
1414
<include>
1515
<directory>./src</directory>
1616
</include>
1717
<exclude>
1818
<directory>src/*Bundle/Resources</directory>
19-
<directory>src/DataFixtures</directory>
2019
</exclude>
21-
</coverage>
20+
</source>
2221

2322
<testsuites>
2423
<testsuite name="PatchManager Test Suite">

src/PatchManager/Bundle/DependencyInjection/Configuration.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Bundle\DependencyInjection;
46

57
use Symfony\Component\Config\Definition\Builder\TreeBuilder;

src/PatchManager/Bundle/DependencyInjection/PatchManagerCompilerPass.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Bundle\DependencyInjection;
46

57
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
@@ -13,8 +15,6 @@ class PatchManagerCompilerPass implements CompilerPassInterface
1315
/**
1416
* You can modify the container here before it is dumped to PHP code.
1517
*
16-
* @param ContainerBuilder $container
17-
*
1818
* @api
1919
*/
2020
public function process(ContainerBuilder $container): void

src/PatchManager/Bundle/DependencyInjection/PatchManagerExtension.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Bundle\DependencyInjection;
46

57
use Symfony\Component\Config\FileLocator;
@@ -17,6 +19,7 @@ class PatchManagerExtension extends Extension
1719
* @param ContainerBuilder $container A ContainerBuilder instance
1820
*
1921
* @throws \InvalidArgumentException When provided tag is not defined in this extension
22+
* @throws \Exception
2023
*
2124
* @api
2225
*/
@@ -34,11 +37,6 @@ public function load(array $configs, ContainerBuilder $container): void
3437
$this->handleGenericConfig($config, $container, $loaderHandlers);
3538
}
3639

37-
/**
38-
* @param array $config
39-
* @param ContainerBuilder $container
40-
* @param Loader\XmlFileLoader $loaderHandlers
41-
*/
4240
private function handleGenericConfig(
4341
array $config,
4442
ContainerBuilder $container,
@@ -60,10 +58,6 @@ private function handleGenericConfig(
6058
$container->setParameter('patch_manager.strict_mode', $config['strict_mode']);
6159
}
6260

63-
/**
64-
* @param Loader\XmlFileLoader $loaderHandlers
65-
* @param ContainerBuilder $container
66-
*/
6761
private function handleStateMachine(Loader\XmlFileLoader $loaderHandlers, ContainerBuilder $container): void
6862
{
6963
if (!interface_exists('Finite\Factory\FactoryInterface')) {

src/PatchManager/Bundle/PatchManagerBundle.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Bundle;
46

57
use Cypress\PatchManager\Bundle\DependencyInjection\PatchManagerCompilerPass;

src/PatchManager/Bundle/RequestAdapter/RequestStackAdapter.php

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Bundle\RequestAdapter;
46

57
use Cypress\PatchManager\Request\Adapter;
68
use Symfony\Component\HttpFoundation\RequestStack;
79

810
class RequestStackAdapter implements Adapter
911
{
10-
/**
11-
* @var RequestStack
12-
*/
1312
private RequestStack $requestStack;
1413

15-
/**
16-
* @param RequestStack $requestStack
17-
*/
1814
public function __construct(RequestStack $requestStack)
1915
{
2016
$this->requestStack = $requestStack;
2117
}
2218

23-
/**
24-
* @return null|string
25-
*/
2619
public function getRequestBody(): ?string
2720
{
2821
$request = $this->requestStack->getCurrentRequest();

src/PatchManager/Event/PatchManagerEvent.php

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Event;
46

57
use Cypress\PatchManager\MatchedPatchOperation;
@@ -8,37 +10,21 @@
810

911
class PatchManagerEvent extends Event
1012
{
11-
/**
12-
* @var MatchedPatchOperation
13-
*/
1413
private MatchedPatchOperation $matchedPatchOperation;
1514

16-
/**
17-
* @var Patchable
18-
*/
1915
private Patchable $subject;
2016

21-
/**
22-
* @param MatchedPatchOperation $matchedPatchOperation
23-
* @param Patchable $subject
24-
*/
2517
public function __construct(MatchedPatchOperation $matchedPatchOperation, Patchable $subject)
2618
{
2719
$this->matchedPatchOperation = $matchedPatchOperation;
2820
$this->subject = $subject;
2921
}
3022

31-
/**
32-
* @return MatchedPatchOperation
33-
*/
3423
public function getMatchedPatchOperation(): MatchedPatchOperation
3524
{
3625
return $this->matchedPatchOperation;
3726
}
3827

39-
/**
40-
* @return Patchable
41-
*/
4228
public function getSubject(): Patchable
4329
{
4430
return $this->subject;

src/PatchManager/Event/PatchManagerEvents.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Event;
46

57
final class PatchManagerEvents

src/PatchManager/Exception/HandlerNotFoundException.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Exception;
46

57
use PhpCollection\Sequence;
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Exception;
46

57
class InvalidJsonRequestContent extends PatchManagerException
68
{
7-
/**
8-
* @var string
9-
*/
109
protected $message = "The Request passed to the PatchManagerHandler contains invalid json data";
1110
}

src/PatchManager/Exception/MissingOperationNameRequest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Exception;
46

57
class MissingOperationNameRequest extends PatchManagerException

src/PatchManager/Exception/MissingOperationRequest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Exception;
46

57
class MissingOperationRequest extends PatchManagerException

src/PatchManager/Exception/NonExistentOperationException.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Exception;
46

57
class NonExistentOperationException extends PatchManagerException

src/PatchManager/Exception/PatchManagerException.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Cypress\PatchManager\Exception;
46

57
class PatchManagerException extends \Exception

0 commit comments

Comments
 (0)