Repository: Ocramius/PackageVersions Branch: 2.12.x Commit: ccc40bc2de0e Files: 22 Total size: 30.9 KB Directory structure: gitextract_8vu4j0_g/ ├── .gitattributes ├── .github/ │ ├── FUNDING.yml │ └── workflows/ │ ├── continuous-integration.yml │ └── release-on-milestone-closed.yml ├── .gitignore ├── .laminas-ci.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── ToRussianPeople.md ├── composer.json ├── infection.json.dist ├── phpcs.xml.dist ├── phpunit.xml.dist ├── psalm.xml ├── renovate.json ├── src/ │ └── PackageVersions/ │ └── Versions.php └── test/ ├── PackageVersionsTest/ │ └── VersionsTest.php └── static-analysis/ ├── happy-path/ │ └── expected-package-name.php └── unhappy-path/ └── unexpected-package-name.php ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ /.github export-ignore /test export-ignore .gitattributes export-ignore .gitignore export-ignore phpcs.xml.dist export-ignore phpunit.xml.dist export-ignore psalm.xml export-ignore infection.json.dist export-ignore ================================================ FILE: .github/FUNDING.yml ================================================ github: [Ocramius] tidelift: "packagist/ocramius/package-versions" ================================================ FILE: .github/workflows/continuous-integration.yml ================================================ # See https://github.com/laminas/laminas-continuous-integration-action # Generates a job matrix based on current dependencies and supported version # ranges, then runs all those jobs name: "Continuous Integration" on: pull_request: push: jobs: matrix: name: Generate job matrix runs-on: ubuntu-latest outputs: matrix: ${{ steps.matrix.outputs.matrix }} steps: - name: Gather CI configuration id: matrix uses: laminas/laminas-ci-matrix-action@cb19bb402f3be76292a08b6632e1ecdb9fdd22bc # 1.31.0 qa: name: QA Checks needs: [ matrix ] runs-on: ${{ matrix.operatingSystem }} strategy: fail-fast: false matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }} steps: - name: ${{ matrix.name }} uses: laminas/laminas-continuous-integration-action@5f4512e23ab587455e9f0a39e4616dad4550de4f # 1.43.0 env: "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} "INFECTION_DASHBOARD_API_KEY": ${{ secrets.INFECTION_DASHBOARD_API_KEY }} "STRYKER_DASHBOARD_API_KEY": ${{ secrets.STRYKER_DASHBOARD_API_KEY }} with: job: ${{ matrix.job }} ================================================ FILE: .github/workflows/release-on-milestone-closed.yml ================================================ # https://help.github.com/en/categories/automating-your-workflow-with-github-actions name: "Automatic Releases" on: milestone: types: - "closed" jobs: release: name: "GIT tag, release & create merge-up PR" runs-on: ubuntu-latest steps: - name: "Checkout" uses: "actions/checkout@v6" - name: "Release" uses: "laminas/automatic-releases@1.25.0" with: command-name: "laminas:automatic-releases:release" env: "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - name: "Create Merge-Up Pull Request" uses: "laminas/automatic-releases@v1" with: command-name: "laminas:automatic-releases:create-merge-up-pull-request" env: "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - name: "Create and/or Switch to new Release Branch" uses: "laminas/automatic-releases@v1" with: command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor" env: "GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - name: "Bump Changelog Version On Originating Release Branch" uses: "laminas/automatic-releases@v1" with: command-name: "laminas:automatic-releases:bump-changelog" env: "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - name: "Create new milestones" uses: "laminas/automatic-releases@v1" with: command-name: "laminas:automatic-releases:create-milestones" env: "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} ================================================ FILE: .gitignore ================================================ /vendor/ /clover.xml /phpcs.xml /.phpcs-cache ================================================ FILE: .laminas-ci.json ================================================ { "extensions": [ "pcov" ], "ini": [ "memory_limit=-1" ], "exclude": [ {"name": "Infection [8.2, locked]"} ], "additional_checks": [ { "name": "Infection (with PCOV)", "job": { "php": "8.4", "dependencies": "locked", "command": "./vendor/bin/roave-infection-static-analysis-plugin" } } ], "ignore_php_platform_requirements": { "8.5": true } } ================================================ FILE: CHANGELOG.md ================================================ # CHANGELOG ## 2.0.0 - 2020-08-21 This release turns the package into a library (previously, it was a composer plugin). Relevant change is that the `PackageVersions\Versions::ROOT_PACKAGE_NAME` constant no longer exists: please use `PackageVersions\Versions::rootPackageName()` instead. This slims down the complexity of the package massively, and removes multiple known bugs. Total issues resolved: **5** - [107: Unable to install on vboxfs](https://github.com/Ocramius/PackageVersions/issues/107) thanks to @alexgit2k - [138: `src/Packages/Versions.php` changes detected in `composer install`](https://github.com/Ocramius/PackageVersions/issues/138) thanks to @Taluu - [142: Option to ignore version of rootPackage](https://github.com/Ocramius/PackageVersions/issues/142) thanks to @qurben - [152: Ocramius/PackageVersions is not compatible with composer configuration "lock: false"](https://github.com/Ocramius/PackageVersions/issues/152) thanks to @windaishi - [155: BC break: removed deprecated `PackageVersions\Versions::ROOT_PACKAGE_NAME` constant](https://github.com/Ocramius/PackageVersions/pull/155) thanks to @Ocramius ## 2.12.0 - TBD ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 2.11.0 - 2025-11-27 ----- ### Release Notes for [2.11.0](https://github.com/Ocramius/PackageVersions/milestone/54) Feature release (minor) ### 2.11.0 - Total issues resolved: **0** - Total pull requests resolved: **4** - Total contributors: **2** #### dependencies,enhancement - [270: Add PHP 8.5 support](https://github.com/Ocramius/PackageVersions/pull/270) thanks to @samsonasik #### renovate - [269: Update dependency doctrine/coding-standard to v14](https://github.com/Ocramius/PackageVersions/pull/269) thanks to @renovate[bot] - [268: Update actions/checkout action to v5](https://github.com/Ocramius/PackageVersions/pull/268) thanks to @renovate[bot] - [266: Update dependency doctrine/coding-standard to v13](https://github.com/Ocramius/PackageVersions/pull/266) thanks to @renovate[bot] ## 2.10.0 - 2025-02-05 ----- ### Release Notes for [2.10.0](https://github.com/Ocramius/PackageVersions/milestone/52) Feature release (minor) ### 2.10.0 - Total issues resolved: **0** - Total pull requests resolved: **4** - Total contributors: **1** #### renovate - [261: Update dependency vimeo/psalm to v6](https://github.com/Ocramius/PackageVersions/pull/261) thanks to @renovate[bot] - [257: Roll back laminas/automatic-releases action to 1.24.0 - autoclosed](https://github.com/Ocramius/PackageVersions/pull/257) thanks to @renovate[bot] - [252: Update dependency phpunit/phpunit to v11](https://github.com/Ocramius/PackageVersions/pull/252) thanks to @renovate[bot] - [246: Update dependency phpunit/phpunit to v10 - abandoned](https://github.com/Ocramius/PackageVersions/pull/246) thanks to @renovate[bot] ## 2.9.0 - 2024-08-04 ----- ### Release Notes for [2.9.0](https://github.com/Ocramius/PackageVersions/milestone/50) Feature release (minor) ### 2.9.0 - Total issues resolved: **0** - Total pull requests resolved: **2** - Total contributors: **2** #### dependencies,enhancement - [256: Allow PHP 8.4](https://github.com/Ocramius/PackageVersions/pull/256) thanks to @fezfez #### security - [253: Update dependency composer/composer to ^2.7.0 [SECURITY]](https://github.com/Ocramius/PackageVersions/pull/253) thanks to @renovate[bot] ## 2.8.0 - 2023-09-15 ----- ### Release Notes for [2.8.0](https://github.com/Ocramius/PackageVersions/milestone/48) Feature release (minor) ### 2.8.0 - Total issues resolved: **0** - Total pull requests resolved: **4** - Total contributors: **2** #### enhancement - [250: Allow php 8.3](https://github.com/Ocramius/PackageVersions/pull/250) thanks to @fezfez #### renovate - [249: Update actions/checkout action to v4](https://github.com/Ocramius/PackageVersions/pull/249) thanks to @renovate[bot] - [245: Update dependency doctrine/coding-standard to v11](https://github.com/Ocramius/PackageVersions/pull/245) thanks to @renovate[bot] - [244: Update dependency vimeo/psalm to v5](https://github.com/Ocramius/PackageVersions/pull/244) thanks to @renovate[bot] ## 2.7.0 - 2022-10-31 ----- ### Release Notes for [2.7.0](https://github.com/Ocramius/PackageVersions/milestone/46) Feature release (minor) ### 2.7.0 - Total issues resolved: **0** - Total pull requests resolved: **6** - Total contributors: **2** #### dependencies - [243: Update dependency composer/composer to ^2.4.4](https://github.com/Ocramius/PackageVersions/pull/243) thanks to @Ocramius #### renovate - [242: Update all non-major dependencies, dropping PHP 8.0 support](https://github.com/Ocramius/PackageVersions/pull/242) thanks to @renovate[bot] - [240: Update dependency doctrine/coding-standard to v10](https://github.com/Ocramius/PackageVersions/pull/240) thanks to @renovate[bot] - [238: Configure Renovate](https://github.com/Ocramius/PackageVersions/pull/238) thanks to @renovate[bot] #### security - [239: Update dependency composer/composer to ^2.2.12 [SECURITY] - autoclosed](https://github.com/Ocramius/PackageVersions/pull/239) thanks to @renovate[bot] #### enhancement - [233: Streamlined CI setup with `laminas/laminas-ci-matrix-action`](https://github.com/Ocramius/PackageVersions/pull/233) thanks to @Ocramius ## 2.3.0 - 2020-12-23 ----- ### Release Notes for [2.3.0](https://github.com/Ocramius/PackageVersions/milestone/28) ### 2.3.0 - Total issues resolved: **0** - Total pull requests resolved: **1** - Total contributors: **1** #### enhancement - [164: Update `.gitattributes` to avoid exporting phpcs artifacts](https://github.com/Ocramius/PackageVersions/pull/164) thanks to @reedy ## 1.10.1 - 2020-08-18 Introduced release automation tooling, which should also help us with keeping the changelog up-to-date long-term. ## 1.1.3 - 2017-09-06 This release fixes a bug that caused PackageVersions to prevent the `composer remove` and `composer update` commands to fail when this package is removed. In addition to that, mutation testing has been added to the suite, ensuring that the package is accurately and extensively tested. Total issues resolved: **3** - [40: Mutation testing, PHP 7.1 testing](https://github.com/Ocramius/PackageVersions/pull/40) thanks to @Ocramius - [41: Removing this package on install results in file access error](https://github.com/Ocramius/PackageVersions/issues/41) thanks to @Xerkus - [46: #41 Avoid issues when the package is scheduled for removal](https://github.com/Ocramius/PackageVersions/pull/46) thanks to @Jean85 ## 1.1.2 - 2016-12-30 This release fixes a bug that caused PackageVersions to be enabled even when it was part of a globally installed package. Total issues resolved: **3** - [35: remove all temp directories](https://github.com/Ocramius/PackageVersions/pull/35) - [38: Interferes with other projects when installed globally](https://github.com/Ocramius/PackageVersions/issues/38) - [39: Ignore the global plugin when updating local projects](https://github.com/Ocramius/PackageVersions/pull/39) ## 1.1.1 - 2016-07-25 This release removes the [`"files"`](https://getcomposer.org/doc/04-schema.md#files) directive from [`composer.json`](https://github.com/Ocramius/PackageVersions/commit/86f2636f7c5e7b56fa035fa3826d5fcf80b6dc72), as it is no longer needed for `composer install --classmap-authoritative`. Also, that directive was causing issues with HHVM installations, since PackageVersions is not compatible with it. Total issues resolved: **1** - [34: Fatal error during travis build after update to 1.1.0](https://github.com/Ocramius/PackageVersions/issues/34) ## 1.1.0 - 2016-07-22 This release introduces support for running `composer install --classmap-authoritative` and `composer install --no-scripts`. Please note that performance while using these modes may be degraded, but the package will still work. Additionally, the package was tuned to prevent the plugin from running twice at installation. Total issues resolved: **10** - [18: Fails when using composer install --no-scripts](https://github.com/Ocramius/PackageVersions/issues/18) - [20: CS (spacing)](https://github.com/Ocramius/PackageVersions/pull/20) - [22: Document the way the require-dev section is treated](https://github.com/Ocramius/PackageVersions/issues/22) - [23: Underline that composer.lock is used as source of information](https://github.com/Ocramius/PackageVersions/pull/23) - [27: Fix incompatibility with --classmap-authoritative](https://github.com/Ocramius/PackageVersions/pull/27) - [29: mention optimize-autoloader composer.json config option in README](https://github.com/Ocramius/PackageVersions/pull/29) - [30: The version class is generated twice during composer update](https://github.com/Ocramius/PackageVersions/issues/30) - [31: Remove double registration of the event listeners](https://github.com/Ocramius/PackageVersions/pull/31) - [32: Update the usage of mock APIs to use the new API](https://github.com/Ocramius/PackageVersions/pull/32) - [33: Fix for #18 - support running with --no-scripts flag](https://github.com/Ocramius/PackageVersions/pull/33) ## 1.0.4 - 2016-04-23 This release includes a fix/workaround for composer/composer#5237, which causes `ocramius/package-versions` to sometimes generate a `Versions` class with malformed name (something like `Versions_composer_tmp0`) when running `composer require `. Total issues resolved: **2** - [16: Workaround for composer/composer#5237 - class parsing](https://github.com/Ocramius/PackageVersions/pull/16) - [17: Weird Class name being generated](https://github.com/Ocramius/PackageVersions/issues/17) ## 1.0.3 - 2016-02-26 This release fixes an issue related to concurrent autoloader re-generation caused by multiple composer plugins being installed. The issue was solved by removing autoloader re-generation from this package, but it may still affect other packages. It is now recommended that you run `composer dump-autoload --optimize` after installation when using this particular package. Please note that `composer (install|update) -o` is not sufficient to avoid autoload overhead when using this particular package. Total issues resolved: **1** - [15: Remove autoload re-dump optimization](https://github.com/Ocramius/PackageVersions/pull/15) ## 1.0.2 - 2016-02-24 This release fixes issues related to installing the component without any dev dependencies or with packages that don't have a source or dist reference, which is usual with packages defined directly in the `composer.json`. Total issues resolved: **3** - [11: fix composer install --no-dev PHP7](https://github.com/Ocramius/PackageVersions/pull/11) - [12: Packages don't always have a source/reference](https://github.com/Ocramius/PackageVersions/issues/12) - [13: Fix #12 - support dist and missing package version references](https://github.com/Ocramius/PackageVersions/pull/13) ## 1.0.1 - 2016-02-01 This release fixes an issue related with composer updates to already installed versions. Using `composer require` within a package that already used `ocramius/package-versions` caused the installation to be unable to write the `PackageVersions\Versions` class to a file. Total issues resolved: **6** - [2: remove unused use statement](https://github.com/Ocramius/PackageVersions/pull/2) - [3: Remove useless files from dist package](https://github.com/Ocramius/PackageVersions/pull/3) - [5: failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly](https://github.com/Ocramius/PackageVersions/issues/5) - [6: Fix/#5 use composer vendor dir](https://github.com/Ocramius/PackageVersions/pull/6) - [7: Hotfix - #5 generate package versions also when in phar context](https://github.com/Ocramius/PackageVersions/pull/7) - [8: Versions class should be ignored by VCS, as it is an install-time artifact](https://github.com/Ocramius/PackageVersions/pull/8) ================================================ FILE: CONTRIBUTING.md ================================================ --- title: Contributing --- # Contributing * Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) * The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php) * Any contribution must provide tests for additional introduced conditions * Any un-confirmed issue needs a failing test case before being accepted * Pull requests must be sent from a new hotfix/feature branch, not from `master`. ## Installation To install the project and run the tests, you need to clone it first: ```sh $ git clone git://github.com/Ocramius/PackageVersions.git ``` You will then need to run a composer installation: ```sh $ cd PackageVersions $ curl -s https://getcomposer.org/installer | php $ php composer.phar update ``` ## Testing The PHPUnit version to be used is the one installed as a dev- dependency via composer: ```sh $ ./vendor/bin/phpunit ``` Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement won't be merged. ================================================ FILE: LICENSE ================================================ Copyright (c) 2016 Marco Pivetta Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Package Versions ## A message to Russian 🇷🇺 people If you currently live in Russia, please read [this message](./ToRussianPeople.md). ### Purpose This utility provides quick and easy access to version information of composer dependencies. This information is derived from the ```composer.lock``` file which is (re)generated during ```composer install``` or ```composer update```. ```php $version = \PackageVersions\Versions::getVersion('ocramius/package-versions'); var_dump($version); // 1.0.0@0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 ``` [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FOcramius%2FPackageVersions%2F2.0.x)](https://dashboard.stryker-mutator.io/reports/github.com/Ocramius/PackageVersions/2.0.x) [![Type Coverage](https://shepherd.dev/github/Ocramius/PackageVersions/coverage.svg)](https://shepherd.dev/github/Ocramius/PackageVersions) [![Downloads](https://img.shields.io/packagist/dt/ocramius/package-versions.svg)](https://packagist.org/packages/ocramius/package-versions) [![Packagist](https://img.shields.io/packagist/v/ocramius/package-versions.svg)](https://packagist.org/packages/ocramius/package-versions) [![Dependencies](https://tidelift.com/badges/github/packagist/ocramius%2Fpackage-versions)](https://tidelift.com/subscription/pkg/packagist-ocramius%2Fpackage-versions?utm_source=packagist-ocramius%2Fpackage-versions&utm_medium=readme) ### Installation ```sh composer require ocramius/package-versions ``` It is suggested that you use [an optimized composer autoloader](https://getcomposer.org/doc/06-config.md#optimize-autoloader) (to prevent autoload I/O when accessing the `PackageVersions\Versions` API) in your composer.json: ```json ... "config": { "optimize-autoloader": true }, ... ``` In case you manually generate your autoloader via the CLI use the `--optimize` flag: ```sh composer dump-autoload --optimize ``` ### Use-cases This repository implements `PackageVersions\Versions::getVersion()` in such a way that no IO happens when calling it, because the list of package versions is compiled during composer installation. This is especially useful when you want to generate assets/code/artifacts that are computed from the current version of a certain dependency. Doing so at runtime by checking the installed version of a package would be too expensive, and this package mitigates that. ## ocramius/package-versions for enterprise Available as part of the Tidelift Subscription. The maintainer of ocramius/package-versions and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-ocramius-package-versions?utm_source=packagist-ocramius-package-versions&utm_medium=referral&utm_campaign=enterprise&utm_term=repo). You can also contact the maintainer at ocramius@gmail.com for looking into issues related to this package in your private projects. ================================================ FILE: SECURITY.md ================================================ ## Security contact information To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. ================================================ FILE: ToRussianPeople.md ================================================ ## 🇷🇺 Русским гражданам В Украине сейчас идет война. Силами РФ наносятся удары по гражданской инфраструктуре в [Харькове][1], [Киеве][2], [Чернигове][3], [Сумах][4], [Ирпене][5] и десятках других городов. Гибнут люди - и гражданское население, и военные, в том числе российские призывники, которых бросили воевать. Чтобы лишить собственный народ доступа к информации, правительство РФ запретило называть войну войной, закрыло независимые СМИ и принимает сейчас ряд диктаторских законов. Эти законы призваны заткнуть рот всем, кто против войны. За обычный призыв к миру сейчас можно получить несколько лет тюрьмы. Не молчите! Молчание - знак вашего согласия с политикой российского правительства. **Вы можете сделать выбор НЕ МОЛЧАТЬ.** --- ## 🇺🇸 To people of Russia There is a war in Ukraine right now. The forces of the Russian Federation are attacking civilian infrastructure in [Kharkiv][1], [Kyiv][2], [Chernihiv][3], [Sumy][4], [Irpin][5] and dozens of other cities. People are dying – both civilians and military servicemen, including Russian conscripts who were thrown into the fighting. In order to deprive its own people of access to information, the government of the Russian Federation has forbidden calling a war a war, shut down independent media and is passing a number of dictatorial laws. These laws are meant to silence all those who are against war. You can be jailed for multiple years for simply calling for peace. Do not be silent! Silence is a sign that you accept the Russian government's policy. **You can choose NOT TO BE SILENT.** [1]: "Kharkiv under attack" [2]: "Kyiv under attack" [3]: "Chernihiv under attack" [4]: "Sumy under attack" [5]: "Irpin under attack" ================================================ FILE: composer.json ================================================ { "name": "ocramius/package-versions", "description": "Provides efficient querying for installed package versions (no runtime IO)", "type": "library", "license": "MIT", "authors": [ { "name": "Marco Pivetta", "email": "ocramius@gmail.com" } ], "require": { "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", "composer-runtime-api": "^2.2.0" }, "require-dev": { "composer/composer": "^2.9.2", "doctrine/coding-standard": "^14.0.0", "ext-zip": "^1.15.0", "roave/infection-static-analysis-plugin": "^1.39.0", "phpunit/phpunit": "^11.5.44", "psalm/plugin-phpunit": "^0.19.5", "vimeo/psalm": "^6.13.1" }, "replace": { "composer/package-versions-deprecated": "*" }, "autoload": { "psr-4": { "PackageVersions\\": "src/PackageVersions" } }, "autoload-dev": { "psr-4": { "PackageVersionsTest\\": "test/PackageVersionsTest" } }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, "infection/extension-installer": false }, "platform": { "php": "8.2.99" } } } ================================================ FILE: infection.json.dist ================================================ { "timeout": 10, "source": { "directories": [ "src" ] }, "logs": { "text": "php://stderr", "stryker": { "report": "/^\\d\\.\\d\\.x$/" } }, "minMsi": 100, "minCoveredMsi": 100 } ================================================ FILE: phpcs.xml.dist ================================================ src test ================================================ FILE: phpunit.xml.dist ================================================ ./test/PackageVersionsTest ./src ================================================ FILE: psalm.xml ================================================ ================================================ FILE: renovate.json ================================================ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ "local>Ocramius/.github:renovate-config" ] } ================================================ FILE: src/PackageVersions/Versions.php ================================================ , * packages-dev: array, * } $lockData */ $lockData = json_decode($contents, true, flags: JSON_THROW_ON_ERROR); $packages = array_merge($lockData['packages'], $lockData['packages-dev']); self::assertNotEmpty($packages); foreach ($packages as $package) { self::assertSame( $package['version'] . '@' . $package['source']['reference'], Versions::getVersion($package['name']), ); } } #[Group('#148')] public function testCanRetrieveRootPackageVersion(): void { /** @psalm-suppress DeprecatedConstant */ self::assertMatchesRegularExpression('/^.+\@[0-9a-f]+$/', Versions::getVersion(Versions::rootPackageName())); } #[Group('#153')] public function testCanRetrieveRootPackageName(): void { self::assertMatchesRegularExpression('/^[a-z0-9\\-]+\\/[a-z0-9\\-]+$/', Versions::rootPackageName()); } public function testInvalidVersionsAreRejected(): void { $this->expectException(OutOfBoundsException::class); /** @psalm-suppress ArgumentTypeCoercion we are explicitly testing for something not allowed by the type system */ Versions::getVersion(uniqid('', true) . '/' . uniqid('', true)); } } ================================================ FILE: test/static-analysis/happy-path/expected-package-name.php ================================================