From 31bc360dd97e69f2d2b94a1e4c10520d0505a264 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Sat, 3 Jan 2026 09:29:56 +0330 Subject: [PATCH 1/3] chore: add script to prepare PHPStan baseline --- utils/prepare-baseline.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 utils/prepare-baseline.php diff --git a/utils/prepare-baseline.php b/utils/prepare-baseline.php new file mode 100644 index 000000000000..805820210c79 --- /dev/null +++ b/utils/prepare-baseline.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +$baselineDir = __DIR__ . '/phpstan-baseline'; + +$files = glob($baselineDir . '/*.neon'); +if ($files === false) { + exit(1); +} + +foreach ($files as $file) { + if (is_file($file)) { + unlink($file); + } +} + +$loaderFile = $baselineDir . '/loader.neon'; +if (! touch($loaderFile)) { + echo "Error: Failed to create loader.neon.\n"; + + exit(1); +} From 8d73b42b59b7accca735acc2af849c9ddd92ee55 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Sat, 3 Jan 2026 09:30:58 +0330 Subject: [PATCH 2/3] chore: use PHP script in phpstan:baseline command --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index c1254bf5f583..dab6a3da25ed 100644 --- a/composer.json +++ b/composer.json @@ -112,8 +112,7 @@ ], "metrics": "utils/vendor/bin/phpmetrics --config=phpmetrics.json", "phpstan:baseline": [ - "bash -c \"rm -rf utils/phpstan-baseline/*.neon\"", - "bash -c \"touch utils/phpstan-baseline/loader.neon\"", + "php utils/prepare-baseline.php", "phpstan analyse --ansi --generate-baseline=utils/phpstan-baseline/loader.neon", "split-phpstan-baseline utils/phpstan-baseline/loader.neon" ], From 2a5b43cde8feaa902d8f87b5d42b088ed003b605 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Sat, 3 Jan 2026 14:03:31 +0330 Subject: [PATCH 3/3] chore: remove redundant cleanup from phpstan:baseline --- composer.json | 1 - utils/prepare-baseline.php | 30 ------------------------------ 2 files changed, 31 deletions(-) delete mode 100644 utils/prepare-baseline.php diff --git a/composer.json b/composer.json index dab6a3da25ed..4e2da479b0a4 100644 --- a/composer.json +++ b/composer.json @@ -112,7 +112,6 @@ ], "metrics": "utils/vendor/bin/phpmetrics --config=phpmetrics.json", "phpstan:baseline": [ - "php utils/prepare-baseline.php", "phpstan analyse --ansi --generate-baseline=utils/phpstan-baseline/loader.neon", "split-phpstan-baseline utils/phpstan-baseline/loader.neon" ], diff --git a/utils/prepare-baseline.php b/utils/prepare-baseline.php deleted file mode 100644 index 805820210c79..000000000000 --- a/utils/prepare-baseline.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -$baselineDir = __DIR__ . '/phpstan-baseline'; - -$files = glob($baselineDir . '/*.neon'); -if ($files === false) { - exit(1); -} - -foreach ($files as $file) { - if (is_file($file)) { - unlink($file); - } -} - -$loaderFile = $baselineDir . '/loader.neon'; -if (! touch($loaderFile)) { - echo "Error: Failed to create loader.neon.\n"; - - exit(1); -}