diff --git a/tests/fixtures/my-manifest.php b/tests/fixtures/my-manifest.php index a418b4f..0c5a8ae 100644 --- a/tests/fixtures/my-manifest.php +++ b/tests/fixtures/my-manifest.php @@ -35,30 +35,28 @@ public function __invoke(array $content): string } else { $version = $rootPackage['version']; } - $entries[] = [$rootPackage['name'], $version]; + $entries[] = [$rootPackage['name'], '', $version, '']; $allRequirements = [ - '' => $composerJson['require'], - ' (for development)' => $composerJson['require-dev'] ?? [], + 'Direct (for production)' => $composerJson['require'], + 'Direct (for development)' => $composerJson['require-dev'] ?? [], ]; foreach ($allRequirements as $category => $requirements) { foreach ($requirements as $req => $constraint) { if (!empty($constraint)) { - $constraint = sprintf('%s', $constraint); - $prefix = 'requires'; + $constraint = sprintf('requires %s', $constraint); } else { - $prefix = 'uses'; + $constraint = 'uses'; } - $installedPhp['versions'][$req]['prefix'] = $prefix; if ('php' === $req) { - $entries[] = [sprintf('%s%s %s', $prefix, $category, "$req $constraint"), phpversion()]; + $entries[] = [$req, $constraint, phpversion(), $category]; } elseif (str_starts_with($req, 'ext-')) { $extension = substr($req, 4); - $entries[] = [sprintf('%s%s %s', $prefix, $category, "$req $constraint"), phpversion($extension)]; + $entries[] = [$req, $constraint, phpversion($extension), $category]; } else { - $installedPhp['versions'][$req]['constraint'] = $constraint; - $installedPhp['versions'][$req]['category'] = $category; + $installedPhp['versions'][$req]['constraint'] = $constraint; + $installedPhp['versions'][$req]['category'] = $category; } } } @@ -68,10 +66,9 @@ public function __invoke(array $content): string continue; } if (isset($values['pretty_version'])) { - $category = $values['category'] ?? ''; + $category = $values['category'] ?? 'Transitive'; $constraint = $values['constraint'] ?? ''; - $prefix = $values['prefix'] ?? 'uses'; - $entries[] = [sprintf('%s%s %s', $prefix, $category, "$package $constraint"), $values['pretty_version']]; + $entries[] = [$package, $constraint, $values['pretty_version'], $category]; } // otherwise, it's a virtual package } @@ -79,7 +76,7 @@ public function __invoke(array $content): string $output->setDecorated(true); $output->writeln(''); - $headers = ['Package', 'Version']; + $headers = ['Package', 'Constraint', 'Version', "Dependency's category"]; $table = new Table($output); $table