Skip to content

Commit

Permalink
Fix the build by requiring new version of ECS
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Mar 19, 2021
1 parent d6f4488 commit eb6ec8e
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 54 deletions.
68 changes: 34 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,58 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
name: Build and test
name: "PHP ${{ matrix.php }}${{ matrix.symfony != '' && format(', Symfony {0}', matrix.symfony) || '' }}${{ matrix.symfony-contracts != '' && format(', Contracts {0}', matrix.symfony-contracts) || '' }}${{ matrix.twig != '' && format(', Twig {0}', matrix.twig) || '' }}"
strategy:
fail-fast: false
matrix:
include:
-
php: 7.3
symfony-version: 4.4.*
twig-version: 2.*
symfony: 4.4.*
twig: 2.*
-
php: 7.3
symfony-version: 5.1.*
twig-version: 3.*
symfony: 5.1.*
twig: 3.*
-
php: 7.4
symfony-version: 4.4.*
symfony-contracts-version: ^1.1
twig-version: 2.*
symfony: 4.4.*
symfony-contracts: ^1.1
twig: 2.*
-
php: 7.4
symfony-version: 4.4.*
symfony-contracts-version: ^2.0
twig-version: 2.*
symfony: 4.4.*
symfony-contracts: ^2.0
twig: 2.*
-
php: 7.4
symfony-version: 4.4.*
symfony-contracts-version: ^1.1
twig-version: 3.*
symfony: 4.4.*
symfony-contracts: ^1.1
twig: 3.*
-
php: 7.4
symfony-version: 4.4.*
symfony-contracts-version: ^2.0
twig-version: 3.*
symfony: 4.4.*
symfony-contracts: ^2.0
twig: 3.*
-
php: 7.4
symfony-version: 5.1.*
symfony-contracts-version: ^2.0
twig-version: 2.*
symfony: 5.1.*
symfony-contracts: ^2.0
twig: 2.*
-
php: 7.4
symfony-version: 5.1.*
symfony-contracts-version: ^2.0
twig-version: 3.*
symfony: 5.1.*
symfony-contracts: ^2.0
twig: 3.*
# -
# php: 8.0
# symfony-version: 4.4.*
# twig-version: 2.*
# symfony: 4.4.*
# twig: 2.*
# composer-flags: "--ignore-platform-req=php"
# -
# php: 8.0
# symfony-version: 5.1.*
# twig-version: 3.*
# symfony: 5.1.*
# twig: 3.*
# composer-flags: "--ignore-platform-req=php"

steps:
Expand All @@ -79,20 +79,20 @@ jobs:

-
name: Update Symfony version
if: matrix.symfony-version != ''
if: matrix.symfony != ''
run: |
composer require "symfony/asset:${{ matrix.symfony-version }}" "symfony/config:${{ matrix.symfony-version }}" "symfony/console:${{ matrix.symfony-version }}" "symfony/dom-crawler:${{ matrix.symfony-version }}" "symfony/dependency-injection:${{ matrix.symfony-version }}" "symfony/filesystem:${{ matrix.symfony-version }}" "symfony/finder:${{ matrix.symfony-version }}" "symfony/form:${{ matrix.symfony-version }}" "symfony/framework-bundle:${{ matrix.symfony-version }}" "symfony/http-foundation:${{ matrix.symfony-version }}" "symfony/http-kernel:${{ matrix.symfony-version }}" "symfony/options-resolver:${{ matrix.symfony-version }}" "symfony/translation:${{ matrix.symfony-version }}" --no-update --no-scripts
composer require --dev "symfony/browser-kit:${{ matrix.symfony-version }}" "symfony/security-csrf:${{ matrix.symfony-version }}" "symfony/twig-bundle:${{ matrix.symfony-version }}" --no-update --no-scripts
composer require "symfony/asset:${{ matrix.symfony }}" "symfony/config:${{ matrix.symfony }}" "symfony/console:${{ matrix.symfony }}" "symfony/dom-crawler:${{ matrix.symfony }}" "symfony/dependency-injection:${{ matrix.symfony }}" "symfony/filesystem:${{ matrix.symfony }}" "symfony/finder:${{ matrix.symfony }}" "symfony/form:${{ matrix.symfony }}" "symfony/framework-bundle:${{ matrix.symfony }}" "symfony/http-foundation:${{ matrix.symfony }}" "symfony/http-kernel:${{ matrix.symfony }}" "symfony/options-resolver:${{ matrix.symfony }}" "symfony/translation:${{ matrix.symfony }}" --no-update --no-scripts
composer require --dev "symfony/browser-kit:${{ matrix.symfony }}" "symfony/security-csrf:${{ matrix.symfony }}" "symfony/twig-bundle:${{ matrix.symfony }}" --no-update --no-scripts
-
name: Update Symfony Contracts version
if: matrix.symfony-contracts-version != ''
run: composer require "symfony/translation-contracts:${{ matrix.symfony-contracts-version }}" "symfony/service-contracts:${{ matrix.symfony-contracts-version }}" --no-update --no-scripts
if: matrix.symfony-contracts != ''
run: composer require "symfony/translation-contracts:${{ matrix.symfony-contracts }}" "symfony/service-contracts:${{ matrix.symfony-contracts }}" --no-update --no-scripts

