Skip to content

Commit

Permalink
[PhpDocReader] Drop support for symfony <= 5.4, Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Apricot committed Dec 26, 2023
1 parent d579d18 commit dbcf200
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 67 deletions.
44 changes: 37 additions & 7 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@

declare(strict_types=1);

$owner = 'Mykhailo Shtanko';
$email = 'fractalzombie@gmail.com';
$year = date('Y');
$projectDirectory = __DIR__;

$header = <<<'EOF'
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Copyright (c) {{YEAR}} {{OWNER}} {{EMAIL}}
For the full copyright and license information, please view the LICENSE.MD
file that was distributed with this source code.
EOF;

$finder = PhpCsFixer\Finder::create()
->exclude('var')
->exclude('vendor')
->exclude('Documentation')
->notPath('#Enum#')
->in(__DIR__)
->ignoreDotFiles(true)
->in($projectDirectory)
;

$rules = [
Expand All @@ -18,14 +34,28 @@
'@PhpCsFixer' => true,
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,
'@PHPUnit84Migration:risky' => true,
'phpdoc_line_span' => ['const' => 'single', 'property' => 'single', 'method' => 'single'],
'comment_to_phpdoc' => ['ignored_tags' => ['scrutinizer']],
'phpdoc_to_comment' => ['ignored_tags' => ['scrutinizer']],
'@PHP81Migration' => true,
'@PHP82Migration' => true,
'@PHP83Migration' => true,
'@PHPUnit100Migration:risky' => true,
'date_time_immutable' => true,
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'single_line_throw' => true,
'php_unit_internal_class' => false,
'phpdoc_align' => ['align' => 'left'],
'php_unit_test_case_static_method_calls' => false,
'php_unit_test_class_requires_covers' => false,
'phpdoc_line_span' => ['const' => 'single', 'property' => 'single', 'method' => 'single'],
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => str_replace(
['{{YEAR}}', '{{OWNER}}', '{{EMAIL}}'],
[$year, $owner, $email],
$header,
),
'location' => 'after_declare_strict',
'separate' => 'top',
],
];

return (new PhpCsFixer\Config())
Expand Down
2 changes: 1 addition & 1 deletion Tests/PrimitiveTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testMethodParameters(string $type, string $expectedType): void
$this->assertEquals($expectedType, $parser->getParameterType($parameter));
}

public function typeProvider(): iterable
public static function typeProvider(): iterable
{
return [
'bool' => ['bool', 'bool'],
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnknownTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testMethodParameters(string $type): void
$this->assertNull($parser->getParameterClass($parameter));
}

public function typeProvider(): iterable
public static function typeProvider(): iterable
{
return [
'empty' => ['empty'],
Expand Down
21 changes: 10 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,20 @@
}
},
"require": {
"php": "^8.1",
"php": ">=8.1",
"doctrine/annotations": "^1.14",
"friendsofphp/php-cs-fixer": "^3.14",
"frzb/dependency-injection": "^1.8",
"symfony/framework-bundle": "^5.4|^6|^7",
"fp4php/functional": "^4.20|^6"
"friendsofphp/php-cs-fixer": "^3.42",
"frzb/dependency-injection": "^2.0",
"symfony/framework-bundle": "^6.0|^7.0",
"fp4php/functional": "^6.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10.5",
"mnapoli/hard-mode": "~0.3.0",
"sempro/phpunit-pretty-print": "^1.4",
"phpunit/php-code-coverage": "^9.2",
"php-coveralls/php-coveralls": "^2.5",
"dg/bypass-finals": "^1.4",
"symfony/phpunit-bridge": "^5.4|^6|^7",
"phpunit/php-code-coverage": "^10.1",
"php-coveralls/php-coveralls": "^2.7",
"dg/bypass-finals": "^1.5",
"symfony/phpunit-bridge": "^6.0|^7.0",
"symfony/test-pack": "^1.0"
},
"config": {
Expand Down
85 changes: 38 additions & 47 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,51 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
colors="true"
printerClass="Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9"
bootstrap="bootstrap.php"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1"/>
<ini name="intl.default_locale" value="en"/>
<ini name="intl.error_level" value="0"/>

<server name="KERNEL_CLASS" value="FRZB\Component\RequestMapper\Tests\Stub\Kernel"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5"/>

<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
<env name="TEST_ENVIRONMENT" value="TEST_VALUE"/>
</php>

<testsuites>
<testsuite name="PhpDocReader Component Test Suite">
<directory>Tests/</directory>
</testsuite>
</testsuites>

<coverage>
<include>
<directory suffix=".php">./</directory>
</include>
<exclude>
<directory>Tests</directory>
<directory>Resources</directory>
<directory>vendor</directory>
<file>.php-cs-fixer.dist.php</file>
<file>bootstrap.php</file>
<file>PhpDocReaderBundle.php</file>
<file>PhpDocReaderExtension.php</file>
</exclude>
</coverage>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
colors="true"
bootstrap="bootstrap.php"
failOnRisky="true"
failOnWarning="true"
cacheDirectory=".phpunit.cache">
<php>
<ini name="error_reporting" value="-1"/>
<ini name="intl.default_locale" value="en"/>
<ini name="intl.error_level" value="0"/>
<server name="KERNEL_CLASS" value="FRZB\Component\RequestMapper\Tests\Stub\Kernel"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="10.5"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
<env name="TEST_ENVIRONMENT" value="TEST_VALUE"/>
</php>
<testsuites>
<testsuite name="PhpDocReader Component Test Suite">
<directory>Tests/</directory>
</testsuite>
</testsuites>
<coverage/>
<source>
<include>
<directory suffix=".php">./</directory>
</include>
<exclude>
<directory>Tests</directory>
<directory>Resources</directory>
<directory>vendor</directory>
<file>.php-cs-fixer.dist.php</file>
<file>bootstrap.php</file>
<file>PhpDocReaderBundle.php</file>
<file>PhpDocReaderExtension.php</file>
</exclude>
</source>
</phpunit>

0 comments on commit dbcf200

Please sign in to comment.