Skip to content

Commit 08b9306

Browse files
committed
update dev dependencies
1 parent 9d94a64 commit 08b9306

12 files changed

+132
-92
lines changed

composer.json

+13-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"authors": [
1313
{
1414
"name": "Martin Hujer",
15-
"email": "[email protected]",
15+
"email": "[email protected]",
1616
"homepage": "https://www.martinhujer.cz"
1717
}
1818
],
@@ -26,14 +26,15 @@
2626
"symfony/http-kernel": "^4.3|^5.0"
2727
},
2828
"require-dev": {
29-
"consistence/coding-standard": "3.9",
30-
"jakub-onderka/php-parallel-lint": "1.0.0",
31-
"matthiasnoback/symfony-config-test": "4.1.0",
32-
"matthiasnoback/symfony-dependency-injection-test": "4.1.0",
33-
"phpstan/phpstan-shim": "0.11.19",
34-
"phpstan/phpstan-phpunit": "0.11.2",
35-
"phpunit/phpunit": "8.4.3",
36-
"php-coveralls/php-coveralls": "2.2.0"
29+
"composer/package-versions-deprecated": "1.11.99.1",
30+
"consistence-community/coding-standard": "3.11.0",
31+
"matthiasnoback/symfony-config-test": "4.2.1",
32+
"matthiasnoback/symfony-dependency-injection-test": "4.2.1",
33+
"php-parallel-lint/php-parallel-lint": "1.2.0",
34+
"phpstan/phpstan": "0.12.79",
35+
"phpstan/phpstan-phpunit": "0.12.17",
36+
"phpstan/phpstan-symfony": "0.12.20",
37+
"phpunit/phpunit": "9.5.2"
3738
},
3839
"autoload": {
3940
"psr-4": {
@@ -64,9 +65,9 @@
6465
"@phpunit"
6566
],
6667
"phplint": "parallel-lint src tests",
67-
"phpcs": "phpcs --standard=ruleset.xml src tests",
68-
"phpcbf": "phpcbf --standard=ruleset.xml src tests",
69-
"phpstan": "php vendor/phpstan/phpstan-shim/phpstan.phar analyse -c phpstan.neon src tests --level 7 --no-progress",
68+
"phpcs": "phpcs src tests",
69+
"phpcbf": "phpcbf src tests",
70+
"phpstan": "phpstan analyse -c phpstan.neon src tests --level 8 --no-progress",
7071
"phpunit": "phpunit"
7172
}
7273
}