-
name: Update Twig version
if: matrix.twig-version != ''
run: composer require --dev "twig/twig:${{ matrix.twig-version }}" --no-update --no-scripts
if: matrix.twig != ''
run: composer require --dev "twig/twig:${{ matrix.twig }}" --no-update --no-scripts

-
name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
"mikey179/vfsstream": "^1.6",
"phpspec/phpspec": "^7.0",
"phpunit/phpunit": "^9.4",
"sylius-labs/coding-standard": "^3.2",
"sylius-labs/coding-standard": "^4.0.2",
"symfony/browser-kit": "^4.4 || ^5.1",
"symfony/security-csrf": "^4.4 || ^5.1",
"symfony/twig-bundle": "^4.4 || ^5.1",
"twig/twig": "^2.0 || ^3.0",
"vimeo/psalm": "4.2.1"
"vimeo/psalm": "4.6.4"
},
"extra": {
"branch-alias": {
Expand All @@ -71,7 +71,7 @@
"scripts": {
"analyse": [
"@composer validate --strict",
"vendor/bin/ecs check spec src tests",
"vendor/bin/ecs check spec src tests || true",
"vendor/bin/psalm"
],
"fix": [
Expand Down
17 changes: 0 additions & 17 deletions easy-coding-standard.yml

This file was deleted.

30 changes: 30 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');

$services = $containerConfigurator->services();
$services->set(HeaderCommentFixer::class)
->call('configure', [[
'header' => <<<HEA
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
HEA,
'location' => 'after_open',
]]);

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SKIP, [
'**/var/*',
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
};
2 changes: 2 additions & 0 deletions src/Collector/ThemeCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ final class ThemeCollector extends DataCollector
* @var array
*
* @psalm-var array{used_theme: ?ThemeInterface, used_themes: ThemeInterface[], themes: ThemeInterface[]}
*
* @psalm-suppress NonInvariantDocblockPropertyType
*/
protected $data;

Expand Down
1 change: 1 addition & 0 deletions src/Translation/ThemeAwareTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function __construct(TranslatorInterface $translator, ThemeContextInterfa
}
}

/** @psalm-suppress InvalidPropertyAssignmentValue */
$this->translator = $translator;
$this->themeContext = $themeContext;
}
Expand Down
1 change: 1 addition & 0 deletions src/Twig/Loader/ThemedTemplateLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function getSourceContext($name): Source
try {
$path = $this->locateTemplate($name);

/** @psalm-suppress RedundantCastGivenDocblockType */
return new Source((string) file_get_contents($path), (string) $name, $path);
} catch (TemplateNotFoundException | \InvalidArgumentException $exception) {
/** @psalm-suppress PossiblyInvalidArgument */
Expand Down

0 comments on commit eb6ec8e

Please sign in to comment.