.github/FUNDING.yml000064400000000042144760123310007716 0ustar00community_bridge: laminas-project .github/workflows/continuous-integration.yml000064400000001314144760123310015413 0ustar00name: "Continuous Integration" on: pull_request: push: branches: - '[0-9]+.[0-9]+.x' - 'refs/pull/*' 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@v1 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@v1 with: job: ${{ matrix.job }} .github/workflows/release-on-milestone-closed.yml000064400000005272144760123310016171 0ustar00# Alternate workflow example. # This one is identical to the one in release-on-milestone.yml, with one change: # the Release step uses the ORGANIZATION_ADMIN_TOKEN instead, to allow it to # trigger a release workflow event. This is useful if you have other actions # that intercept that event. 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@v2" - name: "Release" uses: "laminas/automatic-releases@v1" with: command-name: "laminas:automatic-releases:release" 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: "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 }} CHANGELOG.md000064400000041153144760123310006362 0ustar00# Changelog All notable changes to this project will be documented in this file, in reverse chronological order by release. ## 1.2.1 - TBD ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 1.2.0 - 2021-02-25 ----- ### Release Notes for [1.2.0](https://github.com/laminas/laminas-zendframework-bridge/milestone/7) Feature release (minor) ## Added - Added Psalm support ## Removed - Dropped support for PHP prior 7.3 ### 1.2.0 - Total issues resolved: **1** - Total pull requests resolved: **2** - Total contributors: **3** #### Enhancement - [78: GitHub Actions & Psalm](https://github.com/laminas/laminas-zendframework-bridge/pull/78) thanks to @gsteel and @boesing #### Bug - [72: Merge release 1.1.1 into 1.2.x](https://github.com/laminas/laminas-zendframework-bridge/pull/72) thanks to @github-actions[bot] ## 1.1.1 - 2020-09-14 ### Fixed - [#71](https://github.com/laminas/laminas-zendframework-bridge/pull/71) fixes detection of the vendor directory when the `COMPOSER_VENDOR_DIR` env variable is missing or empty. Previously, this could lead to scenarios where a non-existent path was used for finding the bridge autoloader. ----- ### Release Notes for [1.1.1](https://github.com/laminas/laminas-zendframework-bridge/milestone/5) - Total issues resolved: **0** - Total pull requests resolved: **1** - Total contributors: **1** #### Bug - [71: Verify `COMPOSER_VENDOR_DIR` in conditional](https://github.com/laminas/laminas-zendframework-bridge/pull/71) thanks to @aaronbushnell ## 1.1.0 - 2020-08-18 ### Added - [#68](https://github.com/laminas/laminas-zendframework-bridge/pull/68) adds support for the upcoming PHP 8.0 release. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#67](https://github.com/laminas/laminas-zendframework-bridge/pull/67) fixes how the Composer autoload file is found, looking first in the `COMPOSER_VENDOR_DIR` before trying to resolve relative to where the package is installed. ## 1.0.4 - 2020-05-20 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#66](https://github.com/laminas/laminas-zendframework-bridge/pull/66) ensures that references to BjyAuthorize templates are not rewritten, so that they can be resolved during runtime. ## 1.0.3 - 2020-04-03 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#63](https://github.com/laminas/laminas-zendframework-bridge/pull/63) fixes handling of dependency configuration to ensure each of delegators, initializers, and abstract factories are properly handled during configuration post processing. The new approach should allow delegators to work post-migration to Laminas or Mezzio. - [#61](https://github.com/laminas/laminas-zendframework-bridge/pull/61) ensures configuration for delegator factories gets rewritten; the functionality broke in version 1.0.1. ## 1.0.2 - 2020-03-26 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#55](https://github.com/laminas/laminas-zendframework-bridge/pull/55) adds provisions to ensure that references to legacy classes/interfaces in dependency configuration always create aliases from the legacy to the new classes. Previously, we did straight replacements in the configuration, which could lead to the legacy service no longer being available. Now it will remain available. - [#59](https://github.com/laminas/laminas-zendframework-bridge/pull/59) fixes the replacement rules such as to avoid replacing references to API Skeletons packages, classes, or configuration keys. - [#57](https://github.com/laminas/laminas-zendframework-bridge/pull/57) fixes how references to the "zf-apigility" key are replaced. Previously, they were rewritten to "laminas-api-tools", but the correct replacement is "api-tools". - [#56](https://github.com/laminas/laminas-zendframework-bridge/pull/56) provides a mechanism to add additional maps with multiple levels of namespace separator escaping, in order to ensure that all various known permutations are matched. The escaping is applied to both the original and target, to ensure that rewrites conform to the original escaping. - [#56](https://github.com/laminas/laminas-zendframework-bridge/pull/56) makes changes to the replacement rules to ensure we do not replace references to "Zend" or "ZF" if they occur as subnamespaces OR as class names (formerly, we only enforced subnamespaces). Additional rules were provided for cases where one or both occur within our own packages. - [#52](https://github.com/laminas/laminas-zendframework-bridge/pull/52) fixes a scenario whereby factory _values_ were not being rewritten during configuration post processing. - [#52](https://github.com/laminas/laminas-zendframework-bridge/pull/52) fixes an issue that occurs with the configuration post processor. Previously, when a service name used as a factory or invokable was encountered that referenced a legacy class, it would get rewritten. This would cause issues if the service was not exposed in the original legacy package, however, as there would now be no alias of the legacy service to the new one. This patch modifies the configuration post processor such that it now tests to see if a service name it will rename exists as an alias; if not, it also creates the alias. ## 1.0.1 - 2020-01-07 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#47](https://github.com/laminas/laminas-zendframework-bridge/pull/47) adds entries for rewriting the various `::*Zend()` methods exposed in the psr7bridge to `::*Laminas()` during migrations. - [#46](https://github.com/laminas/laminas-zendframework-bridge/pull/46) adds a rule to rewrite the config key `use_zend_loader` to `use_laminas_loader`. - [#45](https://github.com/laminas/laminas-zendframework-bridge/pull/45) adds a rule to exclude rewriting of view paths provided by the various Doctrine modules targeting the developer tools. ## 1.0.0 - 2019-12-31 ### Added - First stable release. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.4.5 - 2019-12-23 ### Added - Nothing. ### Changed - [#42](https://github.com/laminas/laminas-zendframework-bridge/pull/42) modifies the replacement rules to no longer rewrite zf-deploy; the package will not be coming to the new organizations. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.4.4 - 2019-12-18 ### Added - Nothing. ### Changed - [#40](https://github.com/laminas/laminas-zendframework-bridge/pull/40) adds exclusion rules for subnamespaces that reference Zend, ZF, ZendService, or ZendOAuth to ensure they are not rewritten. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#40](https://github.com/laminas/laminas-zendframework-bridge/pull/40) adds exclusions for classes referencing Zend Server product features to ensure they are not rewritten (e.g., `ZendServerDisk`, `ZendServerShm`, `ZendMonitor`). ## 0.4.3 - 2019-12-17 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#39](https://github.com/laminas/laminas-zendframework-bridge/pull/39) fixes an issue when using the Auryn DI container. The class `Northwoods\Container\Zend\Config` was incorrectly being renamed to `Northwoods\Container\Laminas\Config` (which should not happen, as it is not a class under our control). ## 0.4.2 - 2019-12-16 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#36](https://github.com/laminas/laminas-zendframework-bridge/pull/36) adds some cases for classes that contain the verbiage "Expressive" and "Apigility" ot ensure they are rewritten correctly. ## 0.4.1 - 2019-12-10 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#35](https://github.com/laminas/laminas-zendframework-bridge/pull/35) removes zend-debug from the replacement list, as it is not being brought over to Laminas. ## 0.4.0 - 2019-11-27 ### Added - Nothing. ### Changed - [#32](https://github.com/laminas/laminas-zendframework-bridge/pull/32) changes all references to Expressive to instead reference Mezzio. - [#32](https://github.com/laminas/laminas-zendframework-bridge/pull/32) changes all references to Apigility to instead reference Laminas API Tools. The vendor becomes laminas-api-tools, the URL becomes api-tools.getlaminas.org, packages and repos are prefixed with api-tools, and namespaces become `Laminas\ApiTools`. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.3.8 - 2019-11-14 ### Added - [#29](https://github.com/laminas/laminas-zendframework-bridge/pull/29) adds entries to translate `ZendDeveloperTools` to `Laminas\DeveloperTools`, and vice-versa. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.3.7 - 2019-11-12 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#28](https://github.com/laminas/laminas-zendframework-bridge/pull/28) updates the `zenddevelopertools` string to rewrite to `laminas-developer-tools` instead of `laminasdevelopertools`. ## 0.3.6 - 2019-11-07 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#27](https://github.com/laminas/laminas-zendframework-bridge/pull/27) adds a rewrite rule for zend-framework.flf => laminas-project.flf. ## 0.3.5 - 2019-11-06 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#25](https://github.com/laminas/laminas-zendframework-bridge/pull/25) adds entries for ZendHttp and ZendModule, which are file name segments in files from the zend-feed and zend-config-aggregator-module packages, respectively. ## 0.3.4 - 2019-11-06 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#24](https://github.com/laminas/laminas-zendframework-bridge/pull/24) adds a rule to never rewrite the string `Doctrine\Zend`. - [#23](https://github.com/laminas/laminas-zendframework-bridge/pull/23) adds a missing map for each of ZendAcl and ZendRbac, which occur in the zend-expressive-authorization-acl and zend-expressive-authorization-rbac packages, respectively. ## 0.3.3 - 2019-11-06 ### Added - [#22](https://github.com/laminas/laminas-zendframework-bridge/pull/22) adds configuration post-processing features, exposed both as a laminas-config-aggregator post processor (for use with Expressive applications) and as a laminas-modulemanager `EVENT_MERGE_CONFIG` listener (for use with MVC applications). When registered, it will post-process the configuration, replacing known Zend Framework-specific strings with their Laminas replacements. A ruleset is provided that ensures dependency configuration is rewritten in a safe manner, routing configuration is skipped, and certain top-level configuration keys are matched exactly (instead of potentially as substrings or word stems). A later release of laminas-migration will auto-register these tools in applications when possible. ### Changed - [#22](https://github.com/laminas/laminas-zendframework-bridge/pull/22) removes support for PHP versions prior to PHP 5.6. We have decided to only support supported PHP versions, whether that support is via php.net or commercial. The lowest supported PHP version we have found is 5.6. Users wishing to migrate to Laminas must at least update to PHP 5.6 before doing so. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.3.2 - 2019-10-30 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) removes rewriting of the Amazon library, as it is not moving to Laminas. - [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) removes rewriting of the GCM and APNS libraries, as they are not moving to Laminas. ### Fixed - [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) fixes how the recaptcha and twitter library package and namespaces are rewritten. ## 0.3.1 - 2019-04-25 ### Added - [#20](https://github.com/laminas/laminas-zendframework-bridge/pull/20) provides an additional autoloader that is _prepended_ to the autoloader stack. This new autoloader will create class aliases for interfaces, classes, and traits referenced in type hints and class declarations, ensuring PHP is able to resolve them correctly during class_alias operations. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.3.0 - 2019-04-12 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - [#16](https://github.com/laminas/laminas-zendframework-bridge/pull/16) removes the `RewriteRules::classRewrite()` method, as it is no longer needed due to internal refactoring. ### Fixed - [#16](https://github.com/laminas/laminas-zendframework-bridge/pull/16) fixes how the rewrite rules detect the word `Zend` in subnamespaces and class names to be both more robust and simpler. ## 0.2.5 - 2019-04-11 ### Added - [#12](https://github.com/laminas/laminas-zendframework-bridge/pull/12) adds functionality for ensuring we alias namespaces and classes that include the word `Zend` in them; e.g., `Zend\Expressive\ZendView\ZendViewRendererFactory` will now alias to `Expressive\LaminasView\LaminasViewRendererFactory`. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.2.4 - 2019-04-11 ### Added - [#11](https://github.com/laminas/laminas-zendframework-bridge/pull/11) adds maps for the Expressive router adapter packages. - [#10](https://github.com/laminas/laminas-zendframework-bridge/pull/10) adds a map for the Psr7Bridge package, as it used `Zend` within a subnamespace. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.2.3 - 2019-04-10 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#9](https://github.com/laminas/laminas-zendframework-bridge/pull/9) fixes the mapping for the Problem Details package. ## 0.2.2 - 2019-04-10 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Added a check that the discovered alias exists as a class, interface, or trait before attempting to call `class_alias()`. ## 0.2.1 - 2019-04-10 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#8](https://github.com/laminas/laminas-zendframework-bridge/pull/8) fixes mappings for each of zend-expressive-authentication-zendauthentication, zend-expressive-zendrouter, and zend-expressive-zendviewrenderer. ## 0.2.0 - 2019-04-01 ### Added - Nothing. ### Changed - [#4](https://github.com/laminas/laminas-zendframework-bridge/pull/4) rewrites the autoloader to be class-based, via the class `Laminas\ZendFrameworkBridge\Autoloader`. Additionally, the new approach provides a performance boost by using a balanced tree algorithm, ensuring matches occur faster. ### Deprecated - Nothing. ### Removed - [#4](https://github.com/laminas/laminas-zendframework-bridge/pull/4) removes function aliasing. Function aliasing will move to the packages that provide functions. ### Fixed - Nothing. ## 0.1.0 - 2019-03-27 ### Added - Adds an autoloader file that registers with `spl_autoload_register` a routine for aliasing legacy ZF class/interface/trait names to Laminas Project equivalents. - Adds autoloader files for aliasing legacy ZF package functions to Laminas Project equivalents. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing.COPYRIGHT.md000064400000000133144760123310006434 0ustar00Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/) LICENSE.md000064400000002732144760123310006155 0ustar00Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Laminas Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. README.md000064400000001751144760123310006030 0ustar00# laminas-zendframework-bridge [![Build Status](https://github.com/laminas/laminas-zendframework-bridge/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-zendframework-bridge/actions?query=workflow%3A"Continuous+Integration") This library provides a custom autoloader that aliases legacy Zend Framework, Apigility, and Expressive classes to their replacements under the Laminas Project. This package should be installed only if you are also using the composer plugin that installs Laminas packages to replace ZF/Apigility/Expressive packages. This tool supports: * Zend Framework MVC projects, all v2 and v3 releases * Apigility projects, all stable versions * Expressive versions, all stable versions ## Installation Run the following to install this library: ```bash $ composer require laminas/laminas-zendframework-bridge ``` ## Support * [Issues](https://github.com/laminas/laminas-zendframework-bridge/issues/) * [Forum](https://discourse.laminas.dev/) composer.json000064400000003537144760123310007277 0ustar00{ "name": "laminas/laminas-zendframework-bridge", "description": "Alias legacy ZF class names to Laminas Project equivalents.", "license": "BSD-3-Clause", "keywords": [ "autoloading", "laminas", "zf", "zendframework" ], "support": { "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", "source": "https://github.com/laminas/laminas-zendframework-bridge", "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", "forum": "https://discourse.laminas.dev/" }, "require": { "php": "^7.3 || ^8.0" }, "require-dev": { "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1 || ^9.3", "psalm/plugin-phpunit": "^0.15.1", "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "^4.6" }, "autoload": { "files": [ "src/autoload.php" ], "psr-4": { "Laminas\\ZendFrameworkBridge\\": "src//" } }, "autoload-dev": { "files": [ "test/classes.php" ], "psr-4": { "LaminasTest\\ZendFrameworkBridge\\": "test/", "LaminasTest\\ZendFrameworkBridge\\TestAsset\\": "test/TestAsset/classes/", "Laminas\\ApiTools\\": "test/TestAsset/LaminasApiTools/", "Mezzio\\": "test/TestAsset/Mezzio/", "Laminas\\": "test/TestAsset/Laminas/" } }, "extra": { "laminas": { "module": "Laminas\\ZendFrameworkBridge" } }, "config": { "sort-packages": true }, "scripts": { "cs-check": "phpcs", "cs-fix": "phpcbf", "static-analysis": "psalm --shepherd --stats", "test": "phpunit --colors=always", "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" } } config/replacements.php000064400000042612144760123310011212 0ustar00 'zendframework/zendframework', 'zend-developer-tools/toolbar/bjy' => 'zend-developer-tools/toolbar/bjy', 'zend-developer-tools/toolbar/doctrine' => 'zend-developer-tools/toolbar/doctrine', // NAMESPACES // Zend Framework components 'Zend\\AuraDi\\Config' => 'Laminas\\AuraDi\\Config', 'Zend\\Authentication' => 'Laminas\\Authentication', 'Zend\\Barcode' => 'Laminas\\Barcode', 'Zend\\Cache' => 'Laminas\\Cache', 'Zend\\Captcha' => 'Laminas\\Captcha', 'Zend\\Code' => 'Laminas\\Code', 'ZendCodingStandard\\Sniffs' => 'LaminasCodingStandard\\Sniffs', 'ZendCodingStandard\\Utils' => 'LaminasCodingStandard\\Utils', 'Zend\\ComponentInstaller' => 'Laminas\\ComponentInstaller', 'Zend\\Config' => 'Laminas\\Config', 'Zend\\ConfigAggregator' => 'Laminas\\ConfigAggregator', 'Zend\\ConfigAggregatorModuleManager' => 'Laminas\\ConfigAggregatorModuleManager', 'Zend\\ConfigAggregatorParameters' => 'Laminas\\ConfigAggregatorParameters', 'Zend\\Console' => 'Laminas\\Console', 'Zend\\ContainerConfigTest' => 'Laminas\\ContainerConfigTest', 'Zend\\Crypt' => 'Laminas\\Crypt', 'Zend\\Db' => 'Laminas\\Db', 'ZendDeveloperTools' => 'Laminas\\DeveloperTools', 'Zend\\Di' => 'Laminas\\Di', 'Zend\\Diactoros' => 'Laminas\\Diactoros', 'ZendDiagnostics\\Check' => 'Laminas\\Diagnostics\\Check', 'ZendDiagnostics\\Result' => 'Laminas\\Diagnostics\\Result', 'ZendDiagnostics\\Runner' => 'Laminas\\Diagnostics\\Runner', 'Zend\\Dom' => 'Laminas\\Dom', 'Zend\\Escaper' => 'Laminas\\Escaper', 'Zend\\EventManager' => 'Laminas\\EventManager', 'Zend\\Feed' => 'Laminas\\Feed', 'Zend\\File' => 'Laminas\\File', 'Zend\\Filter' => 'Laminas\\Filter', 'Zend\\Form' => 'Laminas\\Form', 'Zend\\Http' => 'Laminas\\Http', 'Zend\\HttpHandlerRunner' => 'Laminas\\HttpHandlerRunner', 'Zend\\Hydrator' => 'Laminas\\Hydrator', 'Zend\\I18n' => 'Laminas\\I18n', 'Zend\\InputFilter' => 'Laminas\\InputFilter', 'Zend\\Json' => 'Laminas\\Json', 'Zend\\Ldap' => 'Laminas\\Ldap', 'Zend\\Loader' => 'Laminas\\Loader', 'Zend\\Log' => 'Laminas\\Log', 'Zend\\Mail' => 'Laminas\\Mail', 'Zend\\Math' => 'Laminas\\Math', 'Zend\\Memory' => 'Laminas\\Memory', 'Zend\\Mime' => 'Laminas\\Mime', 'Zend\\ModuleManager' => 'Laminas\\ModuleManager', 'Zend\\Mvc' => 'Laminas\\Mvc', 'Zend\\Navigation' => 'Laminas\\Navigation', 'Zend\\Paginator' => 'Laminas\\Paginator', 'Zend\\Permissions' => 'Laminas\\Permissions', 'Zend\\Pimple\\Config' => 'Laminas\\Pimple\\Config', 'Zend\\ProblemDetails' => 'Mezzio\\ProblemDetails', 'Zend\\ProgressBar' => 'Laminas\\ProgressBar', 'Zend\\Psr7Bridge' => 'Laminas\\Psr7Bridge', 'Zend\\Router' => 'Laminas\\Router', 'Zend\\Serializer' => 'Laminas\\Serializer', 'Zend\\Server' => 'Laminas\\Server', 'Zend\\ServiceManager' => 'Laminas\\ServiceManager', 'ZendService\\ReCaptcha' => 'Laminas\\ReCaptcha', 'ZendService\\Twitter' => 'Laminas\\Twitter', 'Zend\\Session' => 'Laminas\\Session', 'Zend\\SkeletonInstaller' => 'Laminas\\SkeletonInstaller', 'Zend\\Soap' => 'Laminas\\Soap', 'Zend\\Stdlib' => 'Laminas\\Stdlib', 'Zend\\Stratigility' => 'Laminas\\Stratigility', 'Zend\\Tag' => 'Laminas\\Tag', 'Zend\\Test' => 'Laminas\\Test', 'Zend\\Text' => 'Laminas\\Text', 'Zend\\Uri' => 'Laminas\\Uri', 'Zend\\Validator' => 'Laminas\\Validator', 'Zend\\View' => 'Laminas\\View', 'ZendXml' => 'Laminas\\Xml', 'Zend\\Xml2Json' => 'Laminas\\Xml2Json', 'Zend\\XmlRpc' => 'Laminas\\XmlRpc', 'ZendOAuth' => 'Laminas\\OAuth', // class ZendAcl in zend-expressive-authorization-acl 'ZendAcl' => 'LaminasAcl', 'Zend\\Expressive\\Authorization\\Acl\\ZendAcl' => 'Mezzio\\Authorization\\Acl\\LaminasAcl', // class ZendHttpClientDecorator in zend-feed 'ZendHttp' => 'LaminasHttp', // class ZendModuleProvider in zend-config-aggregator-modulemanager 'ZendModule' => 'LaminasModule', // class ZendRbac in zend-expressive-authorization-rbac 'ZendRbac' => 'LaminasRbac', 'Zend\\Expressive\\Authorization\\Rbac\\ZendRbac' => 'Mezzio\\Authorization\\Rbac\\LaminasRbac', // class ZendRouter in zend-expressive-router-zendrouter 'ZendRouter' => 'LaminasRouter', 'Zend\\Expressive\\Router\\ZendRouter' => 'Mezzio\\Router\\LaminasRouter', // class ZendViewRenderer in zend-expressive-zendviewrenderer 'ZendViewRenderer' => 'LaminasViewRenderer', 'Zend\\Expressive\\ZendView\\ZendViewRenderer' => 'Mezzio\\LaminasView\\LaminasViewRenderer', 'a\\Zend' => 'a\\Zend', 'b\\Zend' => 'b\\Zend', 'c\\Zend' => 'c\\Zend', 'd\\Zend' => 'd\\Zend', 'e\\Zend' => 'e\\Zend', 'f\\Zend' => 'f\\Zend', 'g\\Zend' => 'g\\Zend', 'h\\Zend' => 'h\\Zend', 'i\\Zend' => 'i\\Zend', 'j\\Zend' => 'j\\Zend', 'k\\Zend' => 'k\\Zend', 'l\\Zend' => 'l\\Zend', 'm\\Zend' => 'm\\Zend', 'n\\Zend' => 'n\\Zend', 'o\\Zend' => 'o\\Zend', 'p\\Zend' => 'p\\Zend', 'q\\Zend' => 'q\\Zend', 'r\\Zend' => 'r\\Zend', 's\\Zend' => 's\\Zend', 't\\Zend' => 't\\Zend', 'u\\Zend' => 'u\\Zend', 'v\\Zend' => 'v\\Zend', 'w\\Zend' => 'w\\Zend', 'x\\Zend' => 'x\\Zend', 'y\\Zend' => 'y\\Zend', 'z\\Zend' => 'z\\Zend', // Expressive 'Zend\\Expressive' => 'Mezzio', 'ZendAuthentication' => 'LaminasAuthentication', 'ZendAcl' => 'LaminasAcl', 'ZendRbac' => 'LaminasRbac', 'ZendRouter' => 'LaminasRouter', 'ExpressiveUrlGenerator' => 'MezzioUrlGenerator', 'ExpressiveInstaller' => 'MezzioInstaller', // Apigility 'ZF\\Apigility' => 'Laminas\\ApiTools', 'ZF\\ApiProblem' => 'Laminas\\ApiTools\\ApiProblem', 'ZF\\AssetManager' => 'Laminas\\ApiTools\\AssetManager', 'ZF\\ComposerAutoloading' => 'Laminas\\ComposerAutoloading', 'ZF\\Configuration' => 'Laminas\\ApiTools\\Configuration', 'ZF\\ContentNegotiation' => 'Laminas\\ApiTools\\ContentNegotiation', 'ZF\\ContentValidation' => 'Laminas\\ApiTools\\ContentValidation', 'ZF\\DevelopmentMode' => 'Laminas\\DevelopmentMode', 'ZF\\Doctrine\\QueryBuilder' => 'Laminas\\ApiTools\\Doctrine\\QueryBuilder', 'ZF\\Hal' => 'Laminas\\ApiTools\\Hal', 'ZF\\HttpCache' => 'Laminas\\ApiTools\\HttpCache', 'ZF\\MvcAuth' => 'Laminas\\ApiTools\\MvcAuth', 'ZF\\OAuth2' => 'Laminas\\ApiTools\\OAuth2', 'ZF\\Rest' => 'Laminas\\ApiTools\\Rest', 'ZF\\Rpc' => 'Laminas\\ApiTools\\Rpc', 'ZF\\Versioning' => 'Laminas\\ApiTools\\Versioning', 'a\\ZF' => 'a\\ZF', 'b\\ZF' => 'b\\ZF', 'c\\ZF' => 'c\\ZF', 'd\\ZF' => 'd\\ZF', 'e\\ZF' => 'e\\ZF', 'f\\ZF' => 'f\\ZF', 'g\\ZF' => 'g\\ZF', 'h\\ZF' => 'h\\ZF', 'i\\ZF' => 'i\\ZF', 'j\\ZF' => 'j\\ZF', 'k\\ZF' => 'k\\ZF', 'l\\ZF' => 'l\\ZF', 'm\\ZF' => 'm\\ZF', 'n\\ZF' => 'n\\ZF', 'o\\ZF' => 'o\\ZF', 'p\\ZF' => 'p\\ZF', 'q\\ZF' => 'q\\ZF', 'r\\ZF' => 'r\\ZF', 's\\ZF' => 's\\ZF', 't\\ZF' => 't\\ZF', 'u\\ZF' => 'u\\ZF', 'v\\ZF' => 'v\\ZF', 'w\\ZF' => 'w\\ZF', 'x\\ZF' => 'x\\ZF', 'y\\ZF' => 'y\\ZF', 'z\\ZF' => 'z\\ZF', 'ApigilityModuleInterface' => 'ApiToolsModuleInterface', 'ApigilityProviderInterface' => 'ApiToolsProviderInterface', 'ApigilityVersionController' => 'ApiToolsVersionController', // PACKAGES // ZF components, MVC 'zendframework/skeleton-application' => 'laminas/skeleton-application', 'zendframework/zend-auradi-config' => 'laminas/laminas-auradi-config', 'zendframework/zend-authentication' => 'laminas/laminas-authentication', 'zendframework/zend-barcode' => 'laminas/laminas-barcode', 'zendframework/zend-cache' => 'laminas/laminas-cache', 'zendframework/zend-captcha' => 'laminas/laminas-captcha', 'zendframework/zend-code' => 'laminas/laminas-code', 'zendframework/zend-coding-standard' => 'laminas/laminas-coding-standard', 'zendframework/zend-component-installer' => 'laminas/laminas-component-installer', 'zendframework/zend-composer-autoloading' => 'laminas/laminas-composer-autoloading', 'zendframework/zend-config-aggregator' => 'laminas/laminas-config-aggregator', 'zendframework/zend-config' => 'laminas/laminas-config', 'zendframework/zend-console' => 'laminas/laminas-console', 'zendframework/zend-container-config-test' => 'laminas/laminas-container-config-test', 'zendframework/zend-crypt' => 'laminas/laminas-crypt', 'zendframework/zend-db' => 'laminas/laminas-db', 'zendframework/zend-developer-tools' => 'laminas/laminas-developer-tools', 'zendframework/zend-diactoros' => 'laminas/laminas-diactoros', 'zendframework/zenddiagnostics' => 'laminas/laminas-diagnostics', 'zendframework/zend-di' => 'laminas/laminas-di', 'zendframework/zend-dom' => 'laminas/laminas-dom', 'zendframework/zend-escaper' => 'laminas/laminas-escaper', 'zendframework/zend-eventmanager' => 'laminas/laminas-eventmanager', 'zendframework/zend-feed' => 'laminas/laminas-feed', 'zendframework/zend-file' => 'laminas/laminas-file', 'zendframework/zend-filter' => 'laminas/laminas-filter', 'zendframework/zend-form' => 'laminas/laminas-form', 'zendframework/zend-httphandlerrunner' => 'laminas/laminas-httphandlerrunner', 'zendframework/zend-http' => 'laminas/laminas-http', 'zendframework/zend-hydrator' => 'laminas/laminas-hydrator', 'zendframework/zend-i18n' => 'laminas/laminas-i18n', 'zendframework/zend-i18n-resources' => 'laminas/laminas-i18n-resources', 'zendframework/zend-inputfilter' => 'laminas/laminas-inputfilter', 'zendframework/zend-json' => 'laminas/laminas-json', 'zendframework/zend-json-server' => 'laminas/laminas-json-server', 'zendframework/zend-ldap' => 'laminas/laminas-ldap', 'zendframework/zend-loader' => 'laminas/laminas-loader', 'zendframework/zend-log' => 'laminas/laminas-log', 'zendframework/zend-mail' => 'laminas/laminas-mail', 'zendframework/zend-math' => 'laminas/laminas-math', 'zendframework/zend-memory' => 'laminas/laminas-memory', 'zendframework/zend-mime' => 'laminas/laminas-mime', 'zendframework/zend-modulemanager' => 'laminas/laminas-modulemanager', 'zendframework/zend-mvc' => 'laminas/laminas-mvc', 'zendframework/zend-navigation' => 'laminas/laminas-navigation', 'zendframework/zend-oauth' => 'laminas/laminas-oauth', 'zendframework/zend-paginator' => 'laminas/laminas-paginator', 'zendframework/zend-permissions-acl' => 'laminas/laminas-permissions-acl', 'zendframework/zend-permissions-rbac' => 'laminas/laminas-permissions-rbac', 'zendframework/zend-pimple-config' => 'laminas/laminas-pimple-config', 'zendframework/zend-progressbar' => 'laminas/laminas-progressbar', 'zendframework/zend-psr7bridge' => 'laminas/laminas-psr7bridge', 'zendframework/zend-recaptcha' => 'laminas/laminas-recaptcha', 'zendframework/zend-router' => 'laminas/laminas-router', 'zendframework/zend-serializer' => 'laminas/laminas-serializer', 'zendframework/zend-server' => 'laminas/laminas-server', 'zendframework/zend-servicemanager' => 'laminas/laminas-servicemanager', 'zendframework/zendservice-recaptcha' => 'laminas/laminas-recaptcha', 'zendframework/zendservice-twitter' => 'laminas/laminas-twitter', 'zendframework/zend-session' => 'laminas/laminas-session', 'zendframework/zend-skeleton-installer' => 'laminas/laminas-skeleton-installer', 'zendframework/zend-soap' => 'laminas/laminas-soap', 'zendframework/zend-stdlib' => 'laminas/laminas-stdlib', 'zendframework/zend-stratigility' => 'laminas/laminas-stratigility', 'zendframework/zend-tag' => 'laminas/laminas-tag', 'zendframework/zend-test' => 'laminas/laminas-test', 'zendframework/zend-text' => 'laminas/laminas-text', 'zendframework/zend-uri' => 'laminas/laminas-uri', 'zendframework/zend-validator' => 'laminas/laminas-validator', 'zendframework/zend-view' => 'laminas/laminas-view', 'zendframework/zend-xml2json' => 'laminas/laminas-xml2json', 'zendframework/zend-xml' => 'laminas/laminas-xml', 'zendframework/zend-xmlrpc' => 'laminas/laminas-xmlrpc', // Expressive packages 'zendframework/zend-expressive' => 'mezzio/mezzio', 'zendframework/zend-expressive-zendrouter' => 'mezzio/mezzio-laminasrouter', 'zendframework/zend-problem-details' => 'mezzio/mezzio-problem-details', 'zendframework/zend-expressive-zendviewrenderer' => 'mezzio/mezzio-laminasviewrenderer', // Apigility packages 'zfcampus/apigility-documentation' => 'laminas-api-tools/documentation', 'zfcampus/statuslib-example' => 'laminas-api-tools/statuslib-example', 'zfcampus/zf-apigility' => 'laminas-api-tools/api-tools', 'zfcampus/zf-api-problem' => 'laminas-api-tools/api-tools-api-problem', 'zfcampus/zf-asset-manager' => 'laminas-api-tools/api-tools-asset-manager', 'zfcampus/zf-configuration' => 'laminas-api-tools/api-tools-configuration', 'zfcampus/zf-content-negotiation' => 'laminas-api-tools/api-tools-content-negotiation', 'zfcampus/zf-content-validation' => 'laminas-api-tools/api-tools-content-validation', 'zfcampus/zf-development-mode' => 'laminas/laminas-development-mode', 'zfcampus/zf-doctrine-querybuilder' => 'laminas-api-tools/api-tools-doctrine-querybuilder', 'zfcampus/zf-hal' => 'laminas-api-tools/api-tools-hal', 'zfcampus/zf-http-cache' => 'laminas-api-tools/api-tools-http-cache', 'zfcampus/zf-mvc-auth' => 'laminas-api-tools/api-tools-mvc-auth', 'zfcampus/zf-oauth2' => 'laminas-api-tools/api-tools-oauth2', 'zfcampus/zf-rest' => 'laminas-api-tools/api-tools-rest', 'zfcampus/zf-rpc' => 'laminas-api-tools/api-tools-rpc', 'zfcampus/zf-versioning' => 'laminas-api-tools/api-tools-versioning', // CONFIG KEYS, SCRIPT NAMES, ETC // ZF components '::fromZend' => '::fromLaminas', // psr7bridge '::toZend' => '::toLaminas', // psr7bridge 'use_zend_loader' => 'use_laminas_loader', // zend-modulemanager 'zend-config' => 'laminas-config', 'zend-developer-tools/' => 'laminas-developer-tools/', 'zend-tag-cloud' => 'laminas-tag-cloud', 'zenddevelopertools' => 'laminas-developer-tools', 'zendbarcode' => 'laminasbarcode', 'ZendBarcode' => 'LaminasBarcode', 'zendcache' => 'laminascache', 'ZendCache' => 'LaminasCache', 'zendconfig' => 'laminasconfig', 'ZendConfig' => 'LaminasConfig', 'zendfeed' => 'laminasfeed', 'ZendFeed' => 'LaminasFeed', 'zendfilter' => 'laminasfilter', 'ZendFilter' => 'LaminasFilter', 'zendform' => 'laminasform', 'ZendForm' => 'LaminasForm', 'zendi18n' => 'laminasi18n', 'ZendI18n' => 'LaminasI18n', 'zendinputfilter' => 'laminasinputfilter', 'ZendInputFilter' => 'LaminasInputFilter', 'zendlog' => 'laminaslog', 'ZendLog' => 'LaminasLog', 'zendmail' => 'laminasmail', 'ZendMail' => 'LaminasMail', 'zendmvc' => 'laminasmvc', 'ZendMvc' => 'LaminasMvc', 'zendpaginator' => 'laminaspaginator', 'ZendPaginator' => 'LaminasPaginator', 'zendserializer' => 'laminasserializer', 'ZendSerializer' => 'LaminasSerializer', 'zendtag' => 'laminastag', 'ZendTag' => 'LaminasTag', 'zendtext' => 'laminastext', 'ZendText' => 'LaminasText', 'zendvalidator' => 'laminasvalidator', 'ZendValidator' => 'LaminasValidator', 'zendview' => 'laminasview', 'ZendView' => 'LaminasView', 'zend-framework.flf' => 'laminas-project.flf', // Expressive-related "'zend-expressive'" => "'mezzio'", '"zend-expressive"' => '"mezzio"', 'zend-expressive.' => 'mezzio.', 'zend-expressive-authorization' => 'mezzio-authorization', 'zend-expressive-hal' => 'mezzio-hal', 'zend-expressive-session' => 'mezzio-session', 'zend-expressive-swoole' => 'mezzio-swoole', 'zend-expressive-tooling' => 'mezzio-tooling', // Apigility-related "'zf-apigility'" => "'api-tools'", '"zf-apigility"' => '"api-tools"', 'zf-apigility/' => 'api-tools/', 'zf-apigility-admin' => 'api-tools-admin', 'zf-content-negotiation' => 'api-tools-content-negotiation', 'zf-hal' => 'api-tools-hal', 'zf-rest' => 'api-tools-rest', 'zf-rpc' => 'api-tools-rpc', 'zf-content-validation' => 'api-tools-content-validation', 'zf-apigility-ui' => 'api-tools-ui', 'zf-apigility-documentation-blueprint' => 'api-tools-documentation-blueprint', 'zf-apigility-documentation-swagger' => 'api-tools-documentation-swagger', 'zf-apigility-welcome' => 'api-tools-welcome', 'zf-api-problem' => 'api-tools-api-problem', 'zf-configuration' => 'api-tools-configuration', 'zf-http-cache' => 'api-tools-http-cache', 'zf-mvc-auth' => 'api-tools-mvc-auth', 'zf-oauth2' => 'api-tools-oauth2', 'zf-versioning' => 'api-tools-versioning', 'ZfApigilityDoctrineQueryProviderManager' => 'LaminasApiToolsDoctrineQueryProviderManager', 'ZfApigilityDoctrineQueryCreateFilterManager' => 'LaminasApiToolsDoctrineQueryCreateFilterManager', 'zf-apigility-doctrine' => 'api-tools-doctrine', 'zf-development-mode' => 'laminas-development-mode', 'zf-doctrine-querybuilder' => 'api-tools-doctrine-querybuilder', // 3rd party Apigility packages 'api-skeletons/zf-' => 'api-skeletons/zf-', // api-skeletons packages 'zf-oauth2-' => 'zf-oauth2-', // api-skeletons OAuth2-related packages 'ZF\\OAuth2\\Client' => 'ZF\\OAuth2\\Client', // api-skeletons/zf-oauth2-client 'ZF\\OAuth2\\Doctrine' => 'ZF\\OAuth2\\Doctrine', // api-skeletons/zf-oauth2-doctrine ]; psalm-baseline.xml000064400000033555144760123310010176 0ustar00 'ZendAcl' => 'LaminasAcl' 'ZendRbac' => 'LaminasRbac' 'ZendRouter' => 'LaminasRouter' $class $class include __DIR__ . '/../../../autoload.php' load $class $class $class $class $class $class $class $loaded[$class] ClassLoader $namespaces[$check] $namespaces[$check] include __DIR__ . '/../../../autoload.php' include __DIR__ . '/../vendor/autoload.php' include getenv('COMPOSER_VENDOR_DIR') . '/autoload.php' getenv('COMPOSER_VENDOR_DIR') getenv('COMPOSER_VENDOR_DIR') include getenv('COMPOSER_VENDOR_DIR') . '/autoload.php' $keys $value $value $value $value function ($value) { function ($value) { function ($value, array $keys) { function ($value, array $keys) { replaceDependencyConfiguration replaceDependencyFactories replaceDependencyServices $config $newKey $newKey $newKey $target [$key] $config[$key] $config['aliases'][$alias] $config['aliases'][$service] $config['aliases'][$service] $aliases[$name] $config[$key] $keys[$key] $rewritten[$newKey] $rewritten[$newKey] $rewritten[$newKey] $this->exactReplacements[$value] $aliases[$name] $a[$key] $a[$key] $a[] $config $config $config[$key] $config['factories'][$replacedService] $config['services'][$replacedService] $data $factory $factory $key $key $name $newKey $newValue $notIn[] $result $rewritten[$key] $rewritten[$newKey] $rewritten[$newKey][] $serviceInstance $serviceInstance $target $value $value init onMergeConfig ModuleEvent ModuleManager $replacement $replacement $original $original $original $replacement $this->replacements $this->replacements new $legacy() testLegacyClassIsAliasToLaminas testReverseAliasCreated testTypeHint testLegacyClassIsAliasToLaminas self::assertSame($actual, get_class(new $legacy())) self::assertTrue($isInterface ? interface_exists($legacy) : class_exists($legacy)) self::assertTrue(class_exists($actual)) self::assertTrue(class_exists($legacy)) self::assertTrue(class_exists('Laminas\LegacyTypeHint')) invalidServiceManagerConfiguration testRewritesNestedKeys testServiceManagerServiceInstancesCanBeHandled testWillSkipInvalidConfigurations $config $config $expected iterable $this->assertSame($expected, $processor($config)) self::assertSame($config, $processor($config)) self::assertSame($expected, $processor($config)) require $configLocation require $expectedResultLocation $event $moduleManager testInitRegistersListenerWithEventManager testOnMergeConfigProcessesAndReplacesConfigurationPulledFromListener $config $config $expected iterable $this->assertNull($module->onMergeConfig($event)) $this->assertSame($expected, $listener->getMergedConfig()) require $configFile require $expectationsFile testEdgeCases iterable $this->assertSame($expected, $replacements->replace($string)) ConfigAbstractFactory ConfigAbstractFactory InvokableFactory InvokableFactory 'Zend\Db\Adapter\Adapter' => 'ZF\Apigility\DbConnectedAdapter' Factory\SlimRouterFactory RouterInterface LazyServiceFactory CacheItemPoolInterface ConfigFactory ConfigFactory ConfigFactory ConfigFactory ConfigFactory ConfigFactory Csp DisplayPostHandler Engine EventDispatcherInterface Factory\CachePoolFactory Factory\EventDispatcherFactory Factory\MailTransport Factory\PlatesFunctionsDelegator FeedReaderHttpClientInterface Feed\HttpPlugClientFactory Handler\ComicsPageHandler Handler\ComicsPageHandlerFactory Handler\HomePageHandler Handler\HomePageHandlerFactory Handler\PageHandlerFactory Handler\PageHandlerFactory Handler\ResumePageHandler Handler\ResumePageHandler Middleware\ContentSecurityPolicyMiddlewareFactory Middleware\DisplayBlogPostHandlerDelegator Middleware\RedirectAmpPagesMiddleware Middleware\RedirectAmpPagesMiddlewareFactory Middleware\RedirectsMiddleware Middleware\RedirectsMiddleware Middleware\XClacksOverheadMiddleware Middleware\XClacksOverheadMiddleware Middleware\XPoweredByMiddleware Middleware\XPoweredByMiddleware RequestFactory RequestFactoryInterface ResponseFactory ResponseFactoryInterface SessionCachePool SessionCachePool SessionCachePoolFactory \Zend\Expressive\Router OAuth2Client setMergedConfig $listener $listeners attach $this->listeners[$eventName] $this->listeners[$eventName] $this->listeners[$eventName] array $this->listeners $listener ConfigListener $this->listener EventManager $this->eventManager $this->eventManager $this->eventManager psalm.xml.dist000064400000002260144760123310007345 0ustar00 src/Autoloader.php000064400000011746144760123310010155 0ustar00loadClass($class)) { $legacy = $namespaces[$check] . strtr(substr($class, strlen($check)), [ 'ApiTools' => 'Apigility', 'Mezzio' => 'Expressive', 'Laminas' => 'Zend', ]); class_alias($class, $legacy); } }; } /** * @return callable */ private static function createAppendAutoloader(array $namespaces, ArrayObject $loaded) { /** * @param string $class Class name to autoload * @return void */ return static function ($class) use ($namespaces, $loaded) { $segments = explode('\\', $class); if ($segments[0] === 'ZendService' && isset($segments[1])) { $segments[0] .= '\\' . $segments[1]; unset($segments[1]); $segments = array_values($segments); } $i = 0; $check = ''; // We are checking segments of the namespace to match quicker while (isset($segments[$i + 1], $namespaces[$check . $segments[$i] . '\\'])) { $check .= $segments[$i] . '\\'; ++$i; } if ($check === '') { return; } $alias = $namespaces[$check] . strtr(substr($class, strlen($check)), [ 'Apigility' => 'ApiTools', 'Expressive' => 'Mezzio', 'Zend' => 'Laminas', 'AbstractZendServer' => 'AbstractZendServer', 'ZendServerDisk' => 'ZendServerDisk', 'ZendServerShm' => 'ZendServerShm', 'ZendMonitor' => 'ZendMonitor', ]); $loaded[$alias] = true; if (class_exists($alias) || interface_exists($alias) || trait_exists($alias)) { class_alias($alias, $class); } }; } } src/ConfigPostProcessor.php000064400000031001144760123310012013 0ustar00 true, 'factories' => true, 'invokables' => true, 'services' => true, ]; /** @var array String keys => string values */ private $exactReplacements = [ 'zend-expressive' => 'mezzio', 'zf-apigility' => 'api-tools', ]; /** @var Replacements */ private $replacements; /** @var callable[] */ private $rulesets; public function __construct() { $this->replacements = new Replacements(); /* Define the rulesets for replacements. * * Each ruleset has the following signature: * * @param mixed $value * @param string[] $keys Full nested key hierarchy leading to the value * @return null|callable * * If no match is made, a null is returned, allowing it to fallback to * the next ruleset in the list. If a match is made, a callback is returned, * and that will be used to perform the replacement on the value. * * The callback should have the following signature: * * @param mixed $value * @param string[] $keys * @return mixed The transformed value */ $this->rulesets = [ // Exact values function ($value) { return is_string($value) && isset($this->exactReplacements[$value]) ? [$this, 'replaceExactValue'] : null; }, // Router (MVC applications) // We do not want to rewrite these. function ($value, array $keys) { $key = array_pop($keys); // Only worried about a top-level "router" key. return $key === 'router' && $keys === [] && is_array($value) ? [$this, 'noopReplacement'] : null; }, // service- and pluginmanager handling function ($value) { return is_array($value) && array_intersect_key(self::SERVICE_MANAGER_KEYS_OF_INTEREST, $value) !== [] ? [$this, 'replaceDependencyConfiguration'] : null; }, // Array values function ($value, array $keys) { return $keys !== [] && is_array($value) ? [$this, '__invoke'] : null; }, ]; } /** * @param string[] $keys Hierarchy of keys, for determining location in * nested configuration. * @return array */ public function __invoke(array $config, array $keys = []) { $rewritten = []; foreach ($config as $key => $value) { // Determine new key from replacements $newKey = is_string($key) ? $this->replace($key, $keys) : $key; // Keep original values with original key, if the key has changed, but only at the top-level. if (empty($keys) && $newKey !== $key) { $rewritten[$key] = $value; } // Perform value replacements, if any $newValue = $this->replace($value, $keys, $newKey); // Key does not already exist and/or is not an array value if (! array_key_exists($newKey, $rewritten) || ! is_array($rewritten[$newKey])) { // Do not overwrite existing values with null values $rewritten[$newKey] = array_key_exists($newKey, $rewritten) && null === $newValue ? $rewritten[$newKey] : $newValue; continue; } // New value is null; nothing to do. if (null === $newValue) { continue; } // Key already exists as an array value, but $value is not an array if (! is_array($newValue)) { $rewritten[$newKey][] = $newValue; continue; } // Key already exists as an array value, and $value is also an array $rewritten[$newKey] = static::merge($rewritten[$newKey], $newValue); } return $rewritten; } /** * Perform substitutions as needed on an individual value. * * The $key is provided to allow fine-grained selection of rewrite rules. * * @param mixed $value * @param string[] $keys Key hierarchy * @param null|int|string $key * @return mixed */ private function replace($value, array $keys, $key = null) { // Add new key to the list of keys. // We do not need to remove it later, as we are working on a copy of the array. $keys[] = $key; // Identify rewrite strategy and perform replacements $rewriteRule = $this->replacementRuleMatch($value, $keys); return $rewriteRule($value, $keys); } /** * Merge two arrays together. * * If an integer key exists in both arrays, the value from the second array * will be appended to the first array. If both values are arrays, they are * merged together, else the value of the second array overwrites the one * of the first array. * * Based on zend-stdlib Zend\Stdlib\ArrayUtils::merge * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * * @return array */ public static function merge(array $a, array $b) { foreach ($b as $key => $value) { if (! isset($a[$key]) && ! array_key_exists($key, $a)) { $a[$key] = $value; continue; } if (null === $value && array_key_exists($key, $a)) { // Leave as-is if value from $b is null continue; } if (is_int($key)) { $a[] = $value; continue; } if (is_array($value) && is_array($a[$key])) { $a[$key] = static::merge($a[$key], $value); continue; } $a[$key] = $value; } return $a; } /** * @param mixed $value * @param null|int|string $key * @return callable Callable to invoke with value */ private function replacementRuleMatch($value, $key = null) { foreach ($this->rulesets as $ruleset) { $result = $ruleset($value, $key); if (is_callable($result)) { return $result; } } return [$this, 'fallbackReplacement']; } /** * Replace a value using the translation table, if the value is a string. * * @param mixed $value * @return mixed */ private function fallbackReplacement($value) { return is_string($value) ? $this->replacements->replace($value) : $value; } /** * Replace a value matched exactly. * * @param mixed $value * @return mixed */ private function replaceExactValue($value) { return $this->exactReplacements[$value]; } private function replaceDependencyConfiguration(array $config) { $aliases = isset($config['aliases']) && is_array($config['aliases']) ? $this->replaceDependencyAliases($config['aliases']) : []; if ($aliases) { $config['aliases'] = $aliases; } $config = $this->replaceDependencyInvokables($config); $config = $this->replaceDependencyFactories($config); $config = $this->replaceDependencyServices($config); $keys = self::SERVICE_MANAGER_KEYS_OF_INTEREST; foreach ($config as $key => $data) { if (isset($keys[$key])) { continue; } $config[$key] = is_array($data) ? $this->__invoke($data, [$key]) : $data; } return $config; } /** * Rewrite dependency aliases array * * In this case, we want to keep the alias as-is, but rewrite the target. * * We need also provide an additional alias if the alias key is a legacy class. * * @return array */ private function replaceDependencyAliases(array $aliases) { foreach ($aliases as $alias => $target) { if (! is_string($alias) || ! is_string($target)) { continue; } $newTarget = $this->replacements->replace($target); $newAlias = $this->replacements->replace($alias); $notIn = [$newTarget]; $name = $newTarget; while (isset($aliases[$name])) { $notIn[] = $aliases[$name]; $name = $aliases[$name]; } if ($newAlias === $alias && ! in_array($alias, $notIn, true)) { $aliases[$alias] = $newTarget; continue; } if (isset($aliases[$newAlias])) { continue; } if (! in_array($newAlias, $notIn, true)) { $aliases[$alias] = $newAlias; $aliases[$newAlias] = $newTarget; } } return $aliases; } /** * Rewrite dependency invokables array * * In this case, we want to keep the alias as-is, but rewrite the target. * * We need also provide an additional alias if invokable is defined with * an alias which is a legacy class. * * @return array */ private function replaceDependencyInvokables(array $config) { if (empty($config['invokables']) || ! is_array($config['invokables'])) { return $config; } foreach ($config['invokables'] as $alias => $target) { if (! is_string($alias)) { continue; } $newTarget = $this->replacements->replace($target); $newAlias = $this->replacements->replace($alias); if ($alias === $target || isset($config['aliases'][$newAlias])) { $config['invokables'][$alias] = $newTarget; continue; } $config['invokables'][$newAlias] = $newTarget; if ($newAlias === $alias) { continue; } $config['aliases'][$alias] = $newAlias; unset($config['invokables'][$alias]); } return $config; } /** * @param mixed $value * @return mixed Returns $value verbatim. */ private function noopReplacement($value) { return $value; } private function replaceDependencyFactories(array $config) { if (empty($config['factories']) || ! is_array($config['factories'])) { return $config; } foreach ($config['factories'] as $service => $factory) { if (! is_string($service)) { continue; } $replacedService = $this->replacements->replace($service); $factory = is_string($factory) ? $this->replacements->replace($factory) : $factory; $config['factories'][$replacedService] = $factory; if ($replacedService === $service) { continue; } unset($config['factories'][$service]); if (isset($config['aliases'][$service])) { continue; } $config['aliases'][$service] = $replacedService; } return $config; } private function replaceDependencyServices(array $config) { if (empty($config['services']) || ! is_array($config['services'])) { return $config; } foreach ($config['services'] as $service => $serviceInstance) { if (! is_string($service)) { continue; } $replacedService = $this->replacements->replace($service); $serviceInstance = is_array($serviceInstance) ? $this->__invoke($serviceInstance) : $serviceInstance; $config['services'][$replacedService] = $serviceInstance; if ($service === $replacedService) { continue; } unset($config['services'][$service]); if (isset($config['aliases'][$service])) { continue; } $config['aliases'][$service] = $replacedService; } return $config; } } src/Module.php000064400000002506144760123310007275 0ustar00getEventManager() ->attach('mergeConfig', [$this, 'onMergeConfig']); } /** * Perform substitutions in the merged configuration. * * Rewrites keys and values matching known ZF classes, namespaces, and * configuration keys to their Laminas equivalents. * * Type-hinting deliberately omitted to allow unit testing * without dependencies on packages that do not exist yet. * * @param ModuleEvent $event */ public function onMergeConfig($event) { /** @var ConfigMergerInterface */ $configMerger = $event->getConfigListener(); $processor = new ConfigPostProcessor(); $configMerger->setMergedConfig( $processor( $configMerger->getMergedConfig($returnAsObject = false) ) ); } } src/Replacements.php000064400000002115144760123310010466 0ustar00replacements = array_merge( require __DIR__ . '/../config/replacements.php', $additionalReplacements ); // Provide multiple variants of strings containing namespace separators foreach ($this->replacements as $original => $replacement) { if (false === strpos($original, '\\')) { continue; } $this->replacements[str_replace('\\', '\\\\', $original)] = str_replace('\\', '\\\\', $replacement); $this->replacements[str_replace('\\', '\\\\\\\\', $original)] = str_replace('\\', '\\\\\\\\', $replacement); } } /** * @param string $value * @return string */ public function replace($value) { return strtr($value, $this->replacements); } } src/RewriteRules.php000064400000005324144760123310010505 0ustar00 'Mezzio\\ProblemDetails\\', 'Zend\\Expressive\\' => 'Mezzio\\', // Laminas 'Zend\\' => 'Laminas\\', 'ZF\\ComposerAutoloading\\' => 'Laminas\\ComposerAutoloading\\', 'ZF\\DevelopmentMode\\' => 'Laminas\\DevelopmentMode\\', // Apigility 'ZF\\Apigility\\' => 'Laminas\\ApiTools\\', 'ZF\\' => 'Laminas\\ApiTools\\', // ZendXml, API wrappers, zend-http OAuth support, zend-diagnostics, ZendDeveloperTools 'ZendXml\\' => 'Laminas\\Xml\\', 'ZendOAuth\\' => 'Laminas\\OAuth\\', 'ZendDiagnostics\\' => 'Laminas\\Diagnostics\\', 'ZendService\\ReCaptcha\\' => 'Laminas\\ReCaptcha\\', 'ZendService\\Twitter\\' => 'Laminas\\Twitter\\', 'ZendDeveloperTools\\' => 'Laminas\\DeveloperTools\\', ]; } /** * @return array */ public static function namespaceReverse() { return [ // ZendXml, ZendOAuth, ZendDiagnostics, ZendDeveloperTools 'Laminas\\Xml\\' => 'ZendXml\\', 'Laminas\\OAuth\\' => 'ZendOAuth\\', 'Laminas\\Diagnostics\\' => 'ZendDiagnostics\\', 'Laminas\\DeveloperTools\\' => 'ZendDeveloperTools\\', // Zend Service 'Laminas\\ReCaptcha\\' => 'ZendService\\ReCaptcha\\', 'Laminas\\Twitter\\' => 'ZendService\\Twitter\\', // Zend 'Laminas\\' => 'Zend\\', // Expressive 'Mezzio\\ProblemDetails\\' => 'Zend\\ProblemDetails\\', 'Mezzio\\' => 'Zend\\Expressive\\', // Laminas to ZfCampus 'Laminas\\ComposerAutoloading\\' => 'ZF\\ComposerAutoloading\\', 'Laminas\\DevelopmentMode\\' => 'ZF\\DevelopmentMode\\', // Apigility 'Laminas\\ApiTools\\Admin\\' => 'ZF\\Apigility\\Admin\\', 'Laminas\\ApiTools\\Doctrine\\' => 'ZF\\Apigility\\Doctrine\\', 'Laminas\\ApiTools\\Documentation\\' => 'ZF\\Apigility\\Documentation\\', 'Laminas\\ApiTools\\Example\\' => 'ZF\\Apigility\\Example\\', 'Laminas\\ApiTools\\Provider\\' => 'ZF\\Apigility\\Provider\\', 'Laminas\\ApiTools\\Welcome\\' => 'ZF\\Apiglity\\Welcome\\', 'Laminas\\ApiTools\\' => 'ZF\\', ]; } } src/autoload.php000064400000000067144760123310007660 0ustar00