phpcs.xml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="ruleset">
3+
<rule ref="vendor/consistence-community/coding-standard/Consistence/ruleset.xml">
4+
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
5+
</rule>
6+
<rule ref="Consistence.Exceptions.ExceptionDeclaration">
7+
<properties>
8+
<property name="exceptionsDirectoryName" value="Exception"/>
9+
</properties>
10+
</rule>
11+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
12+
<properties>
13+
<property name="rootNamespaces" type="array" value="
14+
src => Mhujer\JavaScriptErrorHandlerBundle,
15+
tests => Mhujer\JavaScriptErrorHandlerBundle
16+
"/>
17+
<property name="skipDirs" type="array" value="
18+
data,
19+
"/>
20+
</properties>
21+
</rule>
22+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
23+
<properties>
24+
<property name="caseSensitive" value="false"/>
25+
</properties>
26+
</rule>
27+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
28+
<properties>
29+
<property name="newlinesCountBetweenOpenTagAndDeclare" value="0"/>
30+
</properties>
31+
</rule>
32+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
33+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
34+
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
35+
<properties>
36+
<property name="forbiddenAnnotations" type="array" value="
37+
@author,
38+
@created,
39+
@version,
40+
@package,
41+
@copyright,
42+
@license,
43+
@throws,
44+
@internal,
45+
"/>
46+
</properties>
47+
</rule>
48+
<rule ref="SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses"/>
49+
<rule ref="Squiz.WhiteSpace.FunctionSpacing.After">
50+
<severity>5</severity><!-- turned off by Consistence Coding Standard -->
51+
</rule>
52+
<exclude-pattern>tests/*/data</exclude-pattern>
53+
</ruleset>

phpstan.neon

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
includes:
2+
- vendor/phpstan/phpstan-symfony/extension.neon
23
- vendor/phpstan/phpstan-phpunit/extension.neon
3-
4-
parameters:
5-
ignoreErrors:
6-
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)\.#'

phpunit.xml.dist

+26-19
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
31
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
4-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.4/phpunit.xsd"
6-
bootstrap="vendor/autoload.php"
7-
colors="true"
8-
failOnRisky="true"
9-
verbose="true"
10-
beStrictAboutChangesToGlobalState="true"
11-
beStrictAboutOutputDuringTests="true"
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
beStrictAboutChangesToGlobalState="true"
8+
beStrictAboutOutputDuringTests="true"
9+
beStrictAboutTodoAnnotatedTests="true"
10+
failOnRisky="true"
11+
failOnWarning="true"
1212
>
13+
1314
<testsuites>
1415
<testsuite name="Project Test Suite">
1516
<directory>tests</directory>
1617
</testsuite>
1718
</testsuites>
1819

19-
<filter>
20-
<whitelist processUncoveredFilesFromWhitelist="true">
20+
<coverage processUncoveredFiles="true">
21+
<include>
2122
<directory suffix=".php">src</directory>
22-
</whitelist>
23-
</filter>
24-
25-
<logging>
26-
<log type="coverage-clover" target="build/logs/clover.xml"/>
27-
<log type="coverage-html" target="build/logs/coverage-report"/>
28-
</logging>
23+
</include>
24+
<report>
25+
<clover outputFile="build/logs/clover.xml"/>
26+
<html
27+
outputDirectory="build/logs/coverage-report"
28+
/>
29+
<text
30+
outputFile="php://stdout"
31+
showUncoveredFiles="true"
32+
showOnlySummary="true"
33+
/>
34+
</report>
35+
</coverage>
2936
</phpunit>

ruleset.xml

-8
This file was deleted.

src/DependencyInjection/Configuration.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
<?php
2-
3-
declare(strict_types = 1);
1+
<?php declare(strict_types = 1);
42

53
namespace Mhujer\JavaScriptErrorHandlerBundle\DependencyInjection;
64

75
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8-
use Symfony\Component\Config\Definition\ConfigurationInterface;
96

10-
class Configuration implements ConfigurationInterface
7+
class Configuration implements \Symfony\Component\Config\Definition\ConfigurationInterface
118
{
129

13-
/** @var bool */
14-
private $enabledDefaultValue;
10+
private bool $enabledDefaultValue;
1511

