Skip to content

Commit cdbdf99

Browse files
committed
Remove session injection in session storage
1 parent 4f62be1 commit cdbdf99

17 files changed

Lines changed: 277 additions & 84 deletions

.github/workflows/build.yaml

Lines changed: 188 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,196 @@
1-
name: build
1+
name: "build"
22
on:
3-
push: ~
3+
push:
4+
branches:
5+
- "2.x"
46
pull_request: ~
57
workflow_dispatch: ~
68

79
jobs:
8-
checks:
9-
name: 'PHP ${{ matrix.php-versions }} with composer args: ${{ matrix.composer-args }}'
10-
runs-on: ubuntu-latest
10+
coding-standards:
11+
name: "Coding Standards"
12+
13+
runs-on: "ubuntu-latest"
14+
1115
strategy:
1216
matrix:
13-
php-versions: ['7.4', '8.0', '8.1']
14-
composer-args: ['--prefer-lowest --prefer-stable', '']
17+
php-version:
18+
- "7.4"
19+
20+
dependencies:
21+
- "highest"
22+
1523
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v1
18-
- name: Setup PHP, with composer and extensions
19-
uses: shivammathur/setup-php@v2
20-
with:
21-
php-version: ${{ matrix.php-versions }}
22-
extensions: intl
23-
tools: composer-require-checker, composer-unused
24-
coverage: none
25-
- name: Install Composer dependencies
26-
run: composer update --no-progress --no-suggest --prefer-dist --no-interaction ${{ matrix.composer-args }}
27-
- name: Validate composer
28-
run: composer validate --strict
29-
- name: Check composer normalized
30-
run: composer normalize --dry-run
31-
- name: Check style
32-
run: composer check-style
33-
- name: Static analysis
34-
run: composer analyse
35-
- name: Run phpunit
36-
run: composer phpunit
37-
- name: Composer require checker
38-
if: matrix.php-versions == '7.4' && matrix.composer-args == ''
39-
run: composer-require-checker
40-
- name: Composer unused checker
41-
if: matrix.php-versions == '7.4' && matrix.composer-args == ''
42-
run: composer-unused
24+
- name: "Checkout"
25+
uses: "actions/checkout@v4"
26+
27+
- name: "Setup PHP, with composer and extensions"
28+
uses: "shivammathur/setup-php@v2"
29+
with:
30+
php-version: "${{ matrix.php-version }}"
31+
extensions: "${{ env.PHP_EXTENSIONS }}"
32+
coverage: "none"
33+
34+
- name: "Install composer dependencies"
35+
uses: "ramsey/composer-install@v3"
36+
with:
37+
dependency-versions: "${{ matrix.dependencies }}"
38+
39+
- name: "Validate composer"
40+
run: "composer validate --strict"
41+
42+
- name: "Check composer normalized"
43+
run: "composer normalize --dry-run"
44+
45+
- name: "Check style"
46+
run: "composer check-style"
47+
48+
dependency-analysis:
49+
name: "Dependency Analysis"
50+
51+
runs-on: "ubuntu-latest"
52+
53+
strategy:
54+
matrix:
55+
php-version:
56+
- "7.4"
57+
- "8.0"
58+
- "8.1"
59+
- "8.2"
60+
- "8.3"
61+
62+
dependencies:
63+
- "lowest"
64+
- "highest"
65+
66+
symfony:
67+
- "~5.4.0"
68+
- "~6.4.0"
69+
70+
exclude:
71+
- php-version: "7.4"
72+
symfony: "~6.4.0"
73+
- php-version: "8.0"
74+
symfony: "~6.4.0"
75+
76+
steps:
77+
- name: "Checkout"
78+
uses: "actions/checkout@v4"
79+
80+
- name: "Setup PHP, with composer and extensions"
81+
uses: "shivammathur/setup-php@v2"
82+
with:
83+
coverage: "none"
84+
extensions: "${{ env.PHP_EXTENSIONS }}"
85+
php-version: "${{ matrix.php-version }}"
86+
tools: "flex"
87+
88+
- name: "Install composer dependencies"
89+
uses: "ramsey/composer-install@v3"
90+
env:
91+
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
92+
with:
93+
dependency-versions: "${{ matrix.dependencies }}"
94+
95+
- name: "Dependency analysis"
96+
run: "vendor/bin/composer-dependency-analyser"
97+
98+
static-code-analysis:
99+
name: "Static Code Analysis"
100+
101+
runs-on: "ubuntu-latest"
102+
103+
strategy:
104+
matrix:
105+
php-version:
106+
- "7.4"
107+
- "8.0"
108+
- "8.1"
109+
- "8.2"
110+
- "8.3"
111+
112+
dependencies:
113+
- "lowest"
114+
- "highest"
115+
116+
symfony:
117+
- "~5.4.0"
118+
- "~6.4.0"
119+
120+
exclude:
121+
- php-version: "7.4"
122+
symfony: "~6.4.0"
123+
- php-version: "8.0"
124+
symfony: "~6.4.0"
125+
126+
steps:
127+
- name: "Checkout"
128+
uses: "actions/checkout@v4"
129+
130+
- name: "Setup PHP, with composer and extensions"
131+
uses: "shivammathur/setup-php@v2"
132+
with:
133+
php-version: "${{ matrix.php-version }}"
134+
extensions: "${{ env.PHP_EXTENSIONS }}"
135+
coverage: "none"
136+
tools: "flex"
137+
138+
- name: "Install composer dependencies"
139+
uses: "ramsey/composer-install@v3"
140+
env:
141+
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
142+
with:
143+
dependency-versions: "${{ matrix.dependencies }}"
144+
145+
- name: "Static analysis"
146+
run: "vendor/bin/psalm --php-version=${{ matrix.php-version }}"
147+
148+
unit-tests:
149+
name: "Unit tests"
150+
151+
runs-on: "ubuntu-latest"
152+
153+
strategy:
154+
matrix:
155+
php-version:
156+
- "7.4"
157+
- "8.0"
158+
- "8.1"
159+
- "8.2"
160+
- "8.3"
161+
162+
dependencies:
163+
- "lowest"
164+
- "highest"
165+
166+
symfony:
167+
- "~5.4.0"
168+
- "~6.4.0"
169+
170+
exclude:
171+
- php-version: "7.4"
172+
symfony: "~6.4.0"
173+
- php-version: "8.0"
174+
symfony: "~6.4.0"
175+
176+
steps:
177+
- name: "Checkout"
178+
uses: "actions/checkout@v4"
179+
180+
- name: "Setup PHP, with composer and extensions"
181+
uses: "shivammathur/setup-php@v2"
182+
with:
183+
php-version: "${{ matrix.php-version }}"
184+
extensions: "${{ env.PHP_EXTENSIONS }}"
185+
coverage: "none"
186+
tools: "flex"
187+
188+
- name: "Install composer dependencies"
189+
uses: "ramsey/composer-install@v3"
190+
env:
191+
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
192+
with:
193+
dependency-versions: "${{ matrix.dependencies }}"
194+
195+
- name: "Run phpunit"
196+
run: "composer phpunit"

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Setono
3+
Copyright (c) 2025 Setono
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,26 @@
1212
"require": {
1313
"php": ">=7.4",
1414
"setono/tag-bag": "^1.4",
15-
"symfony/config": "^4.4 || ^5.4 || ^6.0",
16-
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0",
17-
"symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0",
18-
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.0",
19-
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0",
15+
"symfony/config": "^5.4 || ^6.4",
16+
"symfony/dependency-injection": "^5.4 || ^6.4",
17+
"symfony/deprecation-contracts": "^2.0 || ^3.0",
18+
"symfony/event-dispatcher": "^5.4 || ^6.4",
19+
"symfony/http-foundation": "^5.4 || ^6.4",
20+
"symfony/http-kernel": "^5.4 || ^6.4",
2021
"twig/twig": "^2.0 || ^3.0",
2122
"webmozart/assert": "^1.11"
2223
},
2324
"require-dev": {
2425
"matthiasnoback/symfony-dependency-injection-test": "^4.2",
2526
"nyholm/symfony-bundle-test": "^1.7",
27+
"phpspec/prophecy-phpunit": "^2.3",
2628
"phpunit/phpunit": "^9.5",
27-
"roave/security-advisories": "dev-latest",
28-
"setono/code-quality-pack": "^2.2",
29-
"setono/php-templates-bundle": "^1.0",
29+
"psalm/plugin-phpunit": "^0.19.0",
30+
"setono/code-quality-pack": "^2.9",
3031
"setono/tag-bag-gtag": "^1.0",
31-
"setono/tag-bag-php-templates": "^1.2",
3232
"setono/tag-bag-twig": "^1.1",
33-
"symfony/twig-bundle": "^4.4 || ^5.4 || ^6.0"
33+
"shipmonk/composer-dependency-analyser": "^1.8.2",
34+
"symfony/twig-bundle": "^5.4 || ^6.4"
3435
},
3536
"prefer-stable": true,
3637
"autoload": {
@@ -45,14 +46,14 @@
4546
},
4647
"config": {
4748
"allow-plugins": {
48-
"phpstan/extension-installer": true,
49+
"dealerdirect/phpcodesniffer-composer-installer": false,
4950
"ergebnis/composer-normalize": true,
50-
"dealerdirect/phpcodesniffer-composer-installer": false
51+
"phpstan/extension-installer": true
5152
},
5253
"sort-packages": true
5354
},
5455
"scripts": {
55-
"analyse": "phpstan analyse -c phpstan.neon -l max src/",
56+
"analyse": "psalm",
5657
"check-style": "ecs check src/ tests/",
5758
"fix-style": "ecs check --fix src/ tests/",
5859
"phpunit": "phpunit"

ecs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
66

77
return static function (ContainerConfigurator $containerConfigurator): void {
8-
$containerConfigurator->import(__DIR__ . '/vendor/setono/coding-standard/easy-coding-standard.php');
8+
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
99
};

phpspec.yml.dist

Lines changed: 0 additions & 4 deletions
This file was deleted.

phpstan.neon

Lines changed: 0 additions & 3 deletions
This file was deleted.

psalm.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
errorLevel="1"
5+
xmlns="https://getpsalm.org/schema/config"
6+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7+
findUnusedBaselineEntry="false"
8+
findUnusedCode="false"
9+
findUnusedPsalmSuppress="true"
10+
findUnusedVariablesAndParams="false"
11+
phpVersion="7.4"
12+
>
13+
<projectFiles>
14+
<directory name="src"/>
15+
16+
<ignoreFiles>
17+
<directory name="vendor"/>
18+
</ignoreFiles>
19+
</projectFiles>
20+
<plugins>
21+
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
22+
</plugins>
23+
</psalm>

src/DependencyInjection/Compiler/AddPathsToPhpTemplatesEnginePass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use InvalidArgumentException;
88
use ReflectionClass;
9-
use function Safe\sprintf;
109
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1110
use Symfony\Component\DependencyInjection\ContainerBuilder;
1211

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

src/DependencyInjection/Compiler/AddPathsToTwigPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use InvalidArgumentException;
88
use ReflectionClass;
9-
use function Safe\sprintf;
109
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1110
use Symfony\Component\DependencyInjection\ContainerBuilder;
1211
use Symfony\Component\DependencyInjection\Definition;
@@ -35,7 +34,8 @@ private static function addGtagPaths(Definition $twigLoader): void
3534
$filename = (new ReflectionClass($interface))->getFileName();
3635
if (false === $filename) {
3736
throw new InvalidArgumentException(sprintf(
38-
'The filename of interface %s could not be deduced', $interface
37+
'The filename of interface %s could not be deduced',
38+
$interface
3939
));
4040
}
4141

src/DependencyInjection/Compiler/RegisterRenderersPass.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ public function process(ContainerBuilder $container): void
1818

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

21+
/**
22+
* @var string $id
23+
* @var array $tags
24+
*/
2125
foreach ($container->findTaggedServiceIds('setono_tag_bag.renderer') as $id => $tags) {
26+
/** @var array $tag */
2227
foreach ($tags as $tag) {
23-
$priority = $tag['priority'] ?? 0;
28+
$priority = (int) ($tag['priority'] ?? 0);
2429

2530
$renderer->addMethodCall('addRenderer', [new Reference($id), $priority]);
2631
}

0 commit comments

Comments
 (0)