Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(requirement-checker): Rephrase incorrect message for the PHP constraint #860

Merged
merged 4 commits into from
Feb 4, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Box Requirements Checker
WARNING: No configuration file (php.ini) used by PHP!

> Checking Box requirements:
✘ The application requires the version "^10" or greater.
✘ The application requires a version matching "^10".
✔ The application requires the extension "phar".
✔ The package "package-with-extensions" requires the extension "json".
✘ The package "package-with-extensions" requires the extension "ldap". Enable
Expand All @@ -22,7 +22,7 @@ Enable it or install a polyfill.
Fix the following mandatory requirements:
=========================================

* The application requires the version "^10" or greater.
* The application requires a version matching "^10".
* The package "package-with-extensions" requires the extension "ldap". Enable
it or install a polyfill.
* The package "package-with-extensions" requires the extension "random". Enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Box Requirements Checker
WARNING: No configuration file (php.ini) used by PHP!

> Checking Box requirements:
✘ The application requires the version "^10" or greater.
✘ The application requires a version matching "^10".
✔ The application requires the extension "phar".
✔ The package "package-with-extensions" requires the extension "json".
✘ The package "package-with-extensions" requires the extension "ldap". Enable
Expand All @@ -22,7 +22,7 @@ Enable it or install a polyfill.
Fix the following mandatory requirements:
=========================================

* The application requires the version "^10" or greater.
* The application requires a version matching "^10".
* The package "package-with-extensions" requires the extension "ldap". Enable
it or install a polyfill.
* The package "package-with-extensions" requires the extension "random". Enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Box Requirements Checker
WARNING: No configuration file (php.ini) used by PHP!

> Checking Box requirements:
✔ The application requires the version ">=5.3" or greater.
✔ The application requires a version matching ">=5.3".
✔ The application requires the extension "phar".


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Box Requirements Checker
WARNING: No configuration file (php.ini) used by PHP!

> Checking Box requirements:
✔ The application requires the version ">=5.3" or greater.
✔ The application requires a version matching ">=5.3".
✔ The application requires the extension "phar".


Expand Down
8 changes: 4 additions & 4 deletions src/RequirementChecker/AppRequirementsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,21 @@ private static function generatePhpCheckRequirement(string $requiredPhpVersion,
'condition' => $requiredPhpVersion,
'message' => null === $packageName
? sprintf(
'The application requires the version "%s" or greater.',
'The application requires a version matching "%s".',
$requiredPhpVersion,
)
: sprintf(
'The package "%s" requires the version "%s" or greater.',
'The package "%s" requires a version matching "%s".',
$packageName,
$requiredPhpVersion,
),
'helpMessage' => null === $packageName
? sprintf(
'The application requires the version "%s" or greater.',
'The application requires a version matching "%s".',
$requiredPhpVersion,
)
: sprintf(
'The package "%s" requires the version "%s" or greater.',
'The package "%s" requires a version matching "%s".',
$packageName,
$requiredPhpVersion,
),
Expand Down
56 changes: 28 additions & 28 deletions tests/RequirementChecker/AppRequirementsFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.1',
'message' => 'The application requires the version "^7.1" or greater.',
'helpMessage' => 'The application requires the version "^7.1" or greater.',
'message' => 'The application requires a version matching "^7.1".',
'helpMessage' => 'The application requires a version matching "^7.1".',
],
[
'type' => 'extension',
Expand All @@ -196,8 +196,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.1',
'message' => 'The application requires the version "^7.1" or greater.',
'helpMessage' => 'The application requires the version "^7.1" or greater.',
'message' => 'The application requires a version matching "^7.1".',
'helpMessage' => 'The application requires a version matching "^7.1".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -233,8 +233,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.1',
'message' => 'The application requires the version "^7.1" or greater.',
'helpMessage' => 'The application requires the version "^7.1" or greater.',
'message' => 'The application requires a version matching "^7.1".',
'helpMessage' => 'The application requires a version matching "^7.1".',
],
[
'type' => 'extension',
Expand All @@ -261,8 +261,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.1',
'message' => 'The application requires the version "^7.1" or greater.',
'helpMessage' => 'The application requires the version "^7.1" or greater.',
'message' => 'The application requires a version matching "^7.1".',
'helpMessage' => 'The application requires a version matching "^7.1".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -295,8 +295,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.1',
'message' => 'The application requires the version "^7.1" or greater.',
'helpMessage' => 'The application requires the version "^7.1" or greater.',
'message' => 'The application requires a version matching "^7.1".',
'helpMessage' => 'The application requires a version matching "^7.1".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -337,8 +337,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.1',
'message' => 'The application requires the version "^7.1" or greater.',
'helpMessage' => 'The application requires the version "^7.1" or greater.',
'message' => 'The application requires a version matching "^7.1".',
'helpMessage' => 'The application requires a version matching "^7.1".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -501,8 +501,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '>=5.3',
'message' => 'The application requires the version ">=5.3" or greater.',
'helpMessage' => 'The application requires the version ">=5.3" or greater.',
'message' => 'The application requires a version matching ">=5.3".',
'helpMessage' => 'The application requires a version matching ">=5.3".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -574,14 +574,14 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '>=5.3',
'message' => 'The package "beberlei/assert" requires the version ">=5.3" or greater.',
'helpMessage' => 'The package "beberlei/assert" requires the version ">=5.3" or greater.',
'message' => 'The package "beberlei/assert" requires a version matching ">=5.3".',
'helpMessage' => 'The package "beberlei/assert" requires a version matching ">=5.3".',
],
[
'type' => 'php',
'condition' => '^5.3.2 || ^7.0',
'message' => 'The package "composer/ca-bundle" requires the version "^5.3.2 || ^7.0" or greater.',
'helpMessage' => 'The package "composer/ca-bundle" requires the version "^5.3.2 || ^7.0" or greater.',
'message' => 'The package "composer/ca-bundle" requires a version matching "^5.3.2 || ^7.0".',
'helpMessage' => 'The package "composer/ca-bundle" requires a version matching "^5.3.2 || ^7.0".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -664,14 +664,14 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '>=5.3',
'message' => 'The package "beberlei/assert" requires the version ">=5.3" or greater.',
'helpMessage' => 'The package "beberlei/assert" requires the version ">=5.3" or greater.',
'message' => 'The package "beberlei/assert" requires a version matching ">=5.3".',
'helpMessage' => 'The package "beberlei/assert" requires a version matching ">=5.3".',
],
[
'type' => 'php',
'condition' => '^5.3.2 || ^7.0',
'message' => 'The package "composer/ca-bundle" requires the version "^5.3.2 || ^7.0" or greater.',
'helpMessage' => 'The package "composer/ca-bundle" requires the version "^5.3.2 || ^7.0" or greater.',
'message' => 'The package "composer/ca-bundle" requires a version matching "^5.3.2 || ^7.0".',
'helpMessage' => 'The package "composer/ca-bundle" requires a version matching "^5.3.2 || ^7.0".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -833,8 +833,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.3',
'message' => 'The application requires the version "^7.3" or greater.',
'helpMessage' => 'The application requires the version "^7.3" or greater.',
'message' => 'The application requires a version matching "^7.3".',
'helpMessage' => 'The application requires a version matching "^7.3".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -895,8 +895,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.3',
'message' => 'The application requires the version "^7.3" or greater.',
'helpMessage' => 'The application requires the version "^7.3" or greater.',
'message' => 'The application requires a version matching "^7.3".',
'helpMessage' => 'The application requires a version matching "^7.3".',
],
[
'type' => 'extension',
Expand Down Expand Up @@ -965,8 +965,8 @@ public static function lockContentsProvider(): iterable
[
'type' => 'php',
'condition' => '^7.3',
'message' => 'The application requires the version "^7.3" or greater.',
'helpMessage' => 'The application requires the version "^7.3" or greater.',
'message' => 'The application requires a version matching "^7.3".',
'helpMessage' => 'The application requires a version matching "^7.3".',
],
[
'type' => 'extension',
Expand Down
4 changes: 2 additions & 2 deletions tests/RequirementChecker/RequirementsDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ public static function jsonAndLockContentsProvider(): iterable
array (
'type' => 'php',
'condition' => '^7.4',
'message' => 'The package "acme/foo" requires the version "^7.4" or greater.',
'helpMessage' => 'The package "acme/foo" requires the version "^7.4" or greater.',
'message' => 'The package "acme/foo" requires a version matching "^7.4".',
'helpMessage' => 'The package "acme/foo" requires a version matching "^7.4".',
),
1 =>
array (
Expand Down