diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 88ff931..177fa6c 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -60,7 +60,7 @@ jobs: # see https://github.com/shivammathur/setup-php - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none # composer install cache - https://github.com/ramsey/composer-install diff --git a/.github/workflows/downgraded_release.yaml b/.github/workflows/downgraded_release.yaml index bb50235..f783c4e 100644 --- a/.github/workflows/downgraded_release.yaml +++ b/.github/workflows/downgraded_release.yaml @@ -19,7 +19,7 @@ jobs: - uses: "shivammathur/setup-php@v2" with: - php-version: 8.3 + php-version: 8.4 coverage: none # invoke patches diff --git a/composer.json b/composer.json index afed573..00d407f 100644 --- a/composer.json +++ b/composer.json @@ -6,18 +6,18 @@ "bin/jack" ], "require": { - "php": ">=8.3", + "php": ">=8.4", "composer/semver": "^3.4", "entropy/entropy": "dev-main", "nette/utils": "^4.1", - "symfony/process": "^7.4", + "symfony/process": "^8.0", "webmozart/assert": "^2.0" }, "require-dev": { "phpecs/phpecs": "^2.2", "phpstan/extension-installer": "^1.4", "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^12.5", + "phpunit/phpunit": "^13.0", "rector/rector": "^2.2", "rector/swiss-knife": "^2.3", "shipmonk/composer-dependency-analyser": "^1.8", diff --git a/src/Command/BreakPointCommand.php b/src/Command/BreakPointCommand.php index 5dc93ac..b9a16f7 100644 --- a/src/Command/BreakPointCommand.php +++ b/src/Command/BreakPointCommand.php @@ -24,9 +24,10 @@ public function __construct( /** * @param bool $dev Focus on dev packages only * @param int $limit Maximum number of outdated major version packages + * @param int $minDays Minimum number of days a release has to be old to be considered outdated * @param string[] $ignore Ignore packages by name, e.g. "symfony/" or "symfony/console" */ - public function run(bool $dev = false, int $limit = 5, array $ignore = []): int + public function run(bool $dev = false, int $limit = 5, int $minDays = 0, array $ignore = []): int { $this->outputPrinter->green('Analyzing "composer.json" for major and minor outdated packages'); @@ -40,16 +41,26 @@ public function run(bool $dev = false, int $limit = 5, array $ignore = []): int } $composerJsonFilePath = getcwd() . '/composer.json'; + $now = new \DateTimeImmutable(); $outdatedComposer = $this->outdatedComposerFactory->createOutdatedComposer( array_filter( $responseJson[ComposerKey::INSTALLED_KEY], - static function (array $package) use ($ignore): bool { + static function (array $package) use ($ignore, $minDays, $now): bool { foreach ($ignore as $ignoredPackage) { if (str_contains((string) $package['name'], $ignoredPackage)) { return false; } } + if ($minDays === 0) { + return true; + } + + $pageAgeInDays = (new \DateTimeImmutable($package['latest-release-date']))->diff($now)->days; + if ($pageAgeInDays < $minDays) { + return false; + } + return true; } ),