Skip to content

Commit 37edb58

Browse files
Symfony 6 support
1 parent 13fde1e commit 37edb58

10 files changed

+54
-40
lines changed

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DEV_PHP_VERSION=7.2
1+
DEV_PHP_VERSION=8.1

.github/workflows/default.yaml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Checks
22

3-
on:
4-
pull_request:
3+
on: # yamllint disable-line rule:truthy
4+
pull_request: ~
55
push:
66
branches:
77
- main
@@ -14,19 +14,21 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
php_version:
17-
- '7.1'
1817
- '7.2'
1918
- '7.3'
2019
- '7.4'
2120
- '8.0'
21+
- '8.1'
2222
symfony_version:
2323
- '4.4'
2424
- '5.0'
2525
- '5.1'
2626
- '5.2'
2727
- '5.3'
28+
- '6.0'
29+
- '6.1'
2830

29-
name: "PHP ${{ matrix.php_version }} - Symfony ${{ matrix.symfony_version }}"
31+
name: 'PHP ${{ matrix.php_version }} - Symfony ${{ matrix.symfony_version }}'
3032

3133
steps:
3234
- uses: actions/checkout@v2
@@ -49,7 +51,7 @@ jobs:
4951
restore-keys: |
5052
${{ runner.os }}-composer-
5153
52-
- name: "Install dependencies"
54+
- name: 'Install dependencies'
5355
run: SYMFONY_REQUIRE='${{ matrix.symfony_version }}.*' composer update ${{ matrix.composer-flags }} --prefer-dist --prefer-dist
5456

5557
- run: vendor/bin/phpstan

.yamllint.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ rules:
4343
forbid-in-block-mappings: true
4444
forbid-in-flow-mappings: true
4545
hyphens:
46-
max-spaces-after: 2
46+
max-spaces-after: 3
4747
key-duplicates: 'enable'
4848
key-ordering: 'disable'
4949
line-length: 'disable'
@@ -54,6 +54,7 @@ rules:
5454
forbid-implicit-octal: true
5555
quoted-strings:
5656
quote-type: 'single'
57+
required: false
5758
trailing-spaces: 'enable'
5859
truthy:
5960
allowed-values:

