[
  {
    "path": ".gitattributes",
    "content": "/tests           export-ignore\n/.gitattributes  export-ignore\n/.gitignore      export-ignore\n/.php_cs.dist    export-ignore\n/.travis.yml     export-ignore\n/build.xml       export-ignore\n/phive.xml       export-ignore\n/phpunit.xml     export-ignore\n/psalm.xml       export-ignore"
  },
  {
    "path": ".gitignore",
    "content": "/.github/\n/.idea\n/.php_cs.cache\n/composer.lock\n/tools\n/vendor\nbuild/coverage\n.phpunit.result.cache\n"
  },
  {
    "path": ".php_cs.dist",
    "content": "<?php\n\nreturn PhpCsFixer\\Config::create()\n    ->setRiskyAllowed(true)\n    ->setRules(\n        [\n            'align_multiline_comment'                       => true,\n            'array_indentation'                             => true,\n            'array_syntax'                                  => ['syntax' => 'short'],\n            'binary_operator_spaces'                        => [\n                'operators' => [\n                    '='  => 'align',\n                    '=>' => 'align',\n                ],\n            ],\n            'blank_line_after_namespace'                    => true,\n            'blank_line_after_opening_tag'                  => false,\n            'blank_line_before_statement'                   => [\n                'statements' => [\n                    'break',\n                    'continue',\n                    'declare',\n                    'do',\n                    'for',\n                    'foreach',\n                    'if',\n                    'include',\n                    'include_once',\n                    'require',\n                    'require_once',\n                    'return',\n                    'switch',\n                    'throw',\n                    'try',\n                    'while',\n                    'yield',\n                ],\n            ],\n            'braces'                                        => [\n                'allow_single_line_closure'                   => false,\n                'position_after_anonymous_constructs'         => 'same',\n                'position_after_control_structures'           => 'same',\n                'position_after_functions_and_oop_constructs' => 'same'\n            ],\n            'cast_spaces'                                   => ['space' => 'none'],\n\n            // This fixer removes the blank line at class start, no way to disable that, so we disable the fixer :(\n            //'class_attributes_separation'                   => ['elements' => ['const', 'method', 'property']],\n\n            'combine_consecutive_issets'                    => true,\n            'combine_consecutive_unsets'                    => true,\n            'compact_nullable_typehint'                     => true,\n            'concat_space'                                  => ['spacing' => 'one'],\n            'date_time_immutable'                           => true,\n            'declare_equal_normalize'                       => ['space' => 'single'],\n            'declare_strict_types'                          => true,\n            'dir_constant'                                  => true,\n            'elseif'                                        => true,\n            'encoding'                                      => true,\n            'full_opening_tag'                              => true,\n            'fully_qualified_strict_types'                  => true,\n            'function_declaration'                          => [\n                'closure_function_spacing' => 'one'\n            ],\n            'header_comment'                                => false,\n            'indentation_type'                              => true,\n            'is_null'                                       => true,\n            'line_ending'                                   => true,\n            'list_syntax'                                   => ['syntax' => 'short'],\n            'logical_operators'                             => true,\n            'lowercase_cast'                                => true,\n            'lowercase_constants'                           => true,\n            'lowercase_keywords'                            => true,\n            'lowercase_static_reference'                    => true,\n            'magic_constant_casing'                         => true,\n            'method_argument_space'                         => ['ensure_fully_multiline' => true],\n            'modernize_types_casting'                       => true,\n            'multiline_comment_opening_closing'             => true,\n            'multiline_whitespace_before_semicolons'        => true,\n            'native_constant_invocation'                    => true,\n            'native_function_casing'                        => true,\n            'native_function_invocation'                    => true,\n            'new_with_braces'                               => false,\n            'no_alias_functions'                            => true,\n            'no_alternative_syntax'                         => true,\n            'no_blank_lines_after_class_opening'            => false,\n            'no_blank_lines_after_phpdoc'                   => true,\n            'no_blank_lines_before_namespace'               => true,\n            'no_closing_tag'                                => true,\n            'no_empty_comment'                              => true,\n            'no_empty_phpdoc'                               => true,\n            'no_empty_statement'                            => true,\n            'no_extra_blank_lines'                          => true,\n            'no_homoglyph_names'                            => true,\n            'no_leading_import_slash'                       => true,\n            'no_leading_namespace_whitespace'               => true,\n            'no_mixed_echo_print'                           => ['use' => 'print'],\n            'no_multiline_whitespace_around_double_arrow'   => true,\n            'no_null_property_initialization'               => true,\n            'no_php4_constructor'                           => true,\n            'no_short_bool_cast'                            => true,\n            'no_short_echo_tag'                             => true,\n            'no_singleline_whitespace_before_semicolons'    => true,\n            'no_spaces_after_function_name'                 => true,\n            'no_spaces_inside_parenthesis'                  => true,\n            'no_superfluous_elseif'                         => true,\n            'no_superfluous_phpdoc_tags'                    => true,\n            'no_trailing_comma_in_list_call'                => true,\n            'no_trailing_comma_in_singleline_array'         => true,\n            'no_trailing_whitespace'                        => true,\n            'no_trailing_whitespace_in_comment'             => true,\n            'no_unneeded_control_parentheses'               => false,\n            'no_unneeded_curly_braces'                      => false,\n            'no_unneeded_final_method'                      => true,\n            'no_unreachable_default_argument_value'         => true,\n            'no_unset_on_property'                          => true,\n            'no_unused_imports'                             => true,\n            'no_useless_else'                               => true,\n            'no_useless_return'                             => true,\n            'no_whitespace_before_comma_in_array'           => true,\n            'no_whitespace_in_blank_line'                   => true,\n            'non_printable_character'                       => true,\n            'normalize_index_brace'                         => true,\n            'object_operator_without_whitespace'            => true,\n            'ordered_class_elements'                        => [\n                'order' => [\n                    'use_trait',\n                    'constant_public',\n                    'constant_protected',\n                    'constant_private',\n                    'property_public_static',\n                    'property_protected_static',\n                    'property_private_static',\n                    'property_public',\n                    'property_protected',\n                    'property_private',\n                    'method_public_static',\n                    'construct',\n                    'destruct',\n                    'magic',\n                    'phpunit',\n                    'method_public',\n                    'method_protected',\n                    'method_private',\n                    'method_protected_static',\n                    'method_private_static',\n                ],\n            ],\n            'ordered_imports'                               => true,\n            'phpdoc_add_missing_param_annotation'           => true,\n            'phpdoc_align'                                  => true,\n            'phpdoc_annotation_without_dot'                 => true,\n            'phpdoc_indent'                                 => true,\n            'phpdoc_no_access'                              => true,\n            'phpdoc_no_empty_return'                        => true,\n            'phpdoc_no_package'                             => true,\n            'phpdoc_order'                                  => true,\n            'phpdoc_return_self_reference'                  => true,\n            'phpdoc_scalar'                                 => true,\n            'phpdoc_separation'                             => true,\n            'phpdoc_single_line_var_spacing'                => true,\n            'phpdoc_to_comment'                             => true,\n            'phpdoc_trim'                                   => true,\n            'phpdoc_trim_consecutive_blank_line_separation' => true,\n            'phpdoc_types'                                  => ['groups' => ['simple', 'meta']],\n            'phpdoc_types_order'                            => true,\n            'phpdoc_to_return_type'                         => true,\n            'phpdoc_var_without_name'                       => true,\n            'pow_to_exponentiation'                         => true,\n            'protected_to_private'                          => true,\n            'return_assignment'                             => true,\n            'return_type_declaration'                       => ['space_before' => 'none'],\n            'self_accessor'                                 => false,\n            'semicolon_after_instruction'                   => true,\n            'set_type_to_cast'                              => true,\n            'short_scalar_cast'                             => true,\n            'simplified_null_return'                        => true,\n            'single_blank_line_at_eof'                      => true,\n            'single_import_per_statement'                   => true,\n            'single_line_after_imports'                     => true,\n            'single_quote'                                  => true,\n            'standardize_not_equals'                        => true,\n            'ternary_to_null_coalescing'                    => true,\n            'trailing_comma_in_multiline_array'             => false,\n            'trim_array_spaces'                             => true,\n            'unary_operator_spaces'                         => true,\n            'visibility_required'                           => [\n                'elements' => [\n                    'const',\n                    'method',\n                    'property',\n                ],\n            ],\n            'void_return'                                   => true,\n            'whitespace_after_comma_in_array'               => true,\n            'yoda_style'                                    => false\n        ]\n    )\n    ->setFinder(\n        PhpCsFixer\\Finder::create()\n            ->files()\n            ->in(__DIR__ . '/src')\n            ->in(__DIR__ . '/tests')\n            ->notName('*.phpt')\n    );\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to phar-io/version are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.\n\n## [3.3.0] - 2024-??-??\n\n### Fixed\n\n- [#35](https://github.com/phar-io/version/issues/35): major version only not supported, e.g. ^6\n\n\n## [3.2.1] - 2022-02-21\n\n### Fixed\n\n- Have ExactVersionConstraint honor build metadata (added in 3.2.0)\n\n\n## [3.2.0] - 2022-02-21\n\n### Added\n\n- Build metadata is now supported and considered for equality checks only\n\n\n## [3.1.1] - 2022-02-07\n\n### Fixed\n\n- [#28](https://github.com/phar-io/version/issues/28): `VersionConstraintParser` does not support logical OR represented by single pipe (|) (Thanks @llaville)\n\n\n## [3.1.0] - 2021-02-23\n\n### Changed\n\n- Internal Refactoring\n- More scalar types\n\n### Added\n\n- [#24](https://github.com/phar-io/version/issues/24): `Version::getOriginalString()` added (Thanks @addshore)\n- Version constraints using the caret operator (`^`) now honor pre-1.0 releases, e.g. `^0.3` translates to `0.3.*`)\n- Various integration tests for version constraint processing\n\n### Fixed\n\n- [#23](https://github.com/phar-io/version/pull/23): Tilde operator without patch level\n\n\n\n## [3.0.4] - 14.12.2020\n\n### Fixed \n\n- [#22](https://github.com/phar-io/version/pull/22): make dev suffix rank works for uppercase too\n\n## [3.0.3] - 30.11.2020\n\n### Added\n\n- Comparator method `Version::equals()` added\n\n\n## [3.0.2] - 27.06.2020\n\nThis release now supports PHP 7.2+ and PHP ^8.0. No other changes included.\n\n\n## [3.0.1] - 09.05.2020\n\n__Potential BC Break Notice:__\n`Version::getVersionString()` no longer returns `v` prefixes in case the \"input\"\nstring contained one. These are not part of the semver specs\n(see https://semver.org/#is-v123-a-semantic-version) and get stripped out.\nAs of Version 3.1.0 `Version::getOriginalString()` can be used to still\nretrieve it as given.\n\n### Changed\n\n- Internal Refactoring\n- More scalar types\n\n### Fixed\n\n- Fixed Constraint processing Regression for ^1.2  and ~1.2\n\n\n## [3.0.0] - 05.05.2020\n\n### Changed\n\n- Require PHP 7.2+\n- All code now uses strict mode\n- Scalar types have been added as needed\n\n### Added\n\n- The technically invalid format using 'v' prefix (\"v1.2.3\") is now properly supported \n\n\n## [2.0.1] - 08.07.2018\n\n### Fixed\n\n- Versions without a pre-release suffix are now always considered greater \nthan versions with a pre-release suffix. Example: `3.0.0 > 3.0.0-alpha.1`  \n\n\n## [2.0.0] - 23.06.2018\n\nChanges to public API:\n\n- `PreReleaseSuffix::construct()`: optional parameter `$number` removed\n- `PreReleaseSuffix::isGreaterThan()`: introduced\n- `Version::hasPreReleaseSuffix()`: introduced\n\n### Added\n\n- [#11](https://github.com/phar-io/version/issues/11): Added support for pre-release version suffixes. Supported values are:\n  - `dev`\n  - `beta` (also abbreviated form `b`)\n  - `rc`\n  - `alpha` (also abbreviated form `a`)\n  - `patch` (also abbreviated form `p`)\n\n  All values can be followed by a number, e.g. `beta3`. \n\n  When comparing versions, the pre-release suffix is taken into account. Example:\n`1.5.0 > 1.5.0-beta1 > 1.5.0-alpha3 > 1.5.0-alpha2 > 1.5.0-dev11`\n\n### Changed\n\n- reorganized the source directories\n\n### Fixed\n\n- [#10](https://github.com/phar-io/version/issues/10): Version numbers containing \na numeric suffix as seen in Debian packages are now supported.  \n\n\n[3.3.0]: https://github.com/phar-io/version/compare/3.2.1...3.3.0\n[3.2.1]: https://github.com/phar-io/version/compare/3.2.1...3.2.1\n[3.2.0]: https://github.com/phar-io/version/compare/3.1.1...3.2.0\n[3.1.1]: https://github.com/phar-io/version/compare/3.1.0...3.1.1\n[3.1.0]: https://github.com/phar-io/version/compare/3.0.4...3.1.0\n[3.0.4]: https://github.com/phar-io/version/compare/3.0.3...3.0.4\n[3.0.3]: https://github.com/phar-io/version/compare/3.0.2...3.0.3\n[3.0.2]: https://github.com/phar-io/version/compare/3.0.1...3.0.2\n[3.0.1]: https://github.com/phar-io/version/compare/3.0.0...3.0.1\n[3.0.0]: https://github.com/phar-io/version/compare/2.0.1...3.0.0\n[2.0.1]: https://github.com/phar-io/version/compare/2.0.0...2.0.1\n[2.0.0]: https://github.com/phar-io/version/compare/1.0.1...2.0.0\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2016-2017 Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de> and contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice,\n  this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of contributors\n  may be used to endorse or promote products derived from this software\n  without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT  * NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS\nBE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\nOR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\n"
  },
  {
    "path": "README.md",
    "content": "# Version\n\nLibrary for handling version information and constraints\n\n[![CI](https://github.com/phar-io/version/actions/workflows/ci.yml/badge.svg)](https://github.com/phar-io/version/actions/workflows/ci.yml)\n\n## Installation\n\nYou can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):\n\n    composer require phar-io/version\n\nIf you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:\n\n    composer require --dev phar-io/version\n\n## Version constraints\n\nA Version constraint describes a range of versions or a discrete version number. The format of version numbers follows the schema of [semantic versioning](http://semver.org): `<major>.<minor>.<patch>`. A constraint might contain an operator that describes the range.\n\nBeside the typical mathematical operators like `<=`, `>=`, there are two special operators:\n\n*Caret operator*: `^1.0`\ncan be written as `>=1.0.0 <2.0.0` and read as »every Version within major version `1`«.\n\n*Tilde operator*: `~1.0.0`\ncan be written as `>=1.0.0 <1.1.0` and read as »every version within minor version `1.1`. The behavior of tilde operator depends on whether a patch level version is provided or not. If no patch level is provided, tilde operator behaves like the caret operator: `~1.0` is identical to `^1.0`.\n\n## Usage examples\n\nParsing version constraints and check discrete versions for compliance:\n\n```php\n\nuse PharIo\\Version\\Version;\nuse PharIo\\Version\\VersionConstraintParser;\n\n$parser = new VersionConstraintParser();\n$caret_constraint = $parser->parse( '^7.0' );\n\n$caret_constraint->complies( new Version( '7.0.17' ) ); // true\n$caret_constraint->complies( new Version( '7.1.0' ) ); // true\n$caret_constraint->complies( new Version( '6.4.34' ) ); // false\n\n$tilde_constraint = $parser->parse( '~1.1.0' );\n\n$tilde_constraint->complies( new Version( '1.1.4' ) ); // true\n$tilde_constraint->complies( new Version( '1.2.0' ) ); // false\n```\n\nAs of version 2.0.0, pre-release labels are supported and taken into account when comparing versions:\n\n```php\n\n$leftVersion = new PharIo\\Version\\Version('3.0.0-alpha.1');\n$rightVersion = new PharIo\\Version\\Version('3.0.0-alpha.2');\n\n$leftVersion->isGreaterThan($rightVersion); // false\n$rightVersion->isGreaterThan($leftVersion); // true\n\n``` \n"
  },
  {
    "path": "build.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project name=\"version\" default=\"setup\">\n    <property name=\"phive.bin\" value=\"phive\"/>\n\n    <target name=\"setup\" depends=\"clean,install-tools,install-dependencies\"/>\n\n    <target name=\"clean\" unless=\"clean.done\" description=\"Cleanup build artifacts\">\n        <delete dir=\"${basedir}/tools\"/>\n        <delete dir=\"${basedir}/vendor\"/>\n        <delete file=\"${basedir}/src/autoload.php\"/>\n\n        <property name=\"clean.done\" value=\"true\"/>\n    </target>\n\n    <target name=\"prepare\" unless=\"prepare.done\" depends=\"clean\" description=\"Prepare for build\">\n        <property name=\"prepare.done\" value=\"true\"/>\n    </target>\n\n    <target name=\"install-tools\" unless=\"tools-installed\" depends=\"-tools-installed\" description=\"Install tools with Phive\">\n        <exec executable=\"${phive.bin}\" taskname=\"phive\" failonerror=\"true\">\n            <arg value=\"install\"/>\n            <arg value=\"--copy\" />\n            <arg value=\"--trust-gpg-keys\" />\n            <!--        php-cs-fixer      ,psalm             ,phpunit           -->\n            <arg value=\"0xE82B2FB314E9906E,0x12CE0F1D262429A5,0x4AA394086372C20A\" />\n        </exec>\n    </target>\n\n    <target name=\"install-dependencies\" description=\"Install dependencies with Composer\">\n        <exec executable=\"composer\" taskname=\"composer\">\n            <env key=\"COMPOSER_DISABLE_XDEBUG_WARN\" value=\"1\"/>\n            <arg value=\"install\"/>\n            <arg value=\"--no-ansi\"/>\n            <arg value=\"--no-interaction\"/>\n            <arg value=\"--no-progress\"/>\n            <arg value=\"--optimize-autoloader\"/>\n        </exec>\n    </target>\n\n    <target name=\"php-cs-fixer\" depends=\"install-tools\" description=\"Dry run php-cs-fixer\">\n        <exec executable=\"${basedir}/tools/php-cs-fixer\" failonerror=\"true\">\n            <arg value=\"fix\" />\n            <arg value=\"--dry-run\" />\n        </exec>\n    </target>\n\n    <target name=\"psalm\" depends=\"install-tools,install-dependencies\" description=\"Run psalm\">\n        <exec executable=\"${basedir}/tools/psalm\" taskname=\"psalm-cache-clear\">\n            <arg value=\"--config=psalm.xml\" />\n            <arg value=\"--clear-cache\" />\n        </exec>\n\n        <exec executable=\"${basedir}/tools/psalm\" taskname=\"psalm\" failonerror=\"true\">\n            <arg value=\"--config=psalm.xml\" />\n            <arg value=\"--show-info=true\" />\n            <arg value=\"--stats\" />\n        </exec>\n    </target>\n\n    <target name=\"psalm-baseline\" depends=\"install-tools,install-dependencies\" description=\"Run psalm\">\n        <exec executable=\"${basedir}/tools/psalm\" taskname=\"psalm-cache-clear\">\n            <arg value=\"--config=psalm.xml\" />\n            <arg value=\"--clear-cache\" />\n        </exec>\n\n        <exec executable=\"${basedir}/tools/psalm\" taskname=\"psalm-baseline\">\n            <arg value=\"--config=psalm.xml\" />\n            <arg value=\"--set-baseline=build/psalm-baseline.xml\" />\n            <arg value=\"--show-info=false\" />\n        </exec>\n    </target>\n\n    <target name=\"test\" depends=\"install-tools,install-dependencies\" description=\"Run tests\">\n        <exec executable=\"${basedir}/tools/phpunit\" taskname=\"phpunit\"/>\n    </target>\n\n    <target name=\"test-with-code-coverage\" depends=\"install-tools,install-dependencies\" description=\"Run tests with code coverage\">\n        <exec executable=\"${basedir}/tools/phpunit\" taskname=\"phpunit\">\n            <arg value=\"--coverage-clover build/logs/clover.xml\" />\n        </exec>\n    </target>\n\n    <target name=\"-tools-installed\">\n        <available file=\"${basedir}/tools/phpunit\" property=\"tools-installed\" type=\"file\"/>\n    </target>\n</project>\n\n"
  },
  {
    "path": "composer.json",
    "content": "{\n  \"name\": \"phar-io/version\",\n  \"description\": \"Library for handling version information and constraints\",\n  \"license\": \"BSD-3-Clause\",\n  \"authors\": [\n    {\n      \"name\": \"Arne Blankerts\",\n      \"email\": \"arne@blankerts.de\",\n      \"role\": \"Developer\"\n    },\n    {\n      \"name\": \"Sebastian Heuer\",\n      \"email\": \"sebastian@phpeople.de\",\n      \"role\": \"Developer\"\n    },\n    {\n      \"name\": \"Sebastian Bergmann\",\n      \"email\": \"sebastian@phpunit.de\",\n      \"role\": \"Developer\"\n    }\n  ],\n  \"support\": {\n    \"issues\": \"https://github.com/phar-io/version/issues\"\n  },\n  \"require\": {\n    \"php\": \"^7.2 || ^8.0\"\n  },\n  \"autoload\": {\n    \"classmap\": [\n      \"src/\"\n    ]\n  }\n}\n\n"
  },
  {
    "path": "phive.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phive xmlns=\"https://phar.io/phive\">\n  <phar name=\"php-cs-fixer\" version=\"^2.15.1\" installed=\"2.19.3\" location=\"./tools/php-cs-fixer\" copy=\"true\"/>\n  <phar name=\"psalm\" version=\"^4.0\" installed=\"4.21.0\" location=\"./tools/psalm\" copy=\"true\"/>\n  <phar name=\"phpunit\" version=\"^8.5.3\" installed=\"8.5.23\" location=\"./tools/phpunit\" copy=\"true\"/>\n</phive>\n"
  },
  {
    "path": "phpunit.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:noNamespaceSchemaLocation=\"https://schema.phpunit.de/5.7/phpunit.xsd\"\n         bootstrap=\"vendor/autoload.php\"\n         backupGlobals=\"false\"\n         beStrictAboutOutputDuringTests=\"true\"\n         beStrictAboutTestsThatDoNotTestAnything=\"true\"\n         beStrictAboutTodoAnnotatedTests=\"true\"\n         verbose=\"true\">\n    <testsuite name='tests'>\n        <directory suffix=\"Test.php\">tests</directory>\n    </testsuite>\n\n    <filter>\n        <whitelist processUncoveredFilesFromWhitelist=\"true\">\n            <directory suffix=\".php\">src</directory>\n        </whitelist>\n    </filter>\n</phpunit>\n"
  },
  {
    "path": "psalm.xml",
    "content": "<?xml version=\"1.0\"?>\n<psalm xmlns=\"https://getpsalm.org/schema/config\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd\">\n\n    <projectFiles>\n        <directory name=\"src\" />\n        <ignoreFiles>\n            <directory name=\"vendor/\" />\n        </ignoreFiles>\n    </projectFiles>\n\n</psalm>\n"
  },
  {
    "path": "src/BuildMetaData.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass BuildMetaData {\n\n    /** @var string */\n    private $value;\n\n    public function __construct(string $value) {\n        $this->value = $value;\n    }\n\n    public function asString(): string {\n        return $this->value;\n    }\n\n    public function equals(BuildMetaData $other): bool {\n        return $this->asString() === $other->asString();\n    }\n}\n"
  },
  {
    "path": "src/PreReleaseSuffix.php",
    "content": "<?php declare(strict_types = 1);\nnamespace PharIo\\Version;\n\nclass PreReleaseSuffix {\n    private const valueScoreMap = [\n        'dev'   => 0,\n        'a'     => 1,\n        'alpha' => 1,\n        'b'     => 2,\n        'beta'  => 2,\n        'rc'    => 3,\n        'p'     => 4,\n        'pl'    => 4,\n        'patch' => 4,\n    ];\n\n    /** @var string */\n    private $value;\n\n    /** @var int */\n    private $valueScore;\n\n    /** @var int */\n    private $number = 0;\n\n    /** @var string */\n    private $full;\n\n    /**\n     * @throws InvalidPreReleaseSuffixException\n     */\n    public function __construct(string $value) {\n        $this->parseValue($value);\n    }\n\n    public function asString(): string {\n        return $this->full;\n    }\n\n    public function getValue(): string {\n        return $this->value;\n    }\n\n    public function getNumber(): ?int {\n        return $this->number;\n    }\n\n    public function isGreaterThan(PreReleaseSuffix $suffix): bool {\n        if ($this->valueScore > $suffix->valueScore) {\n            return true;\n        }\n\n        if ($this->valueScore < $suffix->valueScore) {\n            return false;\n        }\n\n        return $this->getNumber() > $suffix->getNumber();\n    }\n\n    private function mapValueToScore(string $value): int {\n        $value = \\strtolower($value);\n\n        return self::valueScoreMap[$value];\n    }\n\n    private function parseValue(string $value): void {\n        $regex = '/-?((dev|beta|b|rc|alpha|a|patch|p|pl)\\.?(\\d*)).*$/i';\n\n        if (\\preg_match($regex, $value, $matches) !== 1) {\n            throw new InvalidPreReleaseSuffixException(\\sprintf('Invalid label %s', $value));\n        }\n\n        $this->full  = $matches[1];\n        $this->value = $matches[2];\n\n        if ($matches[3] !== '') {\n            $this->number = (int)$matches[3];\n        }\n\n        $this->valueScore = $this->mapValueToScore($matches[2]);\n    }\n}\n"
  },
  {
    "path": "src/Version.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass Version {\n    /** @var string */\n    private $originalVersionString;\n\n    /** @var VersionNumber */\n    private $major;\n\n    /** @var VersionNumber */\n    private $minor;\n\n    /** @var VersionNumber */\n    private $patch;\n\n    /** @var null|PreReleaseSuffix */\n    private $preReleaseSuffix;\n\n    /** @var null|BuildMetaData */\n    private $buildMetadata;\n\n    public function __construct(string $versionString) {\n        $this->ensureVersionStringIsValid($versionString);\n        $this->originalVersionString = $versionString;\n    }\n\n    /**\n     * @throws NoPreReleaseSuffixException\n     */\n    public function getPreReleaseSuffix(): PreReleaseSuffix {\n        if ($this->preReleaseSuffix === null) {\n            throw new NoPreReleaseSuffixException('No pre-release suffix set');\n        }\n\n        return $this->preReleaseSuffix;\n    }\n\n    public function getOriginalString(): string {\n        return $this->originalVersionString;\n    }\n\n    public function getVersionString(): string {\n        $str = \\sprintf(\n            '%d.%d.%d',\n            $this->getMajor()->getValue() ?? 0,\n            $this->getMinor()->getValue() ?? 0,\n            $this->getPatch()->getValue() ?? 0\n        );\n\n        if (!$this->hasPreReleaseSuffix()) {\n            return $str;\n        }\n\n        return $str . '-' . $this->getPreReleaseSuffix()->asString();\n    }\n\n    public function hasPreReleaseSuffix(): bool {\n        return $this->preReleaseSuffix !== null;\n    }\n\n    public function equals(Version $other): bool {\n        if ($this->getVersionString() !== $other->getVersionString()) {\n            return false;\n        }\n\n        if ($this->hasBuildMetaData() !== $other->hasBuildMetaData()) {\n            return false;\n        }\n\n        if ($this->hasBuildMetaData() && $other->hasBuildMetaData() &&\n            !$this->getBuildMetaData()->equals($other->getBuildMetaData())) {\n            return false;\n        }\n\n        return true;\n    }\n\n    public function isGreaterThan(Version $version): bool {\n        if ($version->getMajor()->getValue() > $this->getMajor()->getValue()) {\n            return false;\n        }\n\n        if ($version->getMajor()->getValue() < $this->getMajor()->getValue()) {\n            return true;\n        }\n\n        if ($version->getMinor()->getValue() > $this->getMinor()->getValue()) {\n            return false;\n        }\n\n        if ($version->getMinor()->getValue() < $this->getMinor()->getValue()) {\n            return true;\n        }\n\n        if ($version->getPatch()->getValue() > $this->getPatch()->getValue()) {\n            return false;\n        }\n\n        if ($version->getPatch()->getValue() < $this->getPatch()->getValue()) {\n            return true;\n        }\n\n        if (!$version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) {\n            return false;\n        }\n\n        if ($version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) {\n            return true;\n        }\n\n        if (!$version->hasPreReleaseSuffix() && $this->hasPreReleaseSuffix()) {\n            return false;\n        }\n\n        return $this->getPreReleaseSuffix()->isGreaterThan($version->getPreReleaseSuffix());\n    }\n\n    public function getMajor(): VersionNumber {\n        return $this->major;\n    }\n\n    public function getMinor(): VersionNumber {\n        return $this->minor;\n    }\n\n    public function getPatch(): VersionNumber {\n        return $this->patch;\n    }\n\n    /**\n     * @psalm-assert-if-true BuildMetaData $this->buildMetadata\n     * @psalm-assert-if-true BuildMetaData $this->getBuildMetaData()\n     */\n    public function hasBuildMetaData(): bool {\n        return $this->buildMetadata !== null;\n    }\n\n    /**\n     * @throws NoBuildMetaDataException\n     */\n    public function getBuildMetaData(): BuildMetaData {\n        if (!$this->hasBuildMetaData()) {\n            throw new NoBuildMetaDataException('No build metadata set');\n        }\n\n        return $this->buildMetadata;\n    }\n\n    /**\n     * @param string[] $matches\n     *\n     * @throws InvalidPreReleaseSuffixException\n     */\n    private function parseVersion(array $matches): void {\n        $this->major = new VersionNumber((int)$matches['Major']);\n        $this->minor = isset($matches['Minor']) ? new VersionNumber((int)$matches['Minor']) : new VersionNumber(0);\n        $this->patch = isset($matches['Patch']) ? new VersionNumber((int)$matches['Patch']) : new VersionNumber(0);\n\n        if (isset($matches['PreReleaseSuffix']) && $matches['PreReleaseSuffix'] !== '') {\n            $this->preReleaseSuffix = new PreReleaseSuffix($matches['PreReleaseSuffix']);\n        }\n\n        if (isset($matches['BuildMetadata'])) {\n            $this->buildMetadata = new BuildMetaData($matches['BuildMetadata']);\n        }\n    }\n\n    /**\n     * @param string $version\n     *\n     * @throws InvalidVersionException\n     */\n    private function ensureVersionStringIsValid($version): void {\n        $regex = '/^v?\n            (?P<Major>0|[1-9]\\d*)\n            (\\\\.\n            (?P<Minor>0|[1-9]\\d*)\n            )?\n            (\\\\.\n                (?P<Patch>0|[1-9]\\d*)\n            )?\n            (?:\n                -\n                (?<PreReleaseSuffix>(?:(dev|beta|b|rc|alpha|a|patch|p|pl)\\.?\\d*))\n            )?\n            (?:\n                \\\\+\n                (?P<BuildMetadata>[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-@]+)*)\n            )?\n        $/xi';\n\n        if (\\preg_match($regex, $version, $matches) !== 1) {\n            throw new InvalidVersionException(\n                \\sprintf(\"Version string '%s' does not follow SemVer semantics\", $version)\n            );\n        }\n\n        $this->parseVersion($matches);\n    }\n}\n"
  },
  {
    "path": "src/VersionConstraintParser.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass VersionConstraintParser {\n    /**\n     * @throws UnsupportedVersionConstraintException\n     */\n    public function parse(string $value): VersionConstraint {\n        if (\\strpos($value, '|') !== false) {\n            return $this->handleOrGroup($value);\n        }\n\n        if (!\\preg_match('/^[\\^~*]?v?[\\d.*]+(?:-.*)?$/i', $value)) {\n            throw new UnsupportedVersionConstraintException(\n                \\sprintf('Version constraint %s is not supported.', $value)\n            );\n        }\n\n        switch ($value[0]) {\n            case '~':\n                return $this->handleTildeOperator($value);\n            case '^':\n                return $this->handleCaretOperator($value);\n        }\n\n        $constraint = new VersionConstraintValue($value);\n\n        if ($constraint->getMajor()->isAny()) {\n            return new AnyVersionConstraint();\n        }\n\n        if ($constraint->getMinor()->isAny()) {\n            return new SpecificMajorVersionConstraint(\n                $constraint->getVersionString(),\n                $constraint->getMajor()->getValue() ?? 0\n            );\n        }\n\n        if ($constraint->getPatch()->isAny()) {\n            return new SpecificMajorAndMinorVersionConstraint(\n                $constraint->getVersionString(),\n                $constraint->getMajor()->getValue() ?? 0,\n                $constraint->getMinor()->getValue() ?? 0\n            );\n        }\n\n        return new ExactVersionConstraint($constraint->getVersionString());\n    }\n\n    private function handleOrGroup(string $value): OrVersionConstraintGroup {\n        $constraints = [];\n\n        foreach (\\preg_split('{\\s*\\|\\|?\\s*}', \\trim($value)) as $groupSegment) {\n            $constraints[] = $this->parse(\\trim($groupSegment));\n        }\n\n        return new OrVersionConstraintGroup($value, $constraints);\n    }\n\n    private function handleTildeOperator(string $value): AndVersionConstraintGroup {\n        $constraintValue = new VersionConstraintValue(\\substr($value, 1));\n\n        if ($constraintValue->getPatch()->isAny()) {\n            return $this->handleCaretOperator($value);\n        }\n\n        $constraints = [\n            new GreaterThanOrEqualToVersionConstraint(\n                $value,\n                new Version(\\substr($value, 1))\n            ),\n            new SpecificMajorAndMinorVersionConstraint(\n                $value,\n                $constraintValue->getMajor()->getValue() ?? 0,\n                $constraintValue->getMinor()->getValue() ?? 0\n            )\n        ];\n\n        return new AndVersionConstraintGroup($value, $constraints);\n    }\n\n    private function handleCaretOperator(string $value): AndVersionConstraintGroup {\n        $constraintValue = new VersionConstraintValue(\\substr($value, 1));\n\n        $constraints = [\n            new GreaterThanOrEqualToVersionConstraint($value, new Version(\\substr($value, 1)))\n        ];\n\n        if ($constraintValue->getMajor()->getValue() === 0) {\n            $constraints[] = new SpecificMajorAndMinorVersionConstraint(\n                $value,\n                $constraintValue->getMajor()->getValue() ?? 0,\n                $constraintValue->getMinor()->getValue() ?? 0\n            );\n        } else {\n            $constraints[] = new SpecificMajorVersionConstraint(\n                $value,\n                $constraintValue->getMajor()->getValue() ?? 0\n            );\n        }\n\n        return new AndVersionConstraintGroup(\n            $value,\n            $constraints\n        );\n    }\n}\n"
  },
  {
    "path": "src/VersionConstraintValue.php",
    "content": "<?php declare(strict_types = 1);\nnamespace PharIo\\Version;\n\nclass VersionConstraintValue {\n    /** @var VersionNumber */\n    private $major;\n\n    /** @var VersionNumber */\n    private $minor;\n\n    /** @var VersionNumber */\n    private $patch;\n\n    /** @var string */\n    private $label = '';\n\n    /** @var string */\n    private $buildMetaData = '';\n\n    /** @var string */\n    private $versionString = '';\n\n    public function __construct(string $versionString) {\n        $this->versionString = $versionString;\n\n        $this->parseVersion($versionString);\n    }\n\n    public function getLabel(): string {\n        return $this->label;\n    }\n\n    public function getBuildMetaData(): string {\n        return $this->buildMetaData;\n    }\n\n    public function getVersionString(): string {\n        return $this->versionString;\n    }\n\n    public function getMajor(): VersionNumber {\n        return $this->major;\n    }\n\n    public function getMinor(): VersionNumber {\n        return $this->minor;\n    }\n\n    public function getPatch(): VersionNumber {\n        return $this->patch;\n    }\n\n    private function parseVersion(string $versionString): void {\n        $this->extractBuildMetaData($versionString);\n        $this->extractLabel($versionString);\n        $this->stripPotentialVPrefix($versionString);\n\n        $versionSegments = \\explode('.', $versionString);\n        $this->major     = new VersionNumber(\\is_numeric($versionSegments[0]) ? (int)$versionSegments[0] : null);\n\n        $minorValue = isset($versionSegments[1]) && \\is_numeric($versionSegments[1]) ? (int)$versionSegments[1] : null;\n        $patchValue = isset($versionSegments[2]) && \\is_numeric($versionSegments[2]) ? (int)$versionSegments[2] : null;\n\n        $this->minor = new VersionNumber($minorValue);\n        $this->patch = new VersionNumber($patchValue);\n    }\n\n    private function extractBuildMetaData(string &$versionString): void {\n        if (\\preg_match('/\\+(.*)/', $versionString, $matches) === 1) {\n            $this->buildMetaData = $matches[1];\n            $versionString       = \\str_replace($matches[0], '', $versionString);\n        }\n    }\n\n    private function extractLabel(string &$versionString): void {\n        if (\\preg_match('/-(.*)/', $versionString, $matches) === 1) {\n            $this->label   = $matches[1];\n            $versionString = \\str_replace($matches[0], '', $versionString);\n        }\n    }\n\n    private function stripPotentialVPrefix(string &$versionString): void {\n        if ($versionString[0] !== 'v') {\n            return;\n        }\n        $versionString = \\substr($versionString, 1);\n    }\n}\n"
  },
  {
    "path": "src/VersionNumber.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass VersionNumber {\n\n    /** @var ?int */\n    private $value;\n\n    public function __construct(?int $value) {\n        $this->value = $value;\n    }\n\n    public function isAny(): bool {\n        return $this->value === null;\n    }\n\n    public function getValue(): ?int {\n        return $this->value;\n    }\n}\n"
  },
  {
    "path": "src/constraints/AbstractVersionConstraint.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nabstract class AbstractVersionConstraint implements VersionConstraint {\n    /** @var string */\n    private $originalValue;\n\n    public function __construct(string $originalValue) {\n        $this->originalValue = $originalValue;\n    }\n\n    public function asString(): string {\n        return $this->originalValue;\n    }\n}\n"
  },
  {
    "path": "src/constraints/AndVersionConstraintGroup.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass AndVersionConstraintGroup extends AbstractVersionConstraint {\n    /** @var VersionConstraint[] */\n    private $constraints = [];\n\n    /**\n     * @param VersionConstraint[] $constraints\n     */\n    public function __construct(string $originalValue, array $constraints) {\n        parent::__construct($originalValue);\n\n        $this->constraints = $constraints;\n    }\n\n    public function complies(Version $version): bool {\n        foreach ($this->constraints as $constraint) {\n            if (!$constraint->complies($version)) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n}\n"
  },
  {
    "path": "src/constraints/AnyVersionConstraint.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass AnyVersionConstraint implements VersionConstraint {\n    public function complies(Version $version): bool {\n        return true;\n    }\n\n    public function asString(): string {\n        return '*';\n    }\n}\n"
  },
  {
    "path": "src/constraints/ExactVersionConstraint.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass ExactVersionConstraint extends AbstractVersionConstraint {\n    public function complies(Version $version): bool {\n        $other = $version->getVersionString();\n\n        if ($version->hasBuildMetaData()) {\n            $other .= '+' . $version->getBuildMetaData()->asString();\n        }\n\n        return $this->asString() === $other;\n    }\n}\n"
  },
  {
    "path": "src/constraints/GreaterThanOrEqualToVersionConstraint.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint {\n    /** @var Version */\n    private $minimalVersion;\n\n    public function __construct(string $originalValue, Version $minimalVersion) {\n        parent::__construct($originalValue);\n\n        $this->minimalVersion = $minimalVersion;\n    }\n\n    public function complies(Version $version): bool {\n        return $version->getVersionString() === $this->minimalVersion->getVersionString()\n            || $version->isGreaterThan($this->minimalVersion);\n    }\n}\n"
  },
  {
    "path": "src/constraints/OrVersionConstraintGroup.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass OrVersionConstraintGroup extends AbstractVersionConstraint {\n    /** @var VersionConstraint[] */\n    private $constraints = [];\n\n    /**\n     * @param string              $originalValue\n     * @param VersionConstraint[] $constraints\n     */\n    public function __construct($originalValue, array $constraints) {\n        parent::__construct($originalValue);\n\n        $this->constraints = $constraints;\n    }\n\n    public function complies(Version $version): bool {\n        foreach ($this->constraints as $constraint) {\n            if ($constraint->complies($version)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n}\n"
  },
  {
    "path": "src/constraints/SpecificMajorAndMinorVersionConstraint.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint {\n    /** @var int */\n    private $major;\n\n    /** @var int */\n    private $minor;\n\n    public function __construct(string $originalValue, int $major, int $minor) {\n        parent::__construct($originalValue);\n\n        $this->major = $major;\n        $this->minor = $minor;\n    }\n\n    public function complies(Version $version): bool {\n        if ($version->getMajor()->getValue() !== $this->major) {\n            return false;\n        }\n\n        return $version->getMinor()->getValue() === $this->minor;\n    }\n}\n"
  },
  {
    "path": "src/constraints/SpecificMajorVersionConstraint.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nclass SpecificMajorVersionConstraint extends AbstractVersionConstraint {\n    /** @var int */\n    private $major;\n\n    public function __construct(string $originalValue, int $major) {\n        parent::__construct($originalValue);\n\n        $this->major = $major;\n    }\n\n    public function complies(Version $version): bool {\n        return $version->getMajor()->getValue() === $this->major;\n    }\n}\n"
  },
  {
    "path": "src/constraints/VersionConstraint.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\ninterface VersionConstraint {\n    public function complies(Version $version): bool;\n\n    public function asString(): string;\n}\n"
  },
  {
    "path": "src/exceptions/Exception.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse Throwable;\n\ninterface Exception extends Throwable {\n}\n"
  },
  {
    "path": "src/exceptions/InvalidPreReleaseSuffixException.php",
    "content": "<?php declare(strict_types = 1);\nnamespace PharIo\\Version;\n\nclass InvalidPreReleaseSuffixException extends \\Exception implements Exception {\n}\n"
  },
  {
    "path": "src/exceptions/InvalidVersionException.php",
    "content": "<?php declare(strict_types = 1);\nnamespace PharIo\\Version;\n\nclass InvalidVersionException extends \\InvalidArgumentException implements Exception {\n}\n"
  },
  {
    "path": "src/exceptions/NoBuildMetaDataException.php",
    "content": "<?php declare(strict_types = 1);\nnamespace PharIo\\Version;\n\nclass NoBuildMetaDataException extends \\Exception implements Exception {\n}\n"
  },
  {
    "path": "src/exceptions/NoPreReleaseSuffixException.php",
    "content": "<?php declare(strict_types = 1);\nnamespace PharIo\\Version;\n\nclass NoPreReleaseSuffixException extends \\Exception implements Exception {\n}\n"
  },
  {
    "path": "src/exceptions/UnsupportedVersionConstraintException.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nfinal class UnsupportedVersionConstraintException extends \\RuntimeException implements Exception {\n}\n"
  },
  {
    "path": "tests/Integration/CompliesTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\nclass CompliesTest extends TestCase {\n\n    /**\n     * @dataProvider complyingProvider\n     */\n    public function testCompliesWhenExcepted(string $constraint, string $version): void {\n        $this->assertTrue(\n            (new VersionConstraintParser())->parse($constraint)->complies(new Version($version))\n        );\n    }\n\n    /**\n     * @dataProvider notComplyingProvider\n     */\n    public function testNotCompliesWhenExcepted(string $constraint, string $version): void {\n        $this->assertFalse(\n            (new VersionConstraintParser())->parse($constraint)->complies(new Version($version))\n        );\n    }\n\n    public function complyingProvider(): array {\n        return [\n            '1.0.0'  => ['1.0.0', '1.0.0'],\n\n            '~7.0.0' => ['~7.0.0', '7.0.1'],\n            '~7.0'   => ['~7.0', '7.0.1'],\n            '~8.0'   => ['~8.0', '8.2.3'],\n\n            '^7.0.0' => ['^7.0.0', '7.0.1'],\n            '^7.0'   => ['^7.0', '7.0.1'],\n            '^8.0'   => ['^8.0', '8.2.3'],\n\n            '^7.2 || ^8.0' => ['^7.2 || ^8.0', '7.4.12'],\n            '^7.3 || ^8.0' => ['^7.3 || ^8.0', '8.0.3'],\n            '^7.4 || ^8.0' => ['^7.3 || ^8.0', '8.1.3'],\n\n            '5.1.*' => ['5.1.*', '5.1.3'],\n            '^0.3'  => ['^0.3', '0.3.1']\n        ];\n    }\n\n    public function notComplyingProvider(): array {\n        return [\n            '1.0.0'  => ['1.0.0', '1.0.1'],\n            '~4.6'   => ['~4.6', '4.5.3'],\n            '~8.0.0' => ['~8.0.0', '8.1.0'],\n            '5.1.*'  => ['5.1.*', '5.2.1'],\n            '5.2.*'  => ['5.2.*', '5.1.9'],\n            '^0.3'   => ['^0.3', '0.4.1']\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Integration/VersionConstraintParserTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\VersionConstraintParser\n */\nclass VersionConstraintParserTest extends TestCase {\n    /**\n     * @dataProvider versionStringProvider\n     *\n     * @param string $versionString\n     */\n    public function testReturnsExpectedConstraint($versionString, VersionConstraint $expectedConstraint): void {\n        $parser = new VersionConstraintParser;\n\n        $this->assertEquals($expectedConstraint, $parser->parse($versionString));\n    }\n\n    /**\n     * @dataProvider unsupportedVersionStringProvider\n     *\n     * @param string $versionString\n     */\n    public function testThrowsExceptionIfVersionStringIsNotSupported($versionString): void {\n        $parser = new VersionConstraintParser;\n\n        $this->expectException(UnsupportedVersionConstraintException::class);\n\n        $parser->parse($versionString);\n    }\n\n    public function versionStringProvider(): array {\n        return [\n            ['1.0.2', new ExactVersionConstraint('1.0.2')],\n            [\n                '~4.6',\n                new AndVersionConstraintGroup(\n                    '~4.6',\n                    [\n                        new GreaterThanOrEqualToVersionConstraint('~4.6', new Version('4.6')),\n                        new SpecificMajorVersionConstraint('~4.6', 4)\n                    ]\n                )\n            ],\n            [\n                '~4.6.2',\n                new AndVersionConstraintGroup(\n                    '~4.6.2',\n                    [\n                        new GreaterThanOrEqualToVersionConstraint('~4.6.2', new Version('4.6.2')),\n                        new SpecificMajorAndMinorVersionConstraint('~4.6.2', 4, 6)\n                    ]\n                )\n            ],\n            [\n                '^2.6.1',\n                new AndVersionConstraintGroup(\n                    '^2.6.1',\n                    [\n                        new GreaterThanOrEqualToVersionConstraint('^2.6.1', new Version('2.6.1')),\n                        new SpecificMajorVersionConstraint('^2.6.1', 2)\n                    ]\n                )\n            ],\n            ['5.1.*', new SpecificMajorAndMinorVersionConstraint('5.1.*', 5, 1)],\n            ['5.*', new SpecificMajorVersionConstraint('5.*', 5)],\n            ['*', new AnyVersionConstraint()],\n            [\n                '1.0.2 || 1.0.5',\n                new OrVersionConstraintGroup(\n                    '1.0.2 || 1.0.5',\n                    [\n                        new ExactVersionConstraint('1.0.2'),\n                        new ExactVersionConstraint('1.0.5')\n                    ]\n                )\n            ],\n            [\n                '^5.6 || ^7.0',\n                new OrVersionConstraintGroup(\n                    '^5.6 || ^7.0',\n                    [\n                        new AndVersionConstraintGroup(\n                            '^5.6',\n                            [\n                                new GreaterThanOrEqualToVersionConstraint('^5.6', new Version('5.6')),\n                                new SpecificMajorVersionConstraint('^5.6', 5)\n                            ]\n                        ),\n                        new AndVersionConstraintGroup(\n                            '^7.0',\n                            [\n                                new GreaterThanOrEqualToVersionConstraint('^7.0', new Version('7.0')),\n                                new SpecificMajorVersionConstraint('^7.0', 7)\n                            ]\n                        )\n                    ]\n                )\n            ],\n            [\n                '^5.3.2 | ^7.0 || ^8.0',\n                new OrVersionConstraintGroup(\n                    '^5.3.2 | ^7.0 || ^8.0',\n                    [\n                        new AndVersionConstraintGroup(\n                            '^5.3.2',\n                            [\n                                new GreaterThanOrEqualToVersionConstraint('^5.3.2', new Version('5.3.2')),\n                                new SpecificMajorVersionConstraint('^5.3.2', 5)\n                            ]\n                        ),\n                        new AndVersionConstraintGroup(\n                            '^7.0',\n                            [\n                                new GreaterThanOrEqualToVersionConstraint('^7.0', new Version('7.0')),\n                                new SpecificMajorVersionConstraint('^7.0', 7)\n                            ]\n                        ),\n                        new AndVersionConstraintGroup(\n                            '^8.0',\n                            [\n                                new GreaterThanOrEqualToVersionConstraint('^8.0', new Version('8.0')),\n                                new SpecificMajorVersionConstraint('^8.0', 8)\n                            ]\n                        )\n                    ]\n                )\n            ],\n            ['7.0.28-1', new ExactVersionConstraint('7.0.28-1')],\n            [\n                '^3.0.0-alpha1',\n                new AndVersionConstraintGroup(\n                    '^3.0.0-alpha1',\n                    [\n                        new GreaterThanOrEqualToVersionConstraint('^3.0.0-alpha1', new Version('3.0.0-alpha1')),\n                        new SpecificMajorVersionConstraint('^3.0.0-alpha1', 3)\n                    ]\n                )\n            ],\n            [\n                '^3.0.0-alpha.1',\n                new AndVersionConstraintGroup(\n                    '^3.0.0-alpha.1',\n                    [\n                        new GreaterThanOrEqualToVersionConstraint('^3.0.0-alpha.1', new Version('3.0.0-alpha.1')),\n                        new SpecificMajorVersionConstraint('^3.0.0-alpha.1', 3)\n                    ]\n                )\n            ],\n            [\n                '^1.0',\n                new AndVersionConstraintGroup(\n                    '^1.0',\n                    [\n                        new GreaterThanOrEqualToVersionConstraint('^1.0', new Version('1.0')),\n                        new SpecificMajorVersionConstraint('^1.0', 1)\n                    ]\n                )\n            ],\n            [\n                '^1',\n                new AndVersionConstraintGroup(\n                    '^1',\n                    [\n                        new GreaterThanOrEqualToVersionConstraint('^1', new Version('1')),\n                        new SpecificMajorVersionConstraint('^1', 1)\n                    ]\n                )\n            ]\n        ];\n    }\n\n    public function unsupportedVersionStringProvider() {\n        return [\n            ['foo'],\n            ['+1.0.2'],\n            ['>=2.0'],\n            ['^5.6 || >= 7.0'],\n            ['2.0 || foo']\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Unit/AbstractVersionConstraintTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\AbstractVersionConstraint\n */\nclass AbstractVersionConstraintTest extends TestCase {\n    public function testAsString(): void {\n        /** @var AbstractVersionConstraint|\\PHPUnit_Framework_MockObject_MockObject $constraint */\n        $constraint = $this->getMockForAbstractClass(AbstractVersionConstraint::class, ['foo']);\n\n        $this->assertSame('foo', $constraint->asString());\n    }\n}\n"
  },
  {
    "path": "tests/Unit/AndVersionConstraintGroupTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\AndVersionConstraintGroup\n */\nclass AndVersionConstraintGroupTest extends TestCase {\n    public function testReturnsFalseIfOneConstraintReturnsFalse(): void {\n        $firstConstraint  = $this->createMock(VersionConstraint::class);\n        $secondConstraint = $this->createMock(VersionConstraint::class);\n\n        $firstConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(true));\n\n        $secondConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(false));\n\n        $group = new AndVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]);\n\n        $this->assertFalse($group->complies(new Version('1.0.0')));\n    }\n\n    public function testReturnsTrueIfAllConstraintsReturnsTrue(): void {\n        $firstConstraint  = $this->createMock(VersionConstraint::class);\n        $secondConstraint = $this->createMock(VersionConstraint::class);\n\n        $firstConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(true));\n\n        $secondConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(true));\n\n        $group = new AndVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]);\n\n        $this->assertTrue($group->complies(new Version('1.0.0')));\n    }\n}\n"
  },
  {
    "path": "tests/Unit/AnyVersionConstraintTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\AnyVersionConstraint\n */\nclass AnyVersionConstraintTest extends TestCase {\n    public function versionProvider() {\n        return [\n            [new Version('1.0.2')],\n            [new Version('4.8')],\n            [new Version('0.1.1-dev')]\n        ];\n    }\n\n    /**\n     * @dataProvider versionProvider\n     */\n    public function testReturnsTrue(Version $version): void {\n        $constraint = new AnyVersionConstraint;\n\n        $this->assertTrue($constraint->complies($version));\n    }\n\n    public function testAsString(): void {\n        $this->assertSame('*', (new AnyVersionConstraint())->asString());\n    }\n}\n"
  },
  {
    "path": "tests/Unit/BuildMetaDataTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\BuildMetaData\n */\nclass BuildMetaDataTest extends TestCase {\n    public function testCanBeCreated(): void {\n        $this->assertInstanceOf(BuildMetaData::class, new BuildMetaData('some'));\n    }\n\n    public function testSetValueCanBeRetrieved(): void {\n        $this->assertSame('some', (new BuildMetaData('some'))->asString());\n    }\n\n    public function testTwoIdenticalMetadataStringsAreConsideredEqual(): void {\n        $a = new BuildMetaData('foo');\n        $b = new BuildMetaData('foo');\n\n        $this->assertTrue($a->equals($b));\n    }\n\n    public function testTwoNonIdenticalMetadataStringsAreNotConsideredEqual(): void {\n        $a = new BuildMetaData('abc');\n        $b = new BuildMetaData('def');\n\n        $this->assertFalse($a->equals($b));\n    }\n}\n"
  },
  {
    "path": "tests/Unit/ExactVersionConstraintTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\ExactVersionConstraint\n */\nclass ExactVersionConstraintTest extends TestCase {\n    public function compliantVersionProvider() {\n        return [\n            ['1.0.2', new Version('1.0.2')],\n            ['4.8.9', new Version('4.8.9')],\n            ['4.8.0', new Version('4.8')],\n            ['1.2.3-dev', new Version('1.2.3-dev')],\n            ['1.2.3+abc', new Version('1.2.3+abc')]\n        ];\n    }\n\n    public function nonCompliantVersionProvider() {\n        return [\n            ['1.0.2', new Version('1.0.3')],\n            ['4.8.9', new Version('4.7.9')],\n            ['4.8', new Version('4.8.5')],\n            ['1.2.3+abc', new Version('1.2.3+def')]\n        ];\n    }\n\n    /**\n     * @dataProvider compliantVersionProvider\n     *\n     * @param string $constraintValue\n     */\n    public function testReturnsTrueForCompliantVersion($constraintValue, Version $version): void {\n        $constraint = new ExactVersionConstraint($constraintValue);\n\n        $this->assertTrue($constraint->complies($version));\n    }\n\n    /**\n     * @dataProvider nonCompliantVersionProvider\n     *\n     * @param string $constraintValue\n     */\n    public function testReturnsFalseForNonCompliantVersion($constraintValue, Version $version): void {\n        $constraint = new ExactVersionConstraint($constraintValue);\n\n        $this->assertFalse($constraint->complies($version));\n    }\n}\n"
  },
  {
    "path": "tests/Unit/GreaterThanOrEqualToVersionConstraintTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\GreaterThanOrEqualToVersionConstraint\n */\nclass GreaterThanOrEqualToVersionConstraintTest extends TestCase {\n    public function versionProvider() {\n        return [\n            // compliant versions\n            [new Version('1.0.2'), new Version('1.0.2'), true],\n            [new Version('1.0.2'), new Version('1.0.3'), true],\n            [new Version('1.0.2'), new Version('1.1.1'), true],\n            [new Version('1.0.2'), new Version('2.0.0'), true],\n            [new Version('1.0.2'), new Version('1.0.3'), true],\n            // non-compliant versions\n            [new Version('1.0.2'), new Version('1.0.1'), false],\n            [new Version('1.9.8'), new Version('0.9.9'), false],\n            [new Version('2.3.1'), new Version('2.2.3'), false],\n            [new Version('3.0.2'), new Version('2.9.9'), false],\n        ];\n    }\n\n    /**\n     * @dataProvider versionProvider\n     *\n     * @param bool $expectedResult\n     */\n    public function testReturnsTrueForCompliantVersions(Version $constraintVersion, Version $version, $expectedResult): void {\n        $constraint = new GreaterThanOrEqualToVersionConstraint('foo', $constraintVersion);\n\n        $this->assertSame($expectedResult, $constraint->complies($version));\n    }\n}\n"
  },
  {
    "path": "tests/Unit/OrVersionConstraintGroupTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\OrVersionConstraintGroup\n */\nclass OrVersionConstraintGroupTest extends TestCase {\n    public function testReturnsTrueIfOneConstraintReturnsFalse(): void {\n        $firstConstraint  = $this->createMock(VersionConstraint::class);\n        $secondConstraint = $this->createMock(VersionConstraint::class);\n\n        $firstConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(false));\n\n        $secondConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(true));\n\n        $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]);\n\n        $this->assertTrue($group->complies(new Version('1.0.0')));\n    }\n\n    public function testReturnsTrueIfAllConstraintsReturnsTrue(): void {\n        $firstConstraint  = $this->createMock(VersionConstraint::class);\n        $secondConstraint = $this->createMock(VersionConstraint::class);\n\n        $firstConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(true));\n\n        $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]);\n\n        $this->assertTrue($group->complies(new Version('1.0.0')));\n    }\n\n    public function testReturnsFalseIfAllConstraintsReturnsFalse(): void {\n        $firstConstraint  = $this->createMock(VersionConstraint::class);\n        $secondConstraint = $this->createMock(VersionConstraint::class);\n\n        $firstConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(false));\n\n        $secondConstraint->expects($this->once())\n            ->method('complies')\n            ->will($this->returnValue(false));\n\n        $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]);\n\n        $this->assertFalse($group->complies(new Version('1.0.0')));\n    }\n}\n"
  },
  {
    "path": "tests/Unit/PreReleaseSuffixTest.php",
    "content": "<?php declare(strict_types = 1);\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\PreReleaseSuffix\n */\nclass PreReleaseSuffixTest extends TestCase {\n    /**\n     * @dataProvider greaterThanProvider\n     */\n    public function testGreaterThanReturnsExpectedResult(\n        string $leftSuffixValue,\n        string $rightSuffixValue,\n        bool $expectedResult\n    ): void {\n        $leftSuffix  = new PreReleaseSuffix($leftSuffixValue);\n        $rightSuffix = new PreReleaseSuffix($rightSuffixValue);\n\n        $this->assertSame($expectedResult, $leftSuffix->isGreaterThan($rightSuffix));\n    }\n\n    public function greaterThanProvider() {\n        return [\n            ['alpha1', 'alpha2', false],\n            ['alpha2', 'alpha1', true],\n            ['beta1', 'alpha3', true],\n            ['b1', 'alpha3', true],\n            ['b1', 'a3', true],\n            ['dev1', 'alpha2', false],\n            ['dev1', 'alpha2', false],\n            ['alpha2', 'dev5', true],\n            ['rc1', 'beta2', true],\n            ['patch5', 'rc7', true],\n            ['alpha1', 'alpha.2', false],\n            ['alpha.3', 'alpha2', true],\n            ['alpha.3', 'alpha.2', true],\n        ];\n    }\n\n    /**\n     * @dataProvider suffixProvider\n     */\n    public function testParsedValue(string $suffix): void {\n        $prs = new PreReleaseSuffix($suffix);\n        $this->assertEquals($suffix, $prs->asString());\n    }\n\n    public function suffixProvider() {\n        return [\n            ['alpha1'],\n            ['beta1'],\n            ['b1'],\n            ['dev1'],\n            ['rc1'],\n            ['patch5'],\n\n            ['alpha.1'],\n            ['beta.1'],\n            ['b.1'],\n            ['dev.1'],\n            ['rc.1'],\n            ['patch.5']\n        ];\n    }\n\n    public function testLabelCanBeRetrieved(): void {\n        $this->assertSame('rc', (new PreReleaseSuffix('rc1'))->getValue());\n    }\n\n    public function testCreatingWithUnsupportedLabelTypeThrowsException(): void {\n        $this->expectException(InvalidPreReleaseSuffixException::class);\n        (new PreReleaseSuffix('foo'));\n    }\n}\n"
  },
  {
    "path": "tests/Unit/SpecificMajorAndMinorVersionConstraintTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\SpecificMajorAndMinorVersionConstraint\n */\nclass SpecificMajorAndMinorVersionConstraintTest extends TestCase {\n    public function versionProvider() {\n        return [\n            // compliant versions\n            [1, 0, new Version('1.0.2'), true],\n            [1, 0, new Version('1.0.3'), true],\n            [1, 1, new Version('1.1.1'), true],\n            // non-compliant versions\n            [2, 9, new Version('0.9.9'), false],\n            [3, 2, new Version('2.2.3'), false],\n            [2, 8, new Version('2.9.9'), false],\n        ];\n    }\n\n    /**\n     * @dataProvider versionProvider\n     *\n     * @param int  $major\n     * @param int  $minor\n     * @param bool $expectedResult\n     */\n    public function testReturnsTrueForCompliantVersions($major, $minor, Version $version, $expectedResult): void {\n        $constraint = new SpecificMajorAndMinorVersionConstraint('foo', $major, $minor);\n\n        $this->assertSame($expectedResult, $constraint->complies($version));\n    }\n}\n"
  },
  {
    "path": "tests/Unit/SpecificMajorVersionConstraintTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\SpecificMajorVersionConstraint\n */\nclass SpecificMajorVersionConstraintTest extends TestCase {\n    public function versionProvider() {\n        return [\n            // compliant versions\n            [1, new Version('1.0.2'), true],\n            [1, new Version('1.0.3'), true],\n            [1, new Version('1.1.1'), true],\n            // non-compliant versions\n            [2, new Version('0.9.9'), false],\n            [3, new Version('2.2.3'), false],\n            [3, new Version('2.9.9'), false],\n        ];\n    }\n\n    /**\n     * @dataProvider versionProvider\n     *\n     * @param int  $major\n     * @param bool $expectedResult\n     */\n    public function testReturnsTrueForCompliantVersions($major, Version $version, $expectedResult): void {\n        $constraint = new SpecificMajorVersionConstraint('foo', $major);\n\n        $this->assertSame($expectedResult, $constraint->complies($version));\n    }\n}\n"
  },
  {
    "path": "tests/Unit/VersionTest.php",
    "content": "<?php declare(strict_types = 1);\n/*\n * This file is part of PharIo\\Version.\n *\n * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nnamespace PharIo\\Version;\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * @covers \\PharIo\\Version\\Version\n */\nclass VersionTest extends TestCase {\n    /**\n     * @dataProvider versionProvider\n     *\n     * @param string $versionString\n     * @param string $expectedMajor\n     * @param string $expectedMinor\n     * @param string $expectedPatch\n     * @param string $expectedPreReleaseValue\n     * @param int    $expectedReleaseCount\n     * @param string $metaData\n     */\n    public function testParsesVersionNumbers(\n        $versionString,\n        $expectedMajor,\n        $expectedMinor,\n        $expectedPatch,\n        $expectedPreReleaseValue = '',\n        $expectedReleaseCount = 0,\n        $metaData = ''\n    ): void {\n        $version = new Version($versionString);\n\n        $this->assertSame($expectedMajor, $version->getMajor()->getValue());\n        $this->assertSame($expectedMinor, $version->getMinor()->getValue());\n        $this->assertSame($expectedPatch, $version->getPatch()->getValue());\n\n        if ($expectedPreReleaseValue !== '') {\n            $this->assertSame($expectedPreReleaseValue, $version->getPreReleaseSuffix()->getValue());\n        }\n\n        if ($expectedReleaseCount !== 0) {\n            $this->assertSame($expectedReleaseCount, $version->getPreReleaseSuffix()->getNumber());\n        }\n\n        if ($metaData !== '') {\n            $this->assertSame($metaData, $version->getBuildMetaData()->asString());\n        }\n    }\n\n    public function versionProvider() {\n        return [\n            ['0.0.1', 0, 0, 1],\n            ['0.1.2', 0, 1, 2],\n            ['1.0.0-alpha', 1, 0, 0, 'alpha'],\n            ['3.4.12-dev3', 3, 4, 12, 'dev', 3],\n            ['1.2.3-beta.2', 1, 2, 3, 'beta', 2],\n            ['v1.2.3-rc', 1, 2, 3, 'rc'],\n            ['v1.2.3-rc1', 1, 2, 3, 'rc', 1],\n            ['0.0.1-dev+ABC', 0, 0, 1, 'dev', 0, 'ABC'],\n            ['0.0.1+git-15a90844ad40f127afd244c0cad228de2a80052a', 0, 0, 1, '', 0, 'git-15a90844ad40f127afd244c0cad228de2a80052a']\n        ];\n    }\n\n    /**\n     * @dataProvider versionStringProvider\n     */\n    public function testOrigionalStringReturnsExceptedVersionString(string $input): void {\n        $this->assertEquals(\n            (new Version($input))->getOriginalString(),\n            $input\n        );\n    }\n\n    /**\n     * @dataProvider versionStringProvider\n     */\n    public function testAsStringReturnsExceptedVersionString(string $input, string $excepted): void {\n        $this->assertEquals(\n            (new Version($input))->getVersionString(),\n            $excepted\n        );\n    }\n\n    /**\n     * @dataProvider versionGreaterThanProvider\n     *\n     * @param bool $expectedResult\n     */\n    public function testIsGreaterThan(Version $versionA, Version $versionB, $expectedResult): void {\n        $this->assertSame($expectedResult, $versionA->isGreaterThan($versionB));\n    }\n\n    public function versionGreaterThanProvider(): array {\n        return [\n            [new Version('1.0.0'), new Version('1.0.1'), false],\n            [new Version('1.0.1'), new Version('1.0.0'), true],\n            [new Version('1.1.0'), new Version('1.0.1'), true],\n            [new Version('1.1.0'), new Version('2.0.1'), false],\n            [new Version('1.1.0'), new Version('1.1.0'), false],\n            [new Version('2.5.8'), new Version('1.6.8'), true],\n            [new Version('2.5.8'), new Version('2.6.8'), false],\n            [new Version('2.5.8'), new Version('3.1.2'), false],\n            [new Version('3.0.0-alpha1'), new Version('3.0.0-alpha2'), false],\n            [new Version('3.0.0-alpha2'), new Version('3.0.0-alpha1'), true],\n            [new Version('3.0.0-alpha.1'), new Version('3.0.0'), false],\n            [new Version('3.0.0'), new Version('3.0.0-alpha.1'), true],\n        ];\n    }\n\n    /**\n     * @dataProvider invalidVersionStringProvider\n     *\n     * @param string $versionString\n     */\n    public function testThrowsExceptionIfVersionStringDoesNotFollowSemVer($versionString): void {\n        $this->expectException(InvalidVersionException::class);\n        new Version($versionString);\n    }\n\n    public function invalidVersionStringProvider(): array {\n        return [\n            ['foo'],\n            ['1.2.3.4'],\n            ['1.0.0-x.7.z.92']\n        ];\n    }\n\n    public function versionStringProvider() {\n        return [\n            ['0.0.1', '0.0.1'],\n            ['0.1.0', '0.1.0'],\n            ['1.0.0-alpha', '1.0.0-alpha'],\n            ['3.4.12-dev3', '3.4.12-dev3'],\n            ['1.2.3-beta.2', '1.2.3-beta.2'],\n\n            ['v0.0.1', '0.0.1'],\n            ['v0.1.0', '0.1.0'],\n            ['v1.0.0-alpha', '1.0.0-alpha'],\n            ['v3.4.12-dev3', '3.4.12-dev3'],\n            ['v1.2.3-beta.2', '1.2.3-beta.2'],\n\n            ['0.1', '0.1.0'],\n            ['v0.1', '0.1.0'],\n            ['1', '1.0.0']\n        ];\n    }\n\n    public function testIdenticalVersionsAreConsideredEqual(): void {\n        $a = new Version('1.0.0-rc1');\n        $b = new Version('1.0.0-rc1');\n\n        $this->assertTrue($a->equals($b));\n    }\n\n    public function testNonIdenticalVersionsAreNotConsideredEqual(): void {\n        $a = new Version('1.0.0-rc1');\n        $b = new Version('1.0.0-rc2');\n\n        $this->assertFalse($a->equals($b));\n    }\n\n    public function testIdenticalVersionsWithBuildMetaDataAreConsideredEqual(): void {\n        $a = new Version('1.0.0-rc1+abc');\n        $b = new Version('1.0.0-rc1+abc');\n\n        $this->assertTrue($a->equals($b));\n    }\n\n    public function testIdenticalVersionsWithOnlyOneHavingBuildMetaDataAreNotConsideredEqual(): void {\n        $a = new Version('1.0.0-rc1+abc');\n        $b = new Version('1.0.0-rc1');\n\n        $this->assertFalse($a->equals($b));\n    }\n\n    public function testIdenticalVersionsWithDifferingBuildMetaDataAreNotConsideredEqual(): void {\n        $a = new Version('1.0.0-rc1+abc');\n        $b = new Version('1.0.0-rc1+def');\n\n        $this->assertFalse($a->equals($b));\n    }\n\n    public function testGetPreReleaseSuffixThrowsExceptionWhenNoneIsSet(): void {\n        $this->expectException(NoPreReleaseSuffixException::class);\n        (new Version('1.2.3'))->getPreReleaseSuffix();\n    }\n\n    public function testGetBuildMetadataThrowsExceptionWhenNoneIsSet(): void {\n        $this->expectException(NoBuildMetaDataException::class);\n        (new Version('1.2.3'))->getBuildMetaData();\n    }\n\n    public function testHasBuildMetadataReturnsFalseWhenNoneIsSet(): void {\n        $this->assertFalse((new Version('1.2.3'))->hasBuildMetaData());\n    }\n\n    public function testBuildMetadataCanBeRetreived(): void {\n        $this->assertSame('test', (new Version('1.2.3+test'))->getBuildMetaData()->asString());\n    }\n}\n"
  }
]