{"record":{"id":"1ab0b644ef9258ff","repo":"phar-io/manifest","slug":"unsupported-version-constraint-s","errorCode":null,"errorMessage":"Unsupported version constraint - %s","messagePattern":"Unsupported version constraint - (.+?)","errorType":"exception","errorClass":"ManifestDocumentMapperException","httpStatus":null,"severity":"error","filePath":"src/ManifestDocumentMapper.php","lineNumber":88,"sourceCode":"            $licenseElement->getType(),\n            new Url($licenseElement->getUrl())\n        );\n\n        return new CopyrightInformation(\n            $authors,\n            $license\n        );\n    }\n\n    private function mapRequirements(RequiresElement $requires): RequirementCollection {\n        $collection = new RequirementCollection();\n        $phpElement = $requires->getPHPElement();\n        $parser     = new VersionConstraintParser;\n\n        try {\n            $versionConstraint = $parser->parse($phpElement->getVersion());\n        } catch (VersionException $e) {\n            throw new ManifestDocumentMapperException(\n                sprintf('Unsupported version constraint - %s', $e->getMessage()),\n                (int)$e->getCode(),\n                $e\n            );\n        }\n\n        $collection->add(\n            new PhpVersionRequirement(\n                $versionConstraint\n            )\n        );\n\n        if (!$phpElement->hasExtElements()) {\n            return $collection;\n        }\n\n        foreach ($phpElement->getExtElements() as $extElement) {\n            $collection->add(","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/phar-io/manifest/blob/c581d4941e196459bf76c945a8ca922963a66708/src/ManifestDocumentMapper.php#L70-L106","documentation":"When the <php version=\"...\"> value in the requirements section cannot be parsed as a version constraint by PharIo\\Version\\VersionConstraintParser, the VersionException is re-thrown as ManifestDocumentMapperException with 'Unsupported version constraint - ...'. The library requires constraint syntax it understands (e.g. ^7.4, ~1.2, >=5.6).","triggerScenarios":"A manifest with <php version=\"7.4\"> (no operator means invalid in this parser context), arbitrary text like 'any', an empty version attribute, or operator syntax the installed phar-io/version release does not support.","commonSituations":"Authors writing Composer-style or plain-numeric versions that the manifest parser rejects; manifests generated for older phar-io/version without newer constraint operators.","solutions":["Use a supported constraint expression, e.g. version=\"^7.4\" or version=\">=7.4 <8.0\"","Check the exact sub-message for what the parser rejected and the constraint syntax docs for phar-io/version","Upgrade phar-io/version to the latest release to get full constraint support"],"exampleFix":"// before\n<php version=\"7.4\" />\n// after\n<php version=\"^7.4\" />","handlingStrategy":"validation","validationCode":"$version = $phpElement->getVersion();\nif ($version === '' || !preg_match('/[<>=~^]/', $version)) {\n    throw new InvalidArgumentException(\"php version must be a constraint, e.g. ^8.0, got: $version\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    $manifest = ManifestLoader::fromFile($path);\n} catch (ManifestLoaderException $e) {\n    if (str_contains($e->getMessage(), 'Unsupported version constraint')) {\n        // inspect previous VersionException message\n    }\n}","preventionTips":["Always include an operator in version attributes (^, ~, >=)","Reuse the same constraint syntax as composer where possible","Pin phar-io/version to a recent release"],"tags":["php","version-constraint","manifest","parsing"],"backgroundTag":"invalid-argument-value","analyzedSha":"c581d4941e196459bf76c945a8ca922963a66708","analyzedAt":"2026-09-14T11:08:47.165Z","contentChangedAt":"2026-09-14T11:08:47.165Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}