From 0f08b660a6cd1322cef3e1c91456d196bbc7611d Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Tue, 28 Jul 2026 11:44:56 +0200 Subject: [PATCH 1/3] Message from the future --- src/Command/AnalyseCommand.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Command/AnalyseCommand.php b/src/Command/AnalyseCommand.php index b874dff3183..f7485d02949 100644 --- a/src/Command/AnalyseCommand.php +++ b/src/Command/AnalyseCommand.php @@ -2,6 +2,7 @@ namespace PHPStan\Command; +use DateTimeImmutable; use OndraM\CiDetector\CiDetector; use Override; use PHPStan\Analyser\InternalError; @@ -35,6 +36,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StringInput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\StreamOutput; use Throwable; @@ -63,6 +65,7 @@ use function stream_get_contents; use function strlen; use function substr; +use function time; use const PATHINFO_BASENAME; use const PATHINFO_EXTENSION; @@ -140,6 +143,34 @@ protected function initialize(InputInterface $input, OutputInterface $output): v #[Override] protected function execute(InputInterface $input, OutputInterface $output): int { + if ($output instanceof ConsoleOutputInterface) { + $errorOutput = $output->getErrorOutput(); + $errorOutput->writeln(''); + $errorOutput->writeln("⚠️ You're running an old version of PHPStan.️"); + $errorOutput->writeln(''); + $errorOutput->writeln('The last release in the 1.12.x series with new features'); + + $lastRelease = new DateTimeImmutable('2025-07-17 00:00:00'); + $daysSince = (time() - $lastRelease->getTimestamp()) / 60 / 60 / 24; + $errorOutput->writeln('and bugfixes was released on July 17th 2025,'); + $errorOutput->writeln(sprintf('that\'s %d days ago.', (int) $daysSince)); + $errorOutput->writeln(''); + + $errorOutput->writeln('Since then more than 65 new PHPStan versions were released'); + $errorOutput->writeln('with hundreds of new features, bugfixes, and other'); + $errorOutput->writeln('quality of life improvements.'); + $errorOutput->writeln(''); + + $errorOutput->writeln("To learn about what you're missing out on, check out"); + $errorOutput->writeln('this blog with articles about the latest major releases:'); + $errorOutput->writeln('https://phpstan.org/blog'); + $errorOutput->writeln(''); + + $errorOutput->writeln('Upgrade today to PHPStan 2.2 or newer by using'); + $errorOutput->writeln('"phpstan/phpstan": "^2.2" in your composer.json.'); + $errorOutput->writeln(''); + } + $paths = $input->getArgument('paths'); $memoryLimit = $input->getOption('memory-limit'); $autoloadFile = $input->getOption('autoload-file'); From 062c33cec603ddf04c59f1e7561044defb0df259 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 28 Jul 2026 12:01:53 +0200 Subject: [PATCH 2/3] Check bench files with RequiredPhpVersionCommentTest --- tests/PHPStan/Build/RequiredPhpVersionCommentTest.php | 1 + tests/bench/data/bug-11283.php | 4 +++- tests/bench/data/bug-12159.php | 2 +- tests/bench/data/bug-13352.php | 2 +- tests/bench/data/bug-14319.php | 2 +- tests/bench/data/impure-call-columns.php | 2 +- tests/bench/data/union-fast-path.php | 2 +- tests/bench/data/wordpress-user.php | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php b/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php index baddecb153b..cf7f4487d6d 100644 --- a/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php +++ b/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php @@ -32,6 +32,7 @@ public static function dataFixtures(): iterable __DIR__ . '/../Analyser/data', __DIR__ . '/../Analyser/nsrt', __DIR__ . '/../Analyser/Fiber/data', + __DIR__ . '/../../bench/data', ]; $dataFinder = new Finder(); diff --git a/tests/bench/data/bug-11283.php b/tests/bench/data/bug-11283.php index f0c4b3fc17f..26c83f50b7b 100644 --- a/tests/bench/data/bug-11283.php +++ b/tests/bench/data/bug-11283.php @@ -1,4 +1,6 @@ -= 8.0 + +declare(strict_types=1); namespace Bug11283; diff --git a/tests/bench/data/bug-12159.php b/tests/bench/data/bug-12159.php index d39ae6bd946..352d59d91f5 100644 --- a/tests/bench/data/bug-12159.php +++ b/tests/bench/data/bug-12159.php @@ -1,4 +1,4 @@ -= 8.3 namespace Bug12159; diff --git a/tests/bench/data/bug-13352.php b/tests/bench/data/bug-13352.php index 49f116938ae..9b23609caca 100644 --- a/tests/bench/data/bug-13352.php +++ b/tests/bench/data/bug-13352.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug13352; diff --git a/tests/bench/data/bug-14319.php b/tests/bench/data/bug-14319.php index a685e2a815a..9b7f376e047 100644 --- a/tests/bench/data/bug-14319.php +++ b/tests/bench/data/bug-14319.php @@ -1,4 +1,4 @@ -= 8.0 namespace BenchBug14319; diff --git a/tests/bench/data/impure-call-columns.php b/tests/bench/data/impure-call-columns.php index edc2cd6b234..be1f90e151c 100644 --- a/tests/bench/data/impure-call-columns.php +++ b/tests/bench/data/impure-call-columns.php @@ -1,4 +1,4 @@ -= 8.0 namespace ImpureCallColumnsBench; diff --git a/tests/bench/data/union-fast-path.php b/tests/bench/data/union-fast-path.php index 82ffcad7209..68d318ad0a8 100644 --- a/tests/bench/data/union-fast-path.php +++ b/tests/bench/data/union-fast-path.php @@ -1,4 +1,4 @@ -= 8.0 namespace UnionFastPath; diff --git a/tests/bench/data/wordpress-user.php b/tests/bench/data/wordpress-user.php index c574d4bd34d..6ec36f3ae56 100644 --- a/tests/bench/data/wordpress-user.php +++ b/tests/bench/data/wordpress-user.php @@ -1,4 +1,4 @@ -= 8.0 namespace BenchComplexUnion; From ac5cf8c6941efa8ce70f0f672e80089e82ddf122 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 28 Jul 2026 13:37:44 +0200 Subject: [PATCH 3/3] Revert "Message from the future" This reverts commit 0f08b660a6cd1322cef3e1c91456d196bbc7611d. --- src/Command/AnalyseCommand.php | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/Command/AnalyseCommand.php b/src/Command/AnalyseCommand.php index f7485d02949..b874dff3183 100644 --- a/src/Command/AnalyseCommand.php +++ b/src/Command/AnalyseCommand.php @@ -2,7 +2,6 @@ namespace PHPStan\Command; -use DateTimeImmutable; use OndraM\CiDetector\CiDetector; use Override; use PHPStan\Analyser\InternalError; @@ -36,7 +35,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StringInput; -use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\StreamOutput; use Throwable; @@ -65,7 +63,6 @@ use function stream_get_contents; use function strlen; use function substr; -use function time; use const PATHINFO_BASENAME; use const PATHINFO_EXTENSION; @@ -143,34 +140,6 @@ protected function initialize(InputInterface $input, OutputInterface $output): v #[Override] protected function execute(InputInterface $input, OutputInterface $output): int { - if ($output instanceof ConsoleOutputInterface) { - $errorOutput = $output->getErrorOutput(); - $errorOutput->writeln(''); - $errorOutput->writeln("⚠️ You're running an old version of PHPStan.️"); - $errorOutput->writeln(''); - $errorOutput->writeln('The last release in the 1.12.x series with new features'); - - $lastRelease = new DateTimeImmutable('2025-07-17 00:00:00'); - $daysSince = (time() - $lastRelease->getTimestamp()) / 60 / 60 / 24; - $errorOutput->writeln('and bugfixes was released on July 17th 2025,'); - $errorOutput->writeln(sprintf('that\'s %d days ago.', (int) $daysSince)); - $errorOutput->writeln(''); - - $errorOutput->writeln('Since then more than 65 new PHPStan versions were released'); - $errorOutput->writeln('with hundreds of new features, bugfixes, and other'); - $errorOutput->writeln('quality of life improvements.'); - $errorOutput->writeln(''); - - $errorOutput->writeln("To learn about what you're missing out on, check out"); - $errorOutput->writeln('this blog with articles about the latest major releases:'); - $errorOutput->writeln('https://phpstan.org/blog'); - $errorOutput->writeln(''); - - $errorOutput->writeln('Upgrade today to PHPStan 2.2 or newer by using'); - $errorOutput->writeln('"phpstan/phpstan": "^2.2" in your composer.json.'); - $errorOutput->writeln(''); - } - $paths = $input->getArgument('paths'); $memoryLimit = $input->getOption('memory-limit'); $autoloadFile = $input->getOption('autoload-file');