1612
public function __construct(
1713
bool $enabledDefaultValue

src/DependencyInjection/JavaScriptErrorHandlerExtension.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
<?php
2-
3-
declare(strict_types = 1);
1+
<?php declare(strict_types = 1);
42

53
namespace Mhujer\JavaScriptErrorHandlerBundle\DependencyInjection;
64

75
use Symfony\Component\Config\FileLocator;
86
use Symfony\Component\DependencyInjection\ContainerBuilder;
9-
use Symfony\Component\DependencyInjection\Extension\Extension;
107
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
118

12-
class JavaScriptErrorHandlerExtension extends Extension
9+
class JavaScriptErrorHandlerExtension extends \Symfony\Component\DependencyInjection\Extension\Extension
1310
{
1411

1512
/**
@@ -38,7 +35,7 @@ public function load(array $configs, ContainerBuilder $container): void
3835
*/
3936
public function getConfiguration(array $config, ContainerBuilder $container): Configuration
4037
{
41-
return new Configuration($container->getParameter('kernel.debug'));
38+
return new Configuration((bool) $container->getParameter('kernel.debug'));
4239
}
4340

4441
}

src/EventListener/JsErrorToAlertListener.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
<?php
2-
3-
declare(strict_types = 1);
1+
<?php declare(strict_types = 1);
42

53
namespace Mhujer\JavaScriptErrorHandlerBundle\EventListener;
64

7-
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
85
use Symfony\Component\HttpFoundation\Request;
96
use Symfony\Component\HttpFoundation\Response;
107
use Symfony\Component\HttpKernel\Event\ResponseEvent;
118
use Symfony\Component\HttpKernel\KernelEvents;
129

13-
class JsErrorToAlertListener implements EventSubscriberInterface
10+
class JsErrorToAlertListener implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
1411
{
1512

1613
public function onKernelResponse(ResponseEvent $event): void

src/JavaScriptErrorHandlerBundle.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
<?php
2-
3-
declare(strict_types = 1);
1+
<?php declare(strict_types = 1);
42

53
namespace Mhujer\JavaScriptErrorHandlerBundle;
64

7-
use Symfony\Component\HttpKernel\Bundle\Bundle;
8-
9-
class JavaScriptErrorHandlerBundle extends Bundle
5+
class JavaScriptErrorHandlerBundle extends \Symfony\Component\HttpKernel\Bundle\Bundle
106
{
117

128
}

tests/DependencyInjection/ConfigurationTest.php

+25-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
<?php
2-
3-
declare(strict_types = 1);
1+
<?php declare(strict_types = 1);
42

53
namespace Mhujer\JavaScriptErrorHandlerBundle\DependencyInjection;
64

7-
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
8-
use PHPUnit\Framework\TestCase;
5+
use PackageVersions\Versions;
96
use Symfony\Component\Config\Definition\ConfigurationInterface;
107

11-
class ConfigurationTest extends TestCase
8+
class ConfigurationTest extends \PHPUnit\Framework\TestCase
129
{
1310

14-
use ConfigurationTestCaseTrait;
11+
use \Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
1512

1613
public function testEmptyConfigurationIsValid(): void
1714
{
@@ -44,16 +41,30 @@ public function testDisabledConfigurationIsValid(): void
4441
);
4542
}
4643

47-
public function testEnabledConfigurationIsValidXX(): void
44+
public function testEnabledConfigurationInvalidType(): void
4845
{
49-
$this->assertConfigurationIsInvalid(
50-
[
46+
// there are different messages for Symfony 4.4 and 5.1, @see https://github.com/symfony/symfony/pull/35945
47+
48+
// symfony/config 4.4
49+
if (preg_match('~^v4\.4~', Versions::getVersion('symfony/config')) === 1) {
50+
$this->assertConfigurationIsInvalid(
5151
[
52-
'enabled' => 1,
52+
[
53+
'enabled' => 1,
54+
],
5355
],
54-
],
55-
'Invalid type for path "java_script_error_handler.enabled". Expected boolean, but got integer.'
56-
);
56+
'Invalid type for path "java_script_error_handler.enabled". Expected boolean, but got integer.'
57+
);
58+
} else {
59+
$this->assertConfigurationIsInvalid(
60+
[
61+
[
62+
'enabled' => 1,
63+
],
64+
],
65+
'Invalid type for path "java_script_error_handler.enabled". Expected "bool", but got "int".'
66+
);
67+
}
5768
}
5869

5970
public function testInvalidConfigurationIsInvalid(): void

tests/DependencyInjection/JavaScriptErrorHandlerExtensionTest.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
<?php
2-
3-
declare(strict_types = 1);
1+
<?php declare(strict_types = 1);
42

53
namespace Mhujer\JavaScriptErrorHandlerBundle\DependencyInjection;
64

7-
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
85
use Mhujer\JavaScriptErrorHandlerBundle\EventListener\JsErrorToAlertListener;
96

10-
class JavaScriptErrorHandlerExtensionTest extends AbstractExtensionTestCase
7+
class JavaScriptErrorHandlerExtensionTest extends \Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase
118
{
129

1310
private const LISTENER_CLASS_NAME = JsErrorToAlertListener::class;

tests/EventListener/JsErrorToAlertListenerTest.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
<?php
2-
3-
declare(strict_types = 1);
1+
<?php declare(strict_types = 1);
42

53
namespace Mhujer\JavaScriptErrorHandlerBundle\EventListener;
64

7-
use PHPUnit\Framework\TestCase;
85
use ReflectionMethod;
96
use Symfony\Component\HttpFoundation\HeaderBag;
107
use Symfony\Component\HttpFoundation\Request;
@@ -15,7 +12,7 @@
1512
use Symfony\Component\HttpKernel\Kernel;
1613
use Symfony\Component\HttpKernel\KernelEvents;
1714

18-
class JsErrorToAlertListenerTest extends TestCase
15+
class JsErrorToAlertListenerTest extends \PHPUnit\Framework\TestCase
1916
{
2017

2118
public function testIsSubscribedToKernelResponse(): void
@@ -42,7 +39,6 @@ public function testInjectScript(string $responseBody, string $expectedResponse)
4239
$this->assertSame($expectedResponse, $response->getContent());
4340
}
4441

45-
4642
/**
4743
* @dataProvider htmlScriptDataProvider
4844
* @param string $responseBody

0 commit comments

Comments
 (0)