Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
222 changes: 188 additions & 34 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,196 @@
name: build
name: "build"
on:
push: ~
push:
branches:
- "2.x"
pull_request: ~
workflow_dispatch: ~

jobs:
checks:
name: 'PHP ${{ matrix.php-versions }} with composer args: ${{ matrix.composer-args }}'
runs-on: ubuntu-latest
coding-standards:
name: "Coding Standards"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
composer-args: ['--prefer-lowest --prefer-stable', '']
php-version:
- "7.4"

dependencies:
- "highest"

steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: intl
tools: composer-require-checker, composer-unused
coverage: none
- name: Install Composer dependencies
run: composer update --no-progress --no-suggest --prefer-dist --no-interaction ${{ matrix.composer-args }}
- name: Validate composer
run: composer validate --strict
- name: Check composer normalized
run: composer normalize --dry-run
- name: Check style
run: composer check-style
- name: Static analysis
run: composer analyse
- name: Run phpunit
run: composer phpunit
- name: Composer require checker
if: matrix.php-versions == '7.4' && matrix.composer-args == ''
run: composer-require-checker
- name: Composer unused checker
if: matrix.php-versions == '7.4' && matrix.composer-args == ''
run: composer-unused
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
coverage: "none"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Validate composer"
run: "composer validate --strict"

- name: "Check composer normalized"
run: "composer normalize --dry-run"

- name: "Check style"
run: "composer check-style"

dependency-analysis:
name: "Dependency Analysis"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

dependencies:
- "lowest"
- "highest"

symfony:
- "~5.4.0"
- "~6.4.0"

exclude:
- php-version: "7.4"
symfony: "~6.4.0"
- php-version: "8.0"
symfony: "~6.4.0"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"
tools: "flex"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v3"
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Dependency analysis"
run: "vendor/bin/composer-dependency-analyser"

static-code-analysis:
name: "Static Code Analysis"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

dependencies:
- "lowest"
- "highest"

symfony:
- "~5.4.0"
- "~6.4.0"

exclude:
- php-version: "7.4"
symfony: "~6.4.0"
- php-version: "8.0"
symfony: "~6.4.0"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
coverage: "none"
tools: "flex"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v3"
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Static analysis"
run: "vendor/bin/psalm --php-version=${{ matrix.php-version }}"

unit-tests:
name: "Unit tests"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

dependencies:
- "lowest"
- "highest"

symfony:
- "~5.4.0"
- "~6.4.0"

exclude:
- php-version: "7.4"
symfony: "~6.4.0"
- php-version: "8.0"
symfony: "~6.4.0"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
coverage: "none"
tools: "flex"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v3"
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run phpunit"
run: "composer phpunit"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Setono
Copyright (c) 2025 Setono

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
27 changes: 14 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,26 @@
"require": {
"php": ">=7.4",
"setono/tag-bag": "^1.4",
"symfony/config": "^4.4 || ^5.4 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0",
"symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0",
"symfony/config": "^5.4 || ^6.4",
"symfony/dependency-injection": "^5.4 || ^6.4",
"symfony/deprecation-contracts": "^2.0 || ^3.0",
"symfony/event-dispatcher": "^5.4 || ^6.4",
"symfony/http-foundation": "^5.4 || ^6.4",
"symfony/http-kernel": "^5.4 || ^6.4",
"twig/twig": "^2.0 || ^3.0",
"webmozart/assert": "^1.11"
},
"require-dev": {
"matthiasnoback/symfony-dependency-injection-test": "^4.2",
"nyholm/symfony-bundle-test": "^1.7",
"phpspec/prophecy-phpunit": "^2.3",
"phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-latest",
"setono/code-quality-pack": "^2.2",
"setono/php-templates-bundle": "^1.0",
"psalm/plugin-phpunit": "^0.19.0",
"setono/code-quality-pack": "^2.9",
"setono/tag-bag-gtag": "^1.0",
"setono/tag-bag-php-templates": "^1.2",
"setono/tag-bag-twig": "^1.1",
"symfony/twig-bundle": "^4.4 || ^5.4 || ^6.0"
"shipmonk/composer-dependency-analyser": "^1.8.2",
"symfony/twig-bundle": "^5.4 || ^6.4"
},
"prefer-stable": true,
"autoload": {
Expand All @@ -45,14 +46,14 @@
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": false,
"ergebnis/composer-normalize": true,
"dealerdirect/phpcodesniffer-composer-installer": false
"phpstan/extension-installer": true
},
"sort-packages": true
},
"scripts": {
"analyse": "phpstan analyse -c phpstan.neon -l max src/",
"analyse": "psalm",
"check-style": "ecs check src/ tests/",
"fix-style": "ecs check --fix src/ tests/",
"phpunit": "phpunit"
Expand Down
2 changes: 1 addition & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/vendor/setono/coding-standard/easy-coding-standard.php');
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
};
4 changes: 0 additions & 4 deletions phpspec.yml.dist

This file was deleted.

3 changes: 0 additions & 3 deletions phpstan.neon

This file was deleted.

26 changes: 26 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
errorLevel="1"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="false"
findUnusedCode="false"
findUnusedPsalmSuppress="true"
findUnusedVariablesAndParams="false"
phpVersion="7.4"
>
<projectFiles>
<directory name="src"/>

<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>
<issueHandlers>
<MissingOverrideAttribute errorLevel="suppress"/>
</issueHandlers>
</psalm>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use InvalidArgumentException;
use ReflectionClass;
use function Safe\sprintf;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

Expand All @@ -32,7 +31,8 @@ private static function addGtagPaths(ContainerBuilder $container): void
$filename = (new ReflectionClass($interface))->getFileName();
if (false === $filename) {
throw new InvalidArgumentException(sprintf(
'The filename of interface %s could not be deduced', $interface
'The filename of interface %s could not be deduced',
$interface
));
}

Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Compiler/AddPathsToTwigPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use InvalidArgumentException;
use ReflectionClass;
use function Safe\sprintf;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand Down Expand Up @@ -35,7 +34,8 @@ private static function addGtagPaths(Definition $twigLoader): void
$filename = (new ReflectionClass($interface))->getFileName();
if (false === $filename) {
throw new InvalidArgumentException(sprintf(
'The filename of interface %s could not be deduced', $interface
'The filename of interface %s could not be deduced',
$interface
));
}

Expand Down
7 changes: 6 additions & 1 deletion src/DependencyInjection/Compiler/RegisterRenderersPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ public function process(ContainerBuilder $container): void

$renderer = $container->getDefinition('setono_tag_bag.renderer.composite');

/**
* @var string $id
* @var array $tags
*/
foreach ($container->findTaggedServiceIds('setono_tag_bag.renderer') as $id => $tags) {
/** @var array $tag */
foreach ($tags as $tag) {
$priority = $tag['priority'] ?? 0;
$priority = (int) ($tag['priority'] ?? 0);

$renderer->addMethodCall('addRenderer', [new Reference($id), $priority]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/SetonoTagBagExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

final class SetonoTagBagExtension extends Extension
{
public function load(array $config, ContainerBuilder $container): void
public function load(array $configs, ContainerBuilder $container): void
{
$container->registerForAutoconfiguration(RendererInterface::class)
->addTag('setono_tag_bag.renderer', [
Expand Down
Loading
Loading