composer.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.1 || ^8.0",
15-
"symfony/console": "^4.4 || ^5.0",
16-
"symfony/dom-crawler": "^4.4 || ^5.0",
17-
"symfony/framework-bundle": "^4.4 || ^5.0",
18-
"symfony/twig-bundle": "^4.4 || ^5.0",
19-
"symfony/web-profiler-bundle": "^4.4 || ^5.0"
14+
"php": "^7.2 || ^8.0",
15+
"symfony/console": "^4.4 || ^5.0 || ^6.0",
16+
"symfony/dom-crawler": "^4.4 || ^5.0 || ^6.0",
17+
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0",
18+
"symfony/twig-bundle": "^4.4 || ^5.0 || ^6.0",
19+
"symfony/web-profiler-bundle": "^4.4 || ^5.0 || ^6.0"
2020
},
2121
"require-dev": {
2222
"behat/behat": "^3.7",
2323
"friends-of-behat/symfony-extension": "^2.0",
24-
"phpstan/phpstan": "^0.12.85",
25-
"phpstan/phpstan-deprecation-rules": "^0.12.6",
26-
"phpstan/phpstan-strict-rules": "^0.12.9",
24+
"phpstan/phpstan": "^0.12.85 || ^1.0",
25+
"phpstan/phpstan-deprecation-rules": "^0.12.6 || ^1.0",
26+
"phpstan/phpstan-strict-rules": "^0.12.9 || ^1.0",
2727
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
28-
"symplify/easy-coding-standard": "^9.3"
28+
"symplify/easy-coding-standard": "^10.0"
2929
},
3030
"config": {
3131
"preferred-install": "dist",

ecs.php

+19-19
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
66
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
77
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
8-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
98
use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer;
10-
use Symplify\EasyCodingStandard\ValueObject\Option;
9+
use Symplify\EasyCodingStandard\Config\ECSConfig;
1110
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
1211

13-
return static function (ContainerConfigurator $containerConfigurator): void {
14-
$services = $containerConfigurator->services();
15-
$services->set(ArraySyntaxFixer::class)
16-
->call('configure', [[
17-
'syntax' => 'short',
18-
]]);
12+
return static function (ECSConfig $ecsConfig): void {
13+
$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [
14+
'syntax' => 'short',
15+
]);
16+
17+
$ecsConfig->import(SetList::PSR_12);
18+
$ecsConfig->import(SetList::PHP_CS_FIXER);
19+
$ecsConfig->import(SetList::PHP_CS_FIXER_RISKY);
20+
$ecsConfig->import(SetList::SYMPLIFY);
21+
$ecsConfig->import(SetList::SYMFONY);
22+
$ecsConfig->import(SetList::SYMFONY_RISKY);
23+
$ecsConfig->import(SetList::COMMON);
24+
$ecsConfig->import(SetList::CLEAN_CODE);
1925

20-
$containerConfigurator->import(SetList::PSR_12);
21-
$containerConfigurator->import(SetList::PHP_CS_FIXER);
22-
$containerConfigurator->import(SetList::PHP_CS_FIXER_RISKY);
23-
$containerConfigurator->import(SetList::SYMPLIFY);
24-
$containerConfigurator->import(SetList::SYMFONY);
25-
$containerConfigurator->import(SetList::SYMFONY_RISKY);
26-
$containerConfigurator->import(SetList::COMMON);
27-
$containerConfigurator->import(SetList::CLEAN_CODE);
26+
$ecsConfig->paths([
27+
__DIR__ . '/src',
28+
__DIR__ . '/tests'
29+
]);
2830

29-
$parameters = $containerConfigurator->parameters();
30-
$parameters->set(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']);
31-
$parameters->set(Option::SKIP, [
31+
$ecsConfig->skip([
3232
MethodChainingIndentationFixer::class => [
3333
__DIR__ . '/src/DependencyInjection/Configuration.php',
3434
],

phpstan.neon

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ parameters:
1111

1212
ignoreErrors:
1313
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::#'
14-
- '#Method Sourceability\\ConsoleToolbarBundle\\Console\\IndentedConsoleOutput::doWrite\(\) .+typehint specified#'
1514

1615
includes:
1716
- vendor/phpstan/phpstan-deprecation-rules/rules.neon

src/Behat/SymfonyToolbarExtension.php

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public function configure(ArrayNodeDefinition $builder): void
3131
{
3232
}
3333

34+
/**
35+
* @param array<mixed> $config
36+
*/
3437
public function load(ContainerBuilder $container, array $config): void
3538
{
3639
$definition = new Definition(ProfilerToolbarListener::class, [new Reference(SymfonyExtension::KERNEL_ID)]);

src/Console/IndentedConsoleOutput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function __construct(int $spaces)
1818
$this->spaces = $spaces;
1919
}
2020

21-
protected function doWrite($message, $newline)
21+
protected function doWrite(string $message, bool $newline): void
2222
{
2323
$prependBy = str_repeat(' ', $this->spaces);
2424

src/Console/ProfilerToolbarRenderer.php

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ static function (Profile $left, Profile $right): int {
135135
}
136136

137137
/**
138+
* @param array<string|int, string> $headers
139+
* @param array<string|int, string> $originalHeaders
140+
*
138141
* @return array<int, string>
139142
*/
140143
private function renderRow(Profile $profile, string $webProfilerUrl, array &$headers, array $originalHeaders): array

src/DependencyInjection/SourceabilityConsoleToolbarExtension.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@
99

1010
class SourceabilityConsoleToolbarExtension extends ConfigurableExtension
1111
{
12+
/**
13+
* @param array<mixed> $mergedConfig
14+
*/
1215
protected function loadInternal(array $mergedConfig, ContainerBuilder $container): void
1316
{
1417
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
1518
$loader->load('services.yaml');
1619

20+
/** @var array{hidden_panels: array<mixed>, max_column_width: int} $toolbar */
21+
$toolbar = $mergedConfig['toolbar'];
22+
1723
$container
1824
->getDefinition('sourceability.console_toolbar.console.profiler_toolbar_renderer')
19-
->replaceArgument('$hiddenPanels', $mergedConfig['toolbar']['hidden_panels'])
20-
->replaceArgument('$maxColumnWidth', $mergedConfig['toolbar']['max_column_width'])
25+
->replaceArgument('$hiddenPanels', $toolbar['hidden_panels'])
26+
->replaceArgument('$maxColumnWidth', $toolbar['max_column_width'])
2127
;
2228
}
2329
}

0 commit comments

Comments
 (0)