From 6972442133e60795e614faf85e8806de0e743c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Sun, 22 Oct 2023 15:52:03 +0200 Subject: [PATCH 1/2] feat: Add information about the requirement source Previously the source was mentioned in the message but there was no way to retrieve it reliable without reverse engineering the message. --- res/requirement-checker/vendor/composer/installed.php | 2 +- src/RequirementChecker/Requirement.php | 5 +++++ tests/RequirementChecker/RequirementTest.php | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/res/requirement-checker/vendor/composer/installed.php b/res/requirement-checker/vendor/composer/installed.php index d9a8dfae6..6e6c20345 100644 --- a/res/requirement-checker/vendor/composer/installed.php +++ b/res/requirement-checker/vendor/composer/installed.php @@ -2,4 +2,4 @@ namespace HumbugBox440; -return array('root' => array('name' => 'humbug/requirement-checker', 'pretty_version' => '4.x.x-dev', 'version' => '4.9999999.9999999.9999999-dev', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \true), 'versions' => array('composer/semver' => array('pretty_version' => '3.4.0', 'version' => '3.4.0.0', 'reference' => '35e8d0af4486141bc745f23a29cc2091eb624a32', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/instantiator' => array('pretty_version' => '2.0.0', 'version' => '2.0.0.0', 'reference' => 'c6222283fa3f4ac679f8b9ced9a4e23f163e80d0', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/instantiator', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/composer-normalize' => array('pretty_version' => '2.37.0', 'version' => '2.37.0.0', 'reference' => '25d0fa13545452208fe21216608ed62b637e40f0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../ergebnis/composer-normalize', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json' => array('pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'reference' => 'd66ea30060856d0729a4aa319a02752519ca63a0', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json-normalizer' => array('pretty_version' => '4.2.0', 'version' => '4.2.0.0', 'reference' => '7d06355857dc5fad96e8b296996f26150dfab299', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json-normalizer', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json-pointer' => array('pretty_version' => '3.2.0', 'version' => '3.2.0.0', 'reference' => '861516ff5afa1aa8905fdf3361315909523a1bf8', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json-pointer', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json-printer' => array('pretty_version' => '3.3.0', 'version' => '3.3.0.0', 'reference' => '18920367473b099633f644f0ca6dc8794345148f', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json-printer', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json-schema-validator' => array('pretty_version' => '4.0.0', 'version' => '4.0.0.0', 'reference' => 'a6166272ac5691a9bc791f185841e5f92a6d4723', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json-schema-validator', 'aliases' => array(), 'dev_requirement' => \true), 'fidry/makefile' => array('pretty_version' => '0.2.3', 'version' => '0.2.3.0', 'reference' => 'fb346e2568c2ad3c7526b0cc80ab6e18ff42e573', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/makefile', 'aliases' => array(), 'dev_requirement' => \true), 'humbug/requirement-checker' => array('pretty_version' => '4.x.x-dev', 'version' => '4.9999999.9999999.9999999-dev', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'justinrainbow/json-schema' => array('pretty_version' => 'v5.2.13', 'version' => '5.2.13.0', 'reference' => 'fbbe7e5d79f618997bc3332a6f49246036c45793', 'type' => 'library', 'install_path' => __DIR__ . '/../justinrainbow/json-schema', 'aliases' => array(), 'dev_requirement' => \true), 'localheinz/diff' => array('pretty_version' => '1.1.1', 'version' => '1.1.1.0', 'reference' => '851bb20ea8358c86f677f5f111c4ab031b1c764c', 'type' => 'library', 'install_path' => __DIR__ . '/../localheinz/diff', 'aliases' => array(), 'dev_requirement' => \true), 'myclabs/deep-copy' => array('pretty_version' => '1.11.1', 'version' => '1.11.1.0', 'reference' => '7284c22080590fb39f2ffa3e9057f10a4ddd0e0c', 'type' => 'library', 'install_path' => __DIR__ . '/../myclabs/deep-copy', 'aliases' => array(), 'dev_requirement' => \true), 'nikic/php-parser' => array('pretty_version' => 'v4.17.1', 'version' => '4.17.1.0', 'reference' => 'a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \true), 'phar-io/manifest' => array('pretty_version' => '2.0.3', 'version' => '2.0.3.0', 'reference' => '97803eca37d319dfa7826cc2437fc020857acb53', 'type' => 'library', 'install_path' => __DIR__ . '/../phar-io/manifest', 'aliases' => array(), 'dev_requirement' => \true), 'phar-io/version' => array('pretty_version' => '3.2.1', 'version' => '3.2.1.0', 'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74', 'type' => 'library', 'install_path' => __DIR__ . '/../phar-io/version', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-code-coverage' => array('pretty_version' => '9.2.29', 'version' => '9.2.29.0', 'reference' => '6a3a87ac2bbe33b25042753df8195ba4aa534c76', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-code-coverage', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-file-iterator' => array('pretty_version' => '3.0.6', 'version' => '3.0.6.0', 'reference' => 'cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-file-iterator', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-invoker' => array('pretty_version' => '3.1.1', 'version' => '3.1.1.0', 'reference' => '5a10147d0aaf65b58940a0b72f71c9ac0423cc67', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-invoker', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-text-template' => array('pretty_version' => '2.0.4', 'version' => '2.0.4.0', 'reference' => '5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-text-template', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-timer' => array('pretty_version' => '5.0.3', 'version' => '5.0.3.0', 'reference' => '5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-timer', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/phpunit' => array('pretty_version' => '9.6.13', 'version' => '9.6.13.0', 'reference' => 'f3d767f7f9e191eab4189abe41ab37797e30b1be', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/phpunit', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/cli-parser' => array('pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'reference' => '442e7c7e687e42adc03470c7b668bc4b2402c0b2', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/cli-parser', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/code-unit' => array('pretty_version' => '1.0.8', 'version' => '1.0.8.0', 'reference' => '1fc9f64c0927627ef78ba436c9b17d967e68e120', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/code-unit', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/code-unit-reverse-lookup' => array('pretty_version' => '2.0.3', 'version' => '2.0.3.0', 'reference' => 'ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/comparator' => array('pretty_version' => '4.0.8', 'version' => '4.0.8.0', 'reference' => 'fa0f136dd2334583309d32b62544682ee972b51a', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/comparator', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/complexity' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => '739b35e53379900cc9ac327b2147867b8b6efd88', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/complexity', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/diff' => array('pretty_version' => '4.0.5', 'version' => '4.0.5.0', 'reference' => '74be17022044ebaaecfdf0c5cd504fc9cd5a7131', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/environment' => array('pretty_version' => '5.1.5', 'version' => '5.1.5.0', 'reference' => '830c43a844f1f8d5b7a1f6d6076b784454d8b7ed', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/environment', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/exporter' => array('pretty_version' => '4.0.5', 'version' => '4.0.5.0', 'reference' => 'ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/exporter', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/global-state' => array('pretty_version' => '5.0.6', 'version' => '5.0.6.0', 'reference' => 'bde739e7565280bda77be70044ac1047bc007e34', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/global-state', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/lines-of-code' => array('pretty_version' => '1.0.3', 'version' => '1.0.3.0', 'reference' => 'c1c2e997aa3146983ed888ad08b15470a2e22ecc', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/lines-of-code', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/object-enumerator' => array('pretty_version' => '4.0.4', 'version' => '4.0.4.0', 'reference' => '5c9eeac41b290a3712d88851518825ad78f45c71', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/object-enumerator', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/object-reflector' => array('pretty_version' => '2.0.4', 'version' => '2.0.4.0', 'reference' => 'b4f479ebdbf63ac605d183ece17d8d7fe49c15c7', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/object-reflector', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/recursion-context' => array('pretty_version' => '4.0.5', 'version' => '4.0.5.0', 'reference' => 'e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/recursion-context', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/resource-operations' => array('pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'reference' => '0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/resource-operations', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/type' => array('pretty_version' => '3.2.1', 'version' => '3.2.1.0', 'reference' => '75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/type', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/version' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'c6c1022351a901512170118436c764e473f6de8c', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/version', 'aliases' => array(), 'dev_requirement' => \true), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.3.0', 'version' => '3.3.0.0', 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \true), 'symfony/polyfill-ctype' => array('pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', 'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'aliases' => array(), 'dev_requirement' => \true), 'symfony/yaml' => array('pretty_version' => 'v6.3.3', 'version' => '6.3.3.0', 'reference' => 'e23292e8c07c85b971b44c1c4b87af52133e2add', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \true), 'thecodingmachine/safe' => array('pretty_version' => 'v2.5.0', 'version' => '2.5.0.0', 'reference' => '3115ecd6b4391662b4931daac4eba6b07a2ac1f0', 'type' => 'library', 'install_path' => __DIR__ . '/../thecodingmachine/safe', 'aliases' => array(), 'dev_requirement' => \true), 'theseer/tokenizer' => array('pretty_version' => '1.2.1', 'version' => '1.2.1.0', 'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e', 'type' => 'library', 'install_path' => __DIR__ . '/../theseer/tokenizer', 'aliases' => array(), 'dev_requirement' => \true))); +return array('root' => array('name' => 'humbug/requirement-checker', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'b7472c264dce64023feb2ac0741eb3d0c2664453', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \true), 'versions' => array('composer/semver' => array('pretty_version' => '3.4.0', 'version' => '3.4.0.0', 'reference' => '35e8d0af4486141bc745f23a29cc2091eb624a32', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/instantiator' => array('pretty_version' => '2.0.0', 'version' => '2.0.0.0', 'reference' => 'c6222283fa3f4ac679f8b9ced9a4e23f163e80d0', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/instantiator', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/composer-normalize' => array('pretty_version' => '2.37.0', 'version' => '2.37.0.0', 'reference' => '25d0fa13545452208fe21216608ed62b637e40f0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../ergebnis/composer-normalize', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json' => array('pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'reference' => 'd66ea30060856d0729a4aa319a02752519ca63a0', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json-normalizer' => array('pretty_version' => '4.2.0', 'version' => '4.2.0.0', 'reference' => '7d06355857dc5fad96e8b296996f26150dfab299', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json-normalizer', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json-pointer' => array('pretty_version' => '3.2.0', 'version' => '3.2.0.0', 'reference' => '861516ff5afa1aa8905fdf3361315909523a1bf8', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json-pointer', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json-printer' => array('pretty_version' => '3.3.0', 'version' => '3.3.0.0', 'reference' => '18920367473b099633f644f0ca6dc8794345148f', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json-printer', 'aliases' => array(), 'dev_requirement' => \true), 'ergebnis/json-schema-validator' => array('pretty_version' => '4.0.0', 'version' => '4.0.0.0', 'reference' => 'a6166272ac5691a9bc791f185841e5f92a6d4723', 'type' => 'library', 'install_path' => __DIR__ . '/../ergebnis/json-schema-validator', 'aliases' => array(), 'dev_requirement' => \true), 'fidry/makefile' => array('pretty_version' => '0.2.3', 'version' => '0.2.3.0', 'reference' => 'fb346e2568c2ad3c7526b0cc80ab6e18ff42e573', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/makefile', 'aliases' => array(), 'dev_requirement' => \true), 'humbug/requirement-checker' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'b7472c264dce64023feb2ac0741eb3d0c2664453', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'justinrainbow/json-schema' => array('pretty_version' => 'v5.2.13', 'version' => '5.2.13.0', 'reference' => 'fbbe7e5d79f618997bc3332a6f49246036c45793', 'type' => 'library', 'install_path' => __DIR__ . '/../justinrainbow/json-schema', 'aliases' => array(), 'dev_requirement' => \true), 'localheinz/diff' => array('pretty_version' => '1.1.1', 'version' => '1.1.1.0', 'reference' => '851bb20ea8358c86f677f5f111c4ab031b1c764c', 'type' => 'library', 'install_path' => __DIR__ . '/../localheinz/diff', 'aliases' => array(), 'dev_requirement' => \true), 'myclabs/deep-copy' => array('pretty_version' => '1.11.1', 'version' => '1.11.1.0', 'reference' => '7284c22080590fb39f2ffa3e9057f10a4ddd0e0c', 'type' => 'library', 'install_path' => __DIR__ . '/../myclabs/deep-copy', 'aliases' => array(), 'dev_requirement' => \true), 'nikic/php-parser' => array('pretty_version' => 'v4.17.1', 'version' => '4.17.1.0', 'reference' => 'a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \true), 'phar-io/manifest' => array('pretty_version' => '2.0.3', 'version' => '2.0.3.0', 'reference' => '97803eca37d319dfa7826cc2437fc020857acb53', 'type' => 'library', 'install_path' => __DIR__ . '/../phar-io/manifest', 'aliases' => array(), 'dev_requirement' => \true), 'phar-io/version' => array('pretty_version' => '3.2.1', 'version' => '3.2.1.0', 'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74', 'type' => 'library', 'install_path' => __DIR__ . '/../phar-io/version', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-code-coverage' => array('pretty_version' => '9.2.29', 'version' => '9.2.29.0', 'reference' => '6a3a87ac2bbe33b25042753df8195ba4aa534c76', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-code-coverage', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-file-iterator' => array('pretty_version' => '3.0.6', 'version' => '3.0.6.0', 'reference' => 'cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-file-iterator', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-invoker' => array('pretty_version' => '3.1.1', 'version' => '3.1.1.0', 'reference' => '5a10147d0aaf65b58940a0b72f71c9ac0423cc67', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-invoker', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-text-template' => array('pretty_version' => '2.0.4', 'version' => '2.0.4.0', 'reference' => '5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-text-template', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/php-timer' => array('pretty_version' => '5.0.3', 'version' => '5.0.3.0', 'reference' => '5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/php-timer', 'aliases' => array(), 'dev_requirement' => \true), 'phpunit/phpunit' => array('pretty_version' => '9.6.13', 'version' => '9.6.13.0', 'reference' => 'f3d767f7f9e191eab4189abe41ab37797e30b1be', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/phpunit', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/cli-parser' => array('pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'reference' => '442e7c7e687e42adc03470c7b668bc4b2402c0b2', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/cli-parser', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/code-unit' => array('pretty_version' => '1.0.8', 'version' => '1.0.8.0', 'reference' => '1fc9f64c0927627ef78ba436c9b17d967e68e120', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/code-unit', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/code-unit-reverse-lookup' => array('pretty_version' => '2.0.3', 'version' => '2.0.3.0', 'reference' => 'ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/comparator' => array('pretty_version' => '4.0.8', 'version' => '4.0.8.0', 'reference' => 'fa0f136dd2334583309d32b62544682ee972b51a', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/comparator', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/complexity' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => '739b35e53379900cc9ac327b2147867b8b6efd88', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/complexity', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/diff' => array('pretty_version' => '4.0.5', 'version' => '4.0.5.0', 'reference' => '74be17022044ebaaecfdf0c5cd504fc9cd5a7131', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/environment' => array('pretty_version' => '5.1.5', 'version' => '5.1.5.0', 'reference' => '830c43a844f1f8d5b7a1f6d6076b784454d8b7ed', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/environment', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/exporter' => array('pretty_version' => '4.0.5', 'version' => '4.0.5.0', 'reference' => 'ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/exporter', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/global-state' => array('pretty_version' => '5.0.6', 'version' => '5.0.6.0', 'reference' => 'bde739e7565280bda77be70044ac1047bc007e34', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/global-state', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/lines-of-code' => array('pretty_version' => '1.0.3', 'version' => '1.0.3.0', 'reference' => 'c1c2e997aa3146983ed888ad08b15470a2e22ecc', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/lines-of-code', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/object-enumerator' => array('pretty_version' => '4.0.4', 'version' => '4.0.4.0', 'reference' => '5c9eeac41b290a3712d88851518825ad78f45c71', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/object-enumerator', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/object-reflector' => array('pretty_version' => '2.0.4', 'version' => '2.0.4.0', 'reference' => 'b4f479ebdbf63ac605d183ece17d8d7fe49c15c7', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/object-reflector', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/recursion-context' => array('pretty_version' => '4.0.5', 'version' => '4.0.5.0', 'reference' => 'e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/recursion-context', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/resource-operations' => array('pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'reference' => '0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/resource-operations', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/type' => array('pretty_version' => '3.2.1', 'version' => '3.2.1.0', 'reference' => '75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/type', 'aliases' => array(), 'dev_requirement' => \true), 'sebastian/version' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'c6c1022351a901512170118436c764e473f6de8c', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/version', 'aliases' => array(), 'dev_requirement' => \true), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.3.0', 'version' => '3.3.0.0', 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \true), 'symfony/polyfill-ctype' => array('pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', 'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'aliases' => array(), 'dev_requirement' => \true), 'symfony/yaml' => array('pretty_version' => 'v6.3.3', 'version' => '6.3.3.0', 'reference' => 'e23292e8c07c85b971b44c1c4b87af52133e2add', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \true), 'thecodingmachine/safe' => array('pretty_version' => 'v2.5.0', 'version' => '2.5.0.0', 'reference' => '3115ecd6b4391662b4931daac4eba6b07a2ac1f0', 'type' => 'library', 'install_path' => __DIR__ . '/../thecodingmachine/safe', 'aliases' => array(), 'dev_requirement' => \true), 'theseer/tokenizer' => array('pretty_version' => '1.2.1', 'version' => '1.2.1.0', 'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e', 'type' => 'library', 'install_path' => __DIR__ . '/../theseer/tokenizer', 'aliases' => array(), 'dev_requirement' => \true))); diff --git a/src/RequirementChecker/Requirement.php b/src/RequirementChecker/Requirement.php index eb0de95ef..529c85153 100644 --- a/src/RequirementChecker/Requirement.php +++ b/src/RequirementChecker/Requirement.php @@ -22,6 +22,7 @@ final class Requirement public function __construct( private readonly RequirementType $type, private readonly string $condition, + private readonly ?string $source, private readonly string $message, private readonly string $helpMessage, ) { @@ -32,6 +33,7 @@ public static function forPHP(string $requiredPhpVersion, ?string $packageName): return new self( RequirementType::PHP, $requiredPhpVersion, + $packageName, null === $packageName ? sprintf( 'The application requires a version matching "%s".', @@ -60,6 +62,7 @@ public static function forRequiredExtension(string $extension, ?string $packageN return new self( RequirementType::EXTENSION, $extension, + $packageName, null === $packageName ? sprintf( 'The application requires the extension "%s".', @@ -88,6 +91,7 @@ public static function forConflictingExtension(string $extension, ?string $packa return new self( RequirementType::EXTENSION_CONFLICT, $extension, + $packageName, null === $packageName ? sprintf( 'The application conflicts with the extension "%s".', @@ -116,6 +120,7 @@ public function toArray(): array return [ 'type' => $this->type->value, 'condition' => $this->condition, + 'source' => $this->source, 'message' => $this->message, 'helpMessage' => $this->helpMessage, ]; diff --git a/tests/RequirementChecker/RequirementTest.php b/tests/RequirementChecker/RequirementTest.php index aa9464582..508f1129b 100644 --- a/tests/RequirementChecker/RequirementTest.php +++ b/tests/RequirementChecker/RequirementTest.php @@ -30,6 +30,7 @@ public function test_it_can_be_created_for_a_php_version(): void $expected = [ 'type' => 'php', 'condition' => '^8.2', + 'source' => null, 'message' => 'The application requires a version matching "^8.2".', 'helpMessage' => 'The application requires a version matching "^8.2".', ]; @@ -44,6 +45,7 @@ public function test_it_can_be_created_for_a_php_version_for_a_package(): void $expected = [ 'type' => 'php', 'condition' => '^8.2', + 'source' => 'box/test', 'message' => 'The package "box/test" requires a version matching "^8.2".', 'helpMessage' => 'The package "box/test" requires a version matching "^8.2".', ]; @@ -58,6 +60,7 @@ public function test_it_can_be_created_for_an_extension_constraint(): void $expected = [ 'type' => 'extension', 'condition' => 'mbstring', + 'source' => null, 'message' => 'The application requires the extension "mbstring".', 'helpMessage' => 'The application requires the extension "mbstring". You either need to enable it or request the application to be shipped with a polyfill for this extension.', ]; @@ -72,6 +75,7 @@ public function test_it_can_be_created_for_an_extension_constraint_for_a_package $expected = [ 'type' => 'extension', 'condition' => 'mbstring', + 'source' => 'box/test', 'message' => 'The package "box/test" requires the extension "mbstring".', 'helpMessage' => 'The package "box/test" requires the extension "mbstring". You either need to enable it or request the application to be shipped with a polyfill for this extension.', ]; @@ -86,6 +90,7 @@ public function test_it_can_be_created_for_a_conflicting_extension_constraint(): $expected = [ 'type' => 'extension-conflict', 'condition' => 'mbstring', + 'source' => null, 'message' => 'The application conflicts with the extension "mbstring".', 'helpMessage' => 'The application conflicts with the extension "mbstring". You need to disable it in order to run this application.', ]; @@ -100,6 +105,7 @@ public function test_it_can_be_created_for_a_conflicting_extension_constraint_fo $expected = [ 'type' => 'extension-conflict', 'condition' => 'mbstring', + 'source' => 'box/test', 'message' => 'The package "box/test" conflicts with the extension "mbstring".', 'helpMessage' => 'The package "box/test" conflicts with the extension "mbstring". You need to disable it in order to run this application.', ]; From b2c33cd432f5d814f53d96e370d655d870dcb82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Sun, 22 Oct 2023 15:55:22 +0200 Subject: [PATCH 2/2] fix --- tests/RequirementChecker/RequirementsDumperTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/RequirementChecker/RequirementsDumperTest.php b/tests/RequirementChecker/RequirementsDumperTest.php index 8e38a0794..7698f87c9 100644 --- a/tests/RequirementChecker/RequirementsDumperTest.php +++ b/tests/RequirementChecker/RequirementsDumperTest.php @@ -134,6 +134,7 @@ public static function jsonAndLockContentsProvider(): iterable array ( 'type' => 'php', 'condition' => '^7.4', + 'source' => 'acme/foo', 'message' => 'The package "acme/foo" requires a version matching "^7.4".', 'helpMessage' => 'The package "acme/foo" requires a version matching "^7.4".', ), @@ -141,6 +142,7 @@ public static function jsonAndLockContentsProvider(): iterable array ( 'type' => 'extension', 'condition' => 'zlib', + 'source' => NULL, 'message' => 'The application requires the extension "zlib".', 'helpMessage' => 'The application requires the extension "zlib". You either need to enable it or request the application to be shipped with a polyfill for this extension.', ), @@ -148,6 +150,7 @@ public static function jsonAndLockContentsProvider(): iterable array ( 'type' => 'extension', 'condition' => 'json', + 'source' => 'acme/foo', 'message' => 'The package "acme/foo" requires the extension "json".', 'helpMessage' => 'The package "acme/foo" requires the extension "json". You either need to enable it or request the application to be shipped with a polyfill for this extension.', ),