Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,3 @@
}
}
}




5 changes: 5 additions & 0 deletions src/Command/BreakPointCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$composerJsonFilePath
);

if ($outdatedComposer->count() === 0) {
$symfonyStyle->success('All packages are up to date');
return self::SUCCESS;
}

$symfonyStyle->title(
sprintf(
'Found %d outdated package%s',
Expand Down
6 changes: 6 additions & 0 deletions src/Command/OpenVersionsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$composerJsonFilePath
);

if ($outdatedComposer->count() === 0) {
$symfonyStyle->success('All packages are up to date. You are the best!');

return self::SUCCESS;
}

$symfonyStyle->newLine();

$symfonyStyle->writeln(
Expand Down
9 changes: 8 additions & 1 deletion src/OutdatedComposerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Rector\Jack\Mapper\OutdatedPackageMapper;
use Rector\Jack\ValueObject\OutdatedComposer;
use Rector\Jack\ValueObject\OutdatedPackage;

/**
* @see \Rector\Jack\Tests\OutdatedComposerFactory\OutdatedComposerFactoryTest
Expand All @@ -24,6 +25,12 @@ public function createOutdatedComposer(array $installedPackages, string $compose
{
$outdatedPackages = $this->outdatedPackageMapper->mapToObjects($installedPackages, $composerJsonFilePath);

return new OutdatedComposer($outdatedPackages);
// filter out dev packages, those are silently added, when "minimum-stability" is set to "dev"
$nonDevOutdatedPackages = array_filter(
$outdatedPackages,
fn (OutdatedPackage $outdatedPackage): bool => ! $outdatedPackage->lastestIsDevBranch()
);

return new OutdatedComposer($nonDevOutdatedPackages);
}
}
9 changes: 9 additions & 0 deletions src/ValueObject/OutdatedPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,13 @@ public function isVeryOld(): bool
$matchYears = Strings::match($this->currentVersionAge, '#[3-9] years#');
return $matchYears !== null;
}

public function lastestIsDevBranch(): bool
{
if (str_starts_with($this->latestVersion, 'dev-')) {
return true;
}

return str_contains($this->latestVersion, '-dev');
}
}