Skip to content

Commit b3ba0f9

Browse files
committed
phpstan executed for each Symfony version
1 parent 301cecb commit b3ba0f9

14 files changed

+77
-23
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ jobs:
1212
strategy:
1313
matrix:
1414
php: [--php=8.1, --php=8.2]
15+
symfony: [--symfony=6.1, --symfony=6.2, --symfony=6.3]
1516
steps:
1617
- uses: actions/checkout@v2
1718
- uses: ./.github/actions/ci-env
18-
- run: bin/ci/phpstan ${{ matrix.php }}
19+
- run: bin/ci/phpstan ${{ matrix.php }} ${{ matrix.symfony }}
1920

2021
phpdd:
2122
runs-on: ubuntu-latest
@@ -60,7 +61,7 @@ jobs:
6061
strategy:
6162
matrix:
6263
php: [--php=8.1, --php=8.2]
63-
symfony: [--symfony=6.1, --symfony=6.2]
64+
symfony: [--symfony=6.1, --symfony=6.2, --symfony=6.3]
6465
steps:
6566
- uses: actions/checkout@v2
6667
- uses: ./.github/actions/ci-env

bin/ci/phpstan

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
77
source "${ROOT_DIR}"/bin/ci/dockerise.inc.bash
88

99
phpVersion=
10+
symfonyVersion=
1011
phpstanParameters=
1112
clearCache=false
1213
for arg in "${@}"; do
1314
if [ "${arg:0:6}" == "--php=" ]; then
1415
phpVersion="${arg:6}"
16+
elif [ "${arg:0:10}" == "--symfony=" ]; then
17+
symfonyVersion="${arg:10}"
1518
elif [ "${arg}" == "--clear-cache" ]; then
1619
clearCache=true
1720
else
@@ -24,15 +27,15 @@ if [ "${clearCache}" == true ] && [ -d "${ROOT_DIR}"/var/ci/phpstan ]; then
2427
rm -rf "${ROOT_DIR}"/var/ci/phpstan
2528
fi
2629

27-
if [ "${phpVersion}" == "" ]; then
30+
if [ "${phpVersion}" == "" ] || [ "${symfonyVersion}" == "" ]; then
2831
php8.1 "${ROOT_DIR}"/bin/ci/phpstan.php ${phpstanParameters}
2932
else
30-
echo "PHP ${phpVersion}"
33+
echo "PHP ${phpVersion} - Symfony ${symfonyVersion}"
3134

3235
"php${phpVersion}" \
3336
"${PHPSTAN_BIN_PATH}" \
3437
analyse \
3538
--ansi \
36-
--configuration config/ci/phpstan.php-"${phpVersion}".neon \
39+
--configuration config/ci/phpstan.php-"${phpVersion}".symfony-"${symfonyVersion}".neon \
3740
${phpstanParameters}
3841
fi

bin/ci/phpstan.php

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,55 @@
1010
use Steevanb\PhpTypedArray\ScalarArray\StringArray;
1111
use Symfony\Component\Console\Input\ArgvInput;
1212

13-
require $_SERVER['COMPOSER_HOME'] . '/vendor/autoload.php';
1413
require dirname(__DIR__, 2) . '/vendor/autoload.php';
1514

16-
function createPhpstanProcesses(): ProcessInterfaceArray
15+
function getAvailableSymfonyVersions(): StringArray
1716
{
18-
$phpVersions = new StringArray(['8.1', '8.2']);
17+
$return = new StringArray();
18+
foreach (new StringArray(['6.1', '6.2', '6.3']) as $symfonyVersion) {
19+
$return[] = $symfonyVersion;
20+
}
21+
22+
return $return;
23+
}
24+
25+
function createPhpstanProcesses(string $phpVersion = null, string $symfonyVersion = null): ProcessInterfaceArray
26+
{
27+
$phpVersions = new StringArray(is_string($phpVersion) ? [$phpVersion] : ['8.1', '8.2']);
1928

2029
$return = new ProcessInterfaceArray();
2130
foreach ($phpVersions as $loopPhpVersion) {
22-
$return[] = createPhpstanProcess($loopPhpVersion);
31+
$symfonyVersions = is_string($symfonyVersion)
32+
? [$symfonyVersion]
33+
: getAvailableSymfonyVersions()->toArray();
34+
35+
foreach ($symfonyVersions as $loopSymfonyVersion) {
36+
$return[] = createPhpstanProcess($loopPhpVersion, $loopSymfonyVersion);
37+
}
2338
}
2439

2540
return $return;
2641
}
2742

28-
function createPhpstanProcess(string $phpVersion): Process
43+
function createPhpstanProcess(string $phpVersion, string $symfonyVersion): Process
2944
{
30-
return (new Process([__DIR__ . '/phpstan', '--php=' . $phpVersion]))
31-
->setName('phpstan --php=' . $phpVersion);
45+
return (new Process([__DIR__ . '/phpstan', '--php=' . $phpVersion, '--symfony=' . $symfonyVersion]))
46+
->setName('phpstan --php=' . $phpVersion . ' --symfony=' . $symfonyVersion);
47+
}
48+
49+
$phpVersion = null;
50+
$symfonyVersion = null;
51+
$applicationArgv = new StringArray();
52+
foreach ($argv as $arg) {
53+
if (str_starts_with($arg, '--php=')) {
54+
$phpVersion = substr($arg, 6);
55+
} elseif (str_starts_with($arg, '--symfony=')) {
56+
$symfonyVersion = substr($arg, 10);
57+
} else {
58+
$applicationArgv[] = $arg;
59+
}
3260
}
3361

3462
(new ParallelProcessesApplication())
35-
->addProcesses(createPhpstanProcesses())
36-
->run(new ArgvInput($argv));
63+
->addProcesses(createPhpstanProcesses($phpVersion, $symfonyVersion))
64+
->run(new ArgvInput($applicationArgv->toArray()));

bin/ci/phpunit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
function getAvailableSymfonyVersions(): StringArray
1616
{
1717
$return = new StringArray();
18-
foreach (new StringArray(['6.1', '6.2']) as $symfonyVersion) {
18+
foreach (new StringArray(['6.1', '6.2', '6.3']) as $symfonyVersion) {
1919
$return[] = $symfonyVersion;
2020
}
2121

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### master
22

3+
- [#227](https://github.com/steevanb/php-parallel-processes/issues/227) Fix TearDownProcess who never start in some cases
4+
- [#226](https://github.com/steevanb/php-parallel-processes/issues/226) Add compatibility with Symfony 6.3
5+
- [#228](https://github.com/steevanb/php-parallel-processes/issues/228) Execute phpstan for each Symfony version
6+
37
### [0.11.0](../../compare/0.10.0...0.11.0) - 2023-04-05
48

59
- [BC Break] Replace `ProcessArray` by `ProcessInterfaceArray`

config/ci/phpstan.php-8.1.neon

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
includes:
2+
- phpstan.neon
3+
parameters:
4+
tmpDir: ../../var/ci/phpstan/php-8-1/symfony-6-1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
includes:
2+
- phpstan.neon
3+
parameters:
4+
tmpDir: ../../var/ci/phpstan/php-8-1/symfony-6-2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
includes:
2+
- phpstan.neon
3+
parameters:
4+
tmpDir: ../../var/ci/phpstan/php-8-1/symfony-6-3

config/ci/phpstan.php-8.2.neon

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

0 commit comments

Comments
 (0)