From 4640dc2ddb27c1c867d9b58f164b3e54dba7b2ae Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 23 Jun 2021 17:51:53 -0500 Subject: [PATCH 1/2] qa: add Psalm as a dev requirement, along with configuration Signed-off-by: Matthew Weier O'Phinney --- composer.json | 4 +- composer.lock | 770 ++++++++++++++++++++++++++++++++++++++++++++++++- psalm.xml.dist | 36 +++ 3 files changed, 808 insertions(+), 2 deletions(-) create mode 100644 psalm.xml.dist diff --git a/composer.json b/composer.json index 3e1ad6ba..b01574a5 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,9 @@ "mongodb/mongodb": "^1.1.0", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.3", - "symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0" + "psalm/plugin-phpunit": "^0.16.1", + "symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0", + "vimeo/psalm": "^4.8" }, "conflict": { "doctrine/dbal": "<2.12.0", diff --git a/composer.lock b/composer.lock index f251d24b..c160ffae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a85333c4e670560db684bcb1467333db", + "content-hash": "c73745931925217c5ec6217e8aa8ccfa", "packages": [ { "name": "brick/varexporter", @@ -5430,6 +5430,172 @@ }, "time": "2020-11-11T14:05:46+00:00" }, + { + "name": "amphp/amp", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/amphp/amp.git", + "reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/amp/zipball/efca2b32a7580087adb8aabbff6be1dc1bb924a9", + "reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9", + "shasum": "" + }, + "require": { + "php": ">=7" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6.0.9 | ^7", + "psalm/phar": "^3.11@dev", + "react/promise": "^2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Amp\\": "lib" + }, + "files": [ + "lib/functions.php", + "lib/Internal/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "http://amphp.org/amp", + "keywords": [ + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" + ], + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/amp/issues", + "source": "https://github.com/amphp/amp/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2021-01-10T17:06:37+00:00" + }, + { + "name": "amphp/byte-stream", + "version": "v1.8.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/byte-stream.git", + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.4", + "friendsofphp/php-cs-fixer": "^2.3", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6 || ^7 || ^8", + "psalm/phar": "^3.11.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Amp\\ByteStream\\": "lib" + }, + "files": [ + "lib/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "http://amphp.org/byte-stream", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" + ], + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/byte-stream/issues", + "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2021-03-30T17:13:30+00:00" + }, { "name": "composer/package-versions-deprecated", "version": "1.11.99.2", @@ -5503,6 +5669,151 @@ ], "time": "2021-05-24T07:46:03+00:00" }, + { + "name": "composer/semver", + "version": "3.2.5", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/31f3ea725711245195f62e54ffa402d8ef2fdba9", + "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.54", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.2.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2021-05-24T12:41:47+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "964adcdd3a28bf9ed5d9ac6450064e0d71ed7496" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/964adcdd3a28bf9ed5d9ac6450064e0d71ed7496", + "reference": "964adcdd3a28bf9ed5d9ac6450064e0d71ed7496", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/2.0.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2021-05-05T19:37:51+00:00" + }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v0.7.1", @@ -5573,6 +5884,43 @@ }, "time": "2020-12-07T18:04:37+00:00" }, + { + "name": "dnoegel/php-xdg-base-dir", + "version": "v0.1.1", + "source": { + "type": "git", + "url": "https://github.com/dnoegel/php-xdg-base-dir.git", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "XdgBaseDir\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "implementation of xdg base directory specification for php", + "support": { + "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", + "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" + }, + "time": "2019-12-04T15:06:13+00:00" + }, { "name": "doctrine/dbal", "version": "2.13.2", @@ -6196,6 +6544,107 @@ }, "time": "2020-12-03T08:52:14+00:00" }, + { + "name": "felixfbecker/advanced-json-rpc", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "shasum": "" + }, + "require": { + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", + "php": "^7.1 || ^8.0", + "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "A more advanced JSONRPC implementation", + "support": { + "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", + "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" + }, + "time": "2021-06-11T22:34:44+00:00" + }, + { + "name": "felixfbecker/language-server-protocol", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-language-server-protocol.git", + "reference": "9d846d1f5cf101deee7a61c8ba7caa0a975cd730" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/9d846d1f5cf101deee7a61c8ba7caa0a975cd730", + "reference": "9d846d1f5cf101deee7a61c8ba7caa0a975cd730", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpstan/phpstan": "*", + "squizlabs/php_codesniffer": "^3.1", + "vimeo/psalm": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "LanguageServerProtocol\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "PHP classes for the Language Server Protocol", + "keywords": [ + "language", + "microsoft", + "php", + "server" + ], + "support": { + "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", + "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/1.5.1" + }, + "time": "2021-02-22T14:02:09+00:00" + }, { "name": "jean85/pretty-package-versions", "version": "1.6.0", @@ -7093,6 +7542,110 @@ ], "time": "2020-11-13T09:40:50+00:00" }, + { + "name": "netresearch/jsonmapper", + "version": "v4.0.0", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0", + "squizlabs/php_codesniffer": "~3.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonMapper": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@cweiske.de", + "homepage": "http://github.com/cweiske/jsonmapper/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "support": { + "email": "cweiske@cweiske.de", + "issues": "https://github.com/cweiske/jsonmapper/issues", + "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" + }, + "time": "2020-12-01T19:48:11+00:00" + }, + { + "name": "openlss/lib-array2xml", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/nullivex/lib-array2xml.git", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "LSS": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Bryan Tong", + "email": "bryan@nullivex.com", + "homepage": "https://www.nullivex.com" + }, + { + "name": "Tony Butler", + "email": "spudz76@gmail.com", + "homepage": "https://www.nullivex.com" + } + ], + "description": "Array2XML conversion library credit to lalit.org", + "homepage": "https://www.nullivex.com", + "keywords": [ + "array", + "array conversion", + "xml", + "xml conversion" + ], + "support": { + "issues": "https://github.com/nullivex/lib-array2xml/issues", + "source": "https://github.com/nullivex/lib-array2xml/tree/master" + }, + "time": "2019-03-29T20:06:56+00:00" + }, { "name": "phar-io/manifest", "version": "2.0.1", @@ -7952,6 +8505,66 @@ ], "time": "2021-06-23T05:14:38+00:00" }, + { + "name": "psalm/plugin-phpunit", + "version": "0.16.1", + "source": { + "type": "git", + "url": "https://github.com/psalm/psalm-plugin-phpunit.git", + "reference": "5dd3be04f37a857d52880ef6af2524a441dfef24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/psalm-plugin-phpunit/zipball/5dd3be04f37a857d52880ef6af2524a441dfef24", + "reference": "5dd3be04f37a857d52880ef6af2524a441dfef24", + "shasum": "" + }, + "require": { + "composer/package-versions-deprecated": "^1.10", + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "ext-simplexml": "*", + "php": "^7.1 || ^8.0", + "vimeo/psalm": "dev-master || dev-4.x || ^4.5" + }, + "conflict": { + "phpunit/phpunit": "<7.5" + }, + "require-dev": { + "codeception/codeception": "^4.0.3", + "php": "^7.3 || ^8.0", + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "^3.3.1", + "weirdan/codeception-psalm-module": "^0.11.0", + "weirdan/prophecy-shim": "^1.0 || ^2.0" + }, + "type": "psalm-plugin", + "extra": { + "psalm": { + "pluginClass": "Psalm\\PhpUnitPlugin\\Plugin" + } + }, + "autoload": { + "psr-4": { + "Psalm\\PhpUnitPlugin\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Brown", + "email": "github@muglug.com" + } + ], + "description": "Psalm plugin for PHPUnit", + "support": { + "issues": "https://github.com/psalm/psalm-plugin-phpunit/issues", + "source": "https://github.com/psalm/psalm-plugin-phpunit/tree/0.16.1" + }, + "time": "2021-06-18T23:56:46+00:00" + }, { "name": "psr/log", "version": "1.1.4", @@ -9208,6 +9821,111 @@ ], "time": "2020-07-12T23:59:07+00:00" }, + { + "name": "vimeo/psalm", + "version": "4.8.1", + "source": { + "type": "git", + "url": "https://github.com/vimeo/psalm.git", + "reference": "f73f2299dbc59a3e6c4d66cff4605176e728ee69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/f73f2299dbc59a3e6c4d66cff4605176e728ee69", + "reference": "f73f2299dbc59a3e6c4d66cff4605176e728ee69", + "shasum": "" + }, + "require": { + "amphp/amp": "^2.4.2", + "amphp/byte-stream": "^1.5", + "composer/package-versions-deprecated": "^1.8.0", + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^1.1 || ^2.0", + "dnoegel/php-xdg-base-dir": "^0.1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "felixfbecker/advanced-json-rpc": "^3.0.3", + "felixfbecker/language-server-protocol": "^1.5", + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", + "nikic/php-parser": "^4.10.5", + "openlss/lib-array2xml": "^1.0", + "php": "^7.1|^8", + "sebastian/diff": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "webmozart/path-util": "^2.3" + }, + "provide": { + "psalm/psalm": "self.version" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.2", + "brianium/paratest": "^4.0||^6.0", + "ext-curl": "*", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpdocumentor/reflection-docblock": "^5", + "phpmyadmin/sql-parser": "5.1.0||dev-master", + "phpspec/prophecy": ">=1.9.0", + "phpunit/phpunit": "^9.0", + "psalm/plugin-phpunit": "^0.16", + "slevomat/coding-standard": "^7.0", + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^4.3 || ^5.0", + "weirdan/phpunit-appveyor-reporter": "^1.0.0", + "weirdan/prophecy-shim": "^1.0 || ^2.0" + }, + "suggest": { + "ext-igbinary": "^2.0.5" + }, + "bin": [ + "psalm", + "psalm-language-server", + "psalm-plugin", + "psalm-refactor", + "psalter" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev", + "dev-3.x": "3.x-dev", + "dev-2.x": "2.x-dev", + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psalm\\": "src/Psalm/" + }, + "files": [ + "src/functions.php", + "src/spl_object_id.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matthew Brown" + } + ], + "description": "A static analysis tool for finding errors in PHP applications", + "keywords": [ + "code", + "inspection", + "php" + ], + "support": { + "issues": "https://github.com/vimeo/psalm/issues", + "source": "https://github.com/vimeo/psalm/tree/4.8.1" + }, + "time": "2021-06-20T23:03:20+00:00" + }, { "name": "webimpress/coding-standard", "version": "1.2.2", @@ -9262,6 +9980,56 @@ } ], "time": "2021-04-12T12:51:27+00:00" + }, + { + "name": "webmozart/path-util", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/path-util.git", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "webmozart/assert": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\PathUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "support": { + "issues": "https://github.com/webmozart/path-util/issues", + "source": "https://github.com/webmozart/path-util/tree/2.3.0" + }, + "time": "2015-12-17T08:42:14+00:00" } ], "aliases": [], diff --git a/psalm.xml.dist b/psalm.xml.dist new file mode 100644 index 00000000..3f811f2a --- /dev/null +++ b/psalm.xml.dist @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c3bdf3551b526b4e12accb5da9af3b0667c75632 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 23 Jun 2021 18:08:57 -0500 Subject: [PATCH 2/2] qa: apply automated fixes and suggestions from Psalm and create initial baseline Signed-off-by: Matthew Weier O'Phinney --- psalm-baseline.xml | 2480 +++++++++++++++++ psalm.xml.dist | 2 + src/Admin/Model/DoctrineRestServiceModel.php | 44 +- .../Model/DoctrineRestServiceResource.php | 3 +- src/Admin/Model/DoctrineRpcServiceModel.php | 14 +- .../Model/DoctrineRpcServiceResource.php | 3 +- .../Event/Listener/CollectionListener.php | 3 +- src/Server/Module.php | 2 + .../Paginator/Adapter/DoctrineOdmAdapter.php | 1 + .../CreateFilter/AbstractCreateFilter.php | 2 + .../Query/Provider/AbstractQueryProvider.php | 2 + src/Server/Resource/DoctrineResource.php | 7 +- .../Validator/NoObjectExistsFactory.php | 1 + src/Server/Validator/ObjectExistsFactory.php | 1 + .../LaminasTestApiToolsDb/Entity/Album.php | 15 +- .../LaminasTestApiToolsDb/Entity/Artist.php | 15 +- .../LaminasTestApiToolsDb/Entity/Product.php | 2 +- .../EventListener/ArtistAggregateListener.php | 4 +- .../src/LaminasTestApiToolsDb/Module.php | 6 +- .../src/LaminasTestApiToolsDbApi/Module.php | 13 +- .../Document/Meta.php | 16 +- .../src/LaminasTestApiToolsDbMongo/Module.php | 6 +- .../LaminasTestApiToolsDbMongoApi/Module.php | 13 +- .../Listener/EventCatcher.php | 6 +- .../src/LaminasTestApiToolsGeneral/Module.php | 8 +- ...rineAutodiscoveryControllerFactoryTest.php | 4 +- .../DoctrineAutodiscoveryModelFactoryTest.php | 4 +- .../Model/DoctrineAutodiscoveryModelTest.php | 4 +- .../src/Admin/Model/DoctrineMetadata1Test.php | 8 +- .../src/Admin/Model/DoctrineMetadata2Test.php | 6 +- ...rineMetadataServiceResourceFactoryTest.php | 2 +- ...rineRestServiceModelFactoryFactoryTest.php | 4 +- ...DoctrineRestServiceResourceFactoryTest.php | 11 +- .../Model/DoctrineRestServiceResourceTest.php | 10 +- ...trineRpcServiceModelFactoryFactoryTest.php | 4 +- .../DoctrineRpcServiceResourceFactoryTest.php | 4 +- test/src/Server/ODM/CRUD/CRUDTest.php | 38 +- test/src/Server/ORM/CRUD/CRUDTest.php | 68 +- .../Validator/NoObjectExistsFactoryTest.php | 4 +- .../Validator/ObjectExistsFactoryTest.php | 4 +- test/src/TestCase.php | 2 +- 41 files changed, 2717 insertions(+), 129 deletions(-) create mode 100644 psalm-baseline.xml diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 00000000..11815397 --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,2480 @@ + + + + + Controller\DoctrineAutodiscovery + Controller\DoctrineAutodiscovery + Controller\DoctrineAutodiscovery + Controller\DoctrineAutodiscovery + Controller\DoctrineAutodiscovery + Controller\DoctrineAutodiscovery + Controller\DoctrineAutodiscovery + Controller\DoctrineMetadataService + Controller\DoctrineMetadataService + Controller\DoctrineMetadataService + Controller\DoctrineMetadataService + Controller\DoctrineMetadataService + Controller\DoctrineRestService + Controller\DoctrineRestService + Controller\DoctrineRestService + Controller\DoctrineRestService + Controller\DoctrineRestService + Controller\DoctrineRpcService + Controller\DoctrineRpcService + Controller\DoctrineRpcService + Controller\DoctrineRpcService + Controller\DoctrineRpcService + DoctrineAutodiscovery + Server\Validator\NoObjectExists + Server\Validator\ObjectExists + + + + + NoObjectExists + ObjectExists + Validator\NoObjectExists + Validator\NoObjectExists + Validator\ObjectExists + Validator\ObjectExists + + + + + $adapter + $module + $version + + + $adapter + $module + $version + + + fromRoute + fromRoute + fromRoute + + + DoctrineAutodiscoveryController + DoctrineAutodiscoveryController + DoctrineAutodiscoveryController + DoctrineAutodiscoveryController + DoctrineAutodiscoveryController + + + + + DoctrineAutodiscoveryControllerFactory + + + getServiceLocator + + + $container + + + + + $mapping['fieldName'] + + + $mapping['fieldName'] + $mapping['fieldName'] + $mapping['type'] + $validator['options'] + + + $validator['options'] + + + $field['filters'] + $field['filters'] + $field['validators'][] + $mapping + $validator + $validator['options']['max'] + + + $classMetadata->fieldMappings + + + strrpos($classMetadata->getName(), '\\') + + + DoctrineAutodiscoveryModel + + + + + $container + + + + + $this + + + $associationMappings + $changeTrackingPolicy + $columnNames + $containsForeignIdentifier + $customGeneratorDefinition + $customRepositoryClassName + $discriminatorColumn + $discriminatorMap + $discriminatorValue + $entityListeners + $fieldMappings + $fieldNames + $generatorType + $idGenerator + $identifier + $inheritanceType + $isIdentifierComposite + $isMappedSuperclass + $isReadOnly + $isVersioned + $lifecycleCallbacks + $name + $namedNativeQueries + $namedQueries + $namespace + $namingStrategy + $parentClasses + $reflClass + $reflFields + $rootEntityName + $sequenceGeneratorDefinition + $sqlResultSetMappings + $subClasses + $table + $tableGeneratorDefinition + $versionField + + + $this->associationMappings + $this->changeTrackingPolicy + $this->columnNames + $this->containsForeignIdentifier + $this->customGeneratorDefinition + $this->customRepositoryClassName + $this->discriminatorColumn + $this->discriminatorMap + $this->discriminatorValue + $this->entityListeners + $this->fieldMappings + $this->fieldNames + $this->generatorType + $this->idGenerator + $this->identifier + $this->inheritanceType + $this->isIdentifierComposite + $this->isMappedSuperclass + $this->isReadOnly + $this->isVersioned + $this->lifecycleCallbacks + $this->name + $this->namedNativeQueries + $this->namedQueries + $this->namespace + $this->namingStrategy + $this->parentClasses + $this->reflClass + $this->reflFields + $this->rootEntityName + $this->sequenceGeneratorDefinition + $this->sqlResultSetMappings + $this->subClasses + $this->table + $this->tableGeneratorDefinition + $this->versionField + $value + + + $data + + + + + new $entityClass() + new $entityClass() + + + $metadataEntity + $return + + + $serviceManager + + + $objectManagerAlias + $objectManagerClass + + + $objectManager + $objectManager + $objectManagerAlias + $objectManagerClass + + + exchangeArray + exchangeArray + getMetadataFactory + getMetadataFactory + + + $data + $data + $entityClassName + $id + $id + + + RestServiceEntity[]|ApiProblem + RestServiceEntity|ApiProblem + + + $entityClassName + + + + + $container + + + + + $hydratorName + $objectManager + + + $key + + + $data['by_value'] + $data['hydrator_name'] + $data['object_manager'] + $data['strategies'] + $data['use_generated_hydrator'] + + + $data + $this->byValue + $this->hydratorName + $this->hydratorStrategies + $this->objectManager + $this->useGeneratedHydrator + $value + + + array<string, mixed> + + + $data + + + $hydratorName + + + $data + + + + + $this->events + + + self + + + $r + + + $collectionClass + $collectionClass + $collectionClass + $config + $config + $configHydrator + $configKey + $configKey + $configResource + $config['api-tools-rest'] + $config['api-tools-versioning']['uri'] + $controllerService + $controllerService + $controllerService + $controllerService + $controllerService + $controllerService + $details->objectManager + $details->objectManager + $details->objectManager + $details->routeIdentifierName + $details->routeMatch + $details->serviceName + $entity->getArrayCopy() + $entityClass + $filter->filter($resourceName) + $filter->filter($this->module) + $filter->filter($this->module) + $module + $module + $module + $original->controllerServiceName + $resourceClass + $restCollectionClass + $restConfig + $restResourceClass + $routeName + $routeName + $routeName + $routeName + $service->resourceClass + $strategy + $update->hydratorName + + + $controllerService + $controllerService + $controllerService + + + $configResource['hydrator'] + $config['accept_whitelist'] + $config['api-tools'] + $config['api-tools-content-validation'][$entity->controllerServiceName] + $config['api-tools-hal']['metadata_map'] + $config['api-tools-rest'][$entity->controllerServiceName] + $config['api-tools-rest'][$entity->controllerServiceName] + $config['api-tools-versioning']['uri'] + $config['content_type_whitelist'] + $config['controllers'] + $config['doctrine-hydrator'][$configResource['hydrator']] + $config['doctrine-hydrator'][$hydratorName] + $config['router']['routes'][$routeName]['options']['route'] + $restConfig['listener'] + $restConfig['listener'] + + + $restConfig['controllerServiceName'] + $restConfig['module'] + $restConfig['resource_class'] + + + $config['api-tools']['doctrine-connected'][$entity->resourceClass] + $config['api-tools']['doctrine-connected'][$entity->resourceClass] + $config['api-tools-content-validation'][$entity->controllerServiceName] + $config['api-tools-hal']['metadata_map'][$entity->entityClass] + $config['api-tools-rest'][$entity->controllerServiceName] + $config['api-tools-rest'][$entity->controllerServiceName] + $config['doctrine-hydrator'][$configResource['hydrator']] + $config['doctrine-hydrator'][$configResource['hydrator']] + $config['doctrine-hydrator'][$hydratorName] + $config['router']['routes'][$routeName] + $patch[$configKey] + + + $acceptWhitelist + $collectionClass + $config + $config + $config + $config + $configHydrator + $configKey + $configKey + $configKey + $configResource + $config['api-tools-hal']['metadata_map'][$entityClass]['hydrator'] + $contentTypeWhitelist + $controllerService + $controllerService + $entity + $hydratorName + $hydratorName + $hydratorStrategies + $module + $module + $module + $objectManager + $patch[$configKey] + $patch['hydrator'] + $patch['object_manager'] + $resource + $resourceClass + $restCollectionClass + $restConfig + $restConfig['resource_class'] + $restResourceClass + $route + $route + $routeName + $routeName + $routeName + $service + $strategy + $uriKey + $validator + $whitelist + $whitelist + + + DoctrineRestServiceEntity|false + string + string + + + getArrayCopy + + + $module + $resource + $service + $service + $service + + + $entity->resourceClass + + + $config['api-tools-rest'][$controllerServiceName]['collection_class'] + $config['api-tools-rest'][$controllerServiceName]['entity_class'] + $eventResults->last() + + + null + null + + + $events + + + $original + $original + $original + $original + $original + $service + $service + + + $service->resourceClass + + + $events + $renderer + $routeNameFilter + $serviceManager + + + $this->renderer instanceof PhpRenderer + $this->routeNameFilter instanceof FilterChain + + + trigger + + + $response + + + + + DoctrineRestServiceModel + + + $this->models[$type][$module] + + + DoctrineRestServiceModel + + + $this->models[$type][$module] + + + $moduleEntity + + + $serviceManager + + + setSharedManager + + + + + $container + + + $container->get(ConfigResourceFactory::class) + $container->get(ModuleModel::class) + $container->get(ModulePathSpec::class) + $sharedEvents + ConfigResourceFactory::class + ConfigResourceFactory::class + + + $sharedEvents + + + ConfigResourceFactory + ConfigResourceFactory + + + + + $this->model instanceof DoctrineRestServiceModel + + + $this->model + + + $service + parent::fetch($id) + + + $data + $id + + + DoctrineRestServiceEntity|ApiProblem + DoctrineRestServiceEntity|ApiProblem + + + DoctrineRestServiceResource + DoctrineRestServiceResource + DoctrineRestServiceResource + DoctrineRestServiceResource + DoctrineRestServiceResource + DoctrineRestServiceResource + DoctrineRestServiceResource + + + + + $container->get(DoctrineRestServiceModelFactory::class) + $container->get(DocumentationModel::class) + $container->get(InputFilterModel::class) + + + + + $config['api-tools-rpc-doctrine-controller'] + $config['api-tools-versioning']['uri'] + $controllerService + $controllerService + $controllerService + $controllerService + $controllerService + $data['route_name'] + $entity->controllerClass + $routeName + $serviceName + $serviceName + + + $controllerService + $controllerService + $controllerService + + + $config[$routeName] + $config['api-tools-versioning']['uri'] + $config['options'] + $contentNegotiationConfig['accept_whitelist'] + $contentNegotiationConfig['content_type_whitelist'] + $contentNegotiationConfig['controllers'] + $rpcConfig['http_methods'] + $rpcConfig['route_name'] + + + $config['api-tools-content-negotiation'][$headerType] + $config['api-tools-content-negotiation']['controllers'] + $config['api-tools-rpc'][$controllerService] + $config['router']['routes'] + + + $config['router']['routes'][$routeName] + + + $config + $config + $contentNegotiationConfig + $controllerData + $controllerService + $data['accept_whitelist'] + $data['content_type_whitelist'] + $data['http_methods'] + $data['route_name'] + $data['selector'] + $fullClassName + $routeName + $routeName + $rpcConfig + $serviceName + + + false|string + string + + + $controllerData->service + + + $config['options']['route'] + $filter->filter($string) + + + $filter + + + $this->filter instanceof FilterChain + + + InvokableFactory + + + + + DoctrineRpcServiceModel + + + DoctrineRpcServiceModel + + + $this->models[$module] + + + $moduleEntity + + + + + $configFactory + $moduleModel + $modulePathSpec + $sharedEvents + ConfigResourceFactory::class + ConfigResourceFactory::class + + + $configFactory + $moduleModel + $modulePathSpec + $sharedEvents + + + ConfigResourceFactory + ConfigResourceFactory + + + + + $this->model instanceof DoctrineRpcServiceModel + + + $this->model + + + $e->getCode() + + + $service + parent::fetch($id) + + + $data + $id + + + DoctrineRpcServiceEntity|ApiProblem + DoctrineRpcServiceEntity|ApiProblem + + + $creationData['http_methods'] + + + DoctrineRpcServiceResource + DoctrineRpcServiceResource + DoctrineRpcServiceResource + DoctrineRpcServiceResource + DoctrineRpcServiceResource + DoctrineRpcServiceResource + DoctrineRpcServiceResource + + + createService + + + + + $container->get('ControllerManager') + $container->get(DoctrineRpcServiceModelFactory::class) + $container->get(DocumentationModel::class) + $container->get(InputFilterModel::class) + + + + + $hydratorName + $objectManager + + + $key + + + $data['by_value'] + $data['hydrator_name'] + $data['object_manager'] + $data['strategies'] + $data['use_generated_hydrator'] + + + $data + $this->byValue + $this->hydratorName + $this->hydratorStrategies + $this->objectManager + $this->useGeneratedHydrator + $value + + + array<string, mixed> + + + $data + + + $hydratorName + + + $data + + + + + array + + + include __DIR__ . '/../../config/admin.config.php' + + + + + $data + $entityClassName + $entityId + $objectManager + $resourceEvent + DoctrineResourceEvent + DoctrineResourceEvent + + + + + $associationTargetClass + + + ! $metadata + + + $this->entityHydratorMap + $this->entityHydratorMap + [] + + + $hydratorMap[$entityClass] + $this->entityHydratorMap[$entityClass] + + + $association + $association + $association + $association + $association + $event->getTarget()->getServiceManager() + $listener + $subEntityData + $subEntityData + $subEntityData + $this->entityCollectionValuedAssociations[$entity] + $this->getEntityHydratorMap()[$entityClass] + $this->getRootEntity() + $this->iterateEntity($this->getRootEntity(), $this->getObjectData(), $this->getInputFilter()) + + + $data + $data + + + $configParams['entity_class'] + $config[DoctrineHydratorFactory::FACTORY_NAMESPACE] + + + $data[$association] + $this->entityHydratorMap[$configParams['entity_class']] + + + $association + $association + $config + $config + $configParams + $hydrator + $hydratorKey + $hydratorManager + $identifierValues[$identifierName] + $listener + $subEntityData + $subEntityData + $this->rootEntity + + + ArrayObject + ClassMetadata + + + getServiceManager + new $targetEntityClassName() + + + $this->classMetadataMap[$entity] + $this->entityCollectionValuedAssociations[$entity] + + + AbstractHydrator|DoctrineObject + + + false + + + $hydratorMap + $this->getAssociatedEntityInputFilter($association, $inputFilter) + + + $hydratorMap[$entityClass] + $this->getEntityHydratorMap()[$entityClass] + + + getServiceManager + + + $data + $event->getResourceEvent()->getInputFilter() + $this->getEntityHydratorMap()[$entityClass] + + + $hydratorMap[$entityClass] + $this->getEntityHydratorMap()[$entityClass] + + + hydrate + + + $inputFilter + $objectData + $objectManager + $rootEntity + $serviceManager + + + $stripEmptyAssociations === true && ! empty($data) && is_array($data) + $this->entityHydratorMap === null + is_array($data) + + + getIdentifierFieldNames + + + + + $serviceListener + $sm + + + array + + + addServiceManager + addServiceManager + get + + + include __DIR__ . '/../../config/server.config.php' + + + + + Builder + Builder + Builder + Builder + + + array + count + + + count + toArray + + + $queryBuilder->getQuery()->execute()->count() + $queryBuilder->getQuery()->execute()->toArray() + + + null + + + + + $this->cache[$offset] + + + $this->cache[$offset][$itemCountPerPage] + + + array + + + $this->cache[$offset][$itemCountPerPage] + $this->cache[$offset][$itemCountPerPage] + + + + + $objectManager + + + + + $e->getCode() + + + $instanceOf + + + + + $objectManager + $objectManager + + + $queryBuilder + + + from + getQuery + getSingleScalarResult + select + + + $identifier[0] + + + $queryBuilder + + + $queryBuilder->getQuery() + + + createQueryBuilder + + + + + $queryBuilder + Builder + + + $queryBuilder + + + int + + + count + execute + find + getQuery + + + $queryBuilder->getQuery()->execute()->count() + + + $entityClass + $queryBuilder + + + createQueryBuilder + createQueryBuilder + + + + + $queryBuilder + + + from + select + + + createQueryBuilder + + + + + $e->getCode() + + + $instanceOf + + + + + $entityClass + $this->getCollectionClass() + + + ! is_array($queryProviders) + $data instanceof ApiProblem + $this->events instanceof EventManagerInterface + $this->hydrator + is_string($this->eventIdentifier) + + + $this + ObjectManager|EntityManagerInterface + + + $data + $this->getEntityClass() + $this->getEntityClass() + true + + + $result + $return + + + $this->getEntityClass() + + + new $entityClass() + + + $data + $data + $data + $data + $id + $id + $id + $id + $id + $queryBuilder + $result + + + $identifiers + $key + $key + + + $row[$this->getEntityIdentifierName()] + $row[$this->getEntityIdentifierName()] + + + $criteria[$routeMatchParam] + $entity + $preEventData + $preEventData + $preEventData + $preEventData + $preEventData + $queryBuilder + $queryBuilder + $result + $result + $row + $row + $value + $value + + + QueryProviderInterface + array + object + + + andwhere + beginTransaction + beginTransaction + commit + commit + eq + expr + getQuery + getQuery + getRequest + getSingleResult + rollback + rollback + setParameter + toArray + + + $entity + $queryProviders[$method] + $queryProviders['default'] + $results->last() + $results->last() + + + $data + + + $data + $events + + + $this->getObjectManager() + $this->getObjectManager() + + + getRequest + setCurrentPageNumber + setItemCountPerPage + + + $data + + + getParams + getRequest + + + getConnection + getConnection + getConnection + getConnection + getConnection + getConnection + setCurrentPageNumber + setItemCountPerPage + + + $entityIdentifierName + $events + $hydrator + $objectManager + $queryCreateFilter + $queryProviders + $routeIdentifierName + $sharedEventManager + DoctrineResource + DoctrineResource + DoctrineResource + DoctrineResource + DoctrineResource + + + is_array($this->eventIdentifier) + isset($this->eventIdentifier) + + + $routeMatch + $this->getEvent()->getRouteMatch() + + + $queryProviders + $queryProviders + + + getEntityClass + + + + + DoctrineResourceFactory + + + new $resourceClass($entityFactory) + + + $config['object_manager'] + $container->get('Application')->getEventManager()->getSharedManager() + $doctrineConnectedConfig + $doctrineConnectedConfig + $doctrineConnectedConfig['entity_factory'] + $doctrineConnectedConfig['hydrator'] + $doctrineConnectedConfig['object_manager'] + $doctrineHydratorConfig + $entityClass + $listener + $objectManager + $objectManager + $objectManager + $resourceClass + $restConfig['entity_identifier_name'] + $restConfig['route_identifier_name'] + + + $config['api-tools'] + $config['api-tools']['doctrine-connected'] + $config['api-tools']['doctrine-connected'] + $config['api-tools-rest'] + $config['doctrine-hydrator'] + $doctrineConnectedConfig['entity_factory'] + $doctrineConnectedConfig['object_manager'] + $doctrineHydratorConfig[$doctrineConnectedConfig['hydrator']]['entity_class'] + $restConfig['entity_identifier_name'] + $restConfig['route_identifier_name'] + $restControllerConfig['listener'] + + + $doctrineHydratorConfig[$doctrineConnectedConfig['hydrator']] + $queryProviders[$method] + + + $config + $config + $configuredListener + $createFilterManager + $doctrineConnectedConfig + $doctrineHydratorConfig + $entityClass + $entityFactory + $filterManagerAlias + $hydratorManager + $listener + $listeners[] + $method + $objectManager + $plugin + $provider + $queryManager + $queryProviders[$method] + $queryProviders['default'] + $queryProviders['default'] + $resourceClass + $restConfig + $restControllerConfig + $viewHelpers + + + HydratorInterface + + + attach + get + get + get + get + get + get + getEventManager + getSharedManager + has + setObjectManager + + + $hydratorManager->get($doctrineConnectedConfig['hydrator']) + + + null + null + null + + + $container + $container + + + + + NoObjectExistsFactory + + + getServiceLocator + + + $objectRepository + + + getRepository + + + $container + + + $options + + + + + ObjectExistsFactory + + + getServiceLocator + + + $objectRepository + + + getRepository + + + $container + + + $options + + + + + Driver::class + + + RevType + RevType + + + + + Driver::class + + + + + $this->container->reveal() + + + reveal + reveal + + + + + $this->container->reveal() + $this->container->reveal() + $this->container->reveal() + + + willReturn + willReturn + willReturn + + + get + has + has + reveal + reveal + reveal + + + + + $a['service_name'] + $b['service_name'] + $result[0]['fields'] + $result[0]['fields'] + $result[1]['fields'] + $result[2]['fields'] + + + + $result[0]['entity_class'] + $result[0]['entity_class'] + $result[0]['fields'] + $result[0]['fields'] + $result[0]['service_name'] + $result[0]['service_name'] + $result[1]['entity_class'] + $result[1]['fields'] + $result[1]['service_name'] + $result[2]['entity_class'] + $result[2]['fields'] + $result[2]['service_name'] + + + null + null + null + null + + + assertIsArray + assertIsArray + + + Album + Artist + Meta + Product + + + + + $body + $body + $controllerServiceName + $em + $filter($mapping['fieldName']) + $this->getResponse()->getBody() + $this->getResponse()->getBody() + + + $body['name'] + $mapping['fieldName'] + $mapping['fieldName'] + $mapping['fieldName'] + $mapping['sourceEntity'] + $mapping['targetEntity'] + $mapping['type'] + + + $body + $body + $em + $em + $entityMetadata + $mapping + $metadataFactory + $rpcServiceResource + + + addHeaders + create + create + getMetadataFactory + getMetadataFor + setModuleName + setModuleName + + + $mapping['fieldName'] + + + $entityMetadata->associationMappings + + + getBody + getBody + getHeaders + + + $this->resource + + + + + $body + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + + + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['controller_service_name'] + $rpc['controller_service_name'] + $service['controller_service_name'] + + + $body + $body + $body + $body + $rpc + $service + + + addHeaders + delete + delete + getModel + getModel + getModuleName + getModuleName + getModuleName + patch + patch + setModuleName + setModuleName + + + getBody + getBody + getBody + getBody + getHeaders + + + $this->resource + $this->rpcResource + + + + + $this->container->reveal() + $this->container->reveal() + + + reveal + reveal + + + + + $this->container->reveal() + $this->container->reveal() + ConfigResourceFactory::class + ConfigResourceFactory::class + + + $dependency + + + $presence + + + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + + + get + get + get + get + has + has + has + has + has + reveal + reveal + + + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + + + + + + + $this->container->reveal() + $this->container->reveal() + + + $dependency + + + $presence + + + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + + + get + get + get + has + has + has + has + reveal + reveal + + + + + 'Db\Entity\Artist' + + + include __DIR__ . '/../../../../../config/application.config.php' + + + $artist + $controllerServiceName + $em + include __DIR__ . '/../../../../../config/application.config.php' + + + $artist + $em + + + addHeaders + create + delete + getId + setCreatedAt + setModuleName + setName + + + 'Db\Entity\Artist' + Artist + + + getHeaders + setMethod + + + $this->resource + + + + + $this->container->reveal() + $this->container->reveal() + ConfigResourceFactory::class + ConfigResourceFactory::class + + + $dependency + + + $presence + + + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + + + get + get + get + get + has + has + has + has + has + reveal + reveal + + + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + ConfigResourceFactory + + + + + $this->container->reveal() + $this->container->reveal() + + + $dependency + + + $presence + + + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + willReturn + + + get + get + get + get + has + has + has + has + has + reveal + reveal + + + + + Artist::class + Artist::class + Artist::class + + + method + method + method + willReturn + willReturn + with + with + with + + + $entityFactory + $om + + + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + + + $entityFactory + $entityFactory + $om + $om + $om + + + expects + expects + expects + + + + + $class + + + $body['_embedded']['meta'] + $body['_embedded']['meta'] + $config + $config['connectionString'] + $meta + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + DoctrineResource::class + DoctrineResource::class + DoctrineResource::class + DoctrineResource::class + DoctrineResource::class + DoctrineResource::class + EventCatcher::class + Meta::class + Meta::class + Meta::class + Meta::class + Meta::class + Meta::class + + + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['id'] + $body['name'] + $body['name'] + $body['name'] + $body['name'] + $body['name'] + $body['total_items'] + $body['total_items'] + $config['api-tools'] + $config['api-tools'] + $config['connectionString'] + $config['dbname'] + $config['doctrine'] + + + $config['api-tools'] + $resourceConfig['entity_factory'] + + + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $collection + $config + $config + $config + $config['api-tools']['doctrine-connected'][$resourceName] + $db + $eventCatcher + $id + $id + $meta + $resourceConfig + $this->dm + + + Meta + + + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaders + addHeaders + addHeaders + addHeaders + format + getCaughtEvents + getCreatedAt + getId + getName + getName + method + new $class() + remove + setCreatedAt + setName + willReturnCallback + with + + + $id + $id + + + $db->meta + + + $meta + + + attach + attach + attach + attach + attach + attach + getCreatedAt + getId + getName + getName + + + DoctrineResource + DoctrineResource + DoctrineResource + DoctrineResource + DoctrineResource + DoctrineResource + EventCatcher + Meta + Meta + Meta + Meta + Meta + Meta + Meta + Meta + Meta + + + $entityFactoryMock + $entityFactoryMock + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta + $meta1 + $meta2 + Meta + + + expects + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getConfig + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + + + + + $class + + + $album->getId() + $artist + $artist->getId() + $body['_embedded']['artist'] + $body['_embedded']['artist'] + $config + $event + $eventCatcher->getCaughtEvents() + $filter($mapping['fieldName']) + $product + $product->getId() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + $this->getResponse()->getBody() + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + Artist::class + DoctrineResource::class + DoctrineResource::class + EventCatcher::class + EventCatcher::class + + + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['_embedded'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['detail'] + $body['id'] + $body['id'] + $body['id'] + $body['name'] + $body['name'] + $body['name'] + $body['name'] + $body['name'] + $body['name'] + $body['name'] + $body['total_items'] + $body['total_items'] + $body['version'] + $config['api-tools'] + $config['api-tools'] + $config['api-tools'] + $mapping['fieldName'] + $mapping['fieldName'] + $mapping['fieldName'] + $mapping['sourceEntity'] + $mapping['targetEntity'] + $mapping['type'] + + + $config['api-tools'] + $config['api-tools'] + $resourceConfig['entity_factory'] + + + $config['api-tools']['doctrine-connected'][ArtistResource::class] + + + $artist + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $body + $config + $config + $config['api-tools']['doctrine-connected'][$resourceName] + $event + $eventCatcher + $eventCatcher + $id + $id + $id + $mapping + $product + $resourceConfig + + + Album + Artist + Product + + + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaderLine + addHeaders + addHeaders + addHeaders + addHeaders + addHeaders + addHeaders + addHeaders + addHeaders + format + getCaughtEvents + getCaughtEvents + getCreatedAt + getId + getId + getId + getId + getName + getName + method + new $class() + setCreatedAt + setName + willReturnCallback + with + + + $id + $id + $id + $mapping['fieldName'] + + + $artist + $product + + + $entityMetadata->associationMappings + + + attach + attach + getCreatedAt + getId + getId + getId + getId + getName + getName + + + ?Artist + Album + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + Artist + ArtistResource + DoctrineResource + DoctrineResource + EventCatcher + EventCatcher + Product + Product + + + $album + $album + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist + $artist1 + $artist1 + $artist1 + $artist1 + $artist1 + $artist1 + $artist1 + $artist2 + $artist2 + $artist2 + $artist2 + $artist2 + $artist2 + $artist2 + $artist3 + $artist3 + $artist3 + $artist3 + $artist3 + $artist3 + $entityFactoryMock + $entityFactoryMock + $product + $product + $product + $product + $product + $product + Album + Artist + Product + + + expects + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getBody + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + getHeaders + setAllowOverride + setAllowOverride + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setMethod + setService + setService + + + + + $validatorsConfig + NoObjectExists::class + NoObjectExists::class + + + $config['validators'] + + + $config + $validatorsConfig + + + willReturn + + + willReturn + + + reveal + reveal + + + NoObjectExists + NoObjectExists + + + + + $validatorsConfig + ObjectExists::class + ObjectExists::class + + + $config['validators'] + + + $config + $validatorsConfig + + + willReturn + + + willReturn + + + reveal + reveal + + + ObjectExists + ObjectExists + + + + + parent::setApplicationConfig($config) + + + $config['modules'] + + + $config['module_listener_options']['module_paths'] + + + $file + $this->enabledModules + + + $file + + + $config + + + $this + + + $config + + + getNumberOfRequiredParameters + + + diff --git a/psalm.xml.dist b/psalm.xml.dist index 3f811f2a..58035a27 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -13,6 +13,8 @@ + + diff --git a/src/Admin/Model/DoctrineRestServiceModel.php b/src/Admin/Model/DoctrineRestServiceModel.php index 203434cb..10040b6d 100644 --- a/src/Admin/Model/DoctrineRestServiceModel.php +++ b/src/Admin/Model/DoctrineRestServiceModel.php @@ -447,7 +447,7 @@ public function createService(NewDoctrineServiceEntity $details) /** * Update an existing service * - * @return DoctrineRestServiceEntity + * @return DoctrineRestServiceEntity|false */ public function updateService(DoctrineRestServiceEntity $update) { @@ -477,7 +477,7 @@ public function updateService(DoctrineRestServiceEntity $update) * @todo Remove content-negotiation and/or HAL configuration? * @param string $controllerService * @param bool $recursive - * @return true + * @return ApiProblem|true */ public function deleteService($controllerService, $recursive = false) { @@ -495,7 +495,7 @@ public function deleteService($controllerService, $recursive = false) Utility::recursiveDelete(dirname($reflection->getFileName())); } $this->deleteRoute($service); - $response = $this->deleteDoctrineRestConfig($service); + $this->deleteDoctrineRestConfig($service); if ($response instanceof ApiProblem) { return $response; @@ -676,6 +676,7 @@ public function createMediaType() * @param string $controllerService * @param string $resourceClass * @param string $routeName + * @return void */ public function createRestConfig(DoctrineRestServiceEntity $details, $controllerService, $resourceClass, $routeName) { @@ -706,6 +707,7 @@ public function createRestConfig(DoctrineRestServiceEntity $details, $controller * controller service name * * @param string $controllerService + * @return void */ public function createContentNegotiationConfig(DoctrineRestServiceEntity $details, $controllerService) { @@ -732,12 +734,12 @@ public function createContentNegotiationConfig(DoctrineRestServiceEntity $detail * @param string $entityClass * @param string $collectionClass * @param string $routeName + * @return void */ public function createDoctrineConfig(DoctrineRestServiceEntity $details, $entityClass, $collectionClass, $routeName) { - $entityValue = $details->getArrayCopy(); - $objectManager = $this->getServiceManager()->get($details->objectManager); - $hydratorStrategies = []; + $details->getArrayCopy(); + $this->getServiceManager()->get($details->objectManager); // The abstract_factories key is set to the value so these factories do not get duplicaed with each resource $config = [ @@ -760,6 +762,7 @@ public function createDoctrineConfig(DoctrineRestServiceEntity $details, $entity * @param string $entityClass * @param string $collectionClass * @param string $routeName + * @return void * @throws CreationException */ public function createDoctrineHydratorConfig( @@ -771,7 +774,7 @@ public function createDoctrineHydratorConfig( $entityValue = $details->getArrayCopy(); // Verify the object manager exists - $objectManager = $this->getServiceManager()->get($details->objectManager); + $this->getServiceManager()->get($details->objectManager); $hydratorStrategies = $entityValue['strategies'] ?? []; foreach ($hydratorStrategies as $strategy) { @@ -802,6 +805,7 @@ public function createDoctrineHydratorConfig( * @param string $entityClass * @param string $collectionClass * @param string $routeName + * @return void */ public function createHalConfig(DoctrineRestServiceEntity $details, $entityClass, $collectionClass, $routeName) { @@ -831,6 +835,8 @@ public function createHalConfig(DoctrineRestServiceEntity $details, $entityClass /** * Update the route for an existing service + * + * @return void */ public function updateRoute(DoctrineRestServiceEntity $original, DoctrineRestServiceEntity $update) { @@ -857,6 +863,8 @@ public function updateRoute(DoctrineRestServiceEntity $original, DoctrineRestSer /** * Update REST configuration + * + * @return void */ public function updateRestConfig(DoctrineRestServiceEntity $original, DoctrineRestServiceEntity $update) { @@ -888,10 +896,11 @@ public function updateRestConfig(DoctrineRestServiceEntity $original, DoctrineRe /** * Update Doctrine hydrator configuration + * + * @return void */ public function updateDoctrineHydratorConfig(DoctrineRestServiceEntity $original, DoctrineRestServiceEntity $update) { - $patch = []; foreach ($this->doctrineHydratorOptions as $property => $configKey) { if ($update->$property === null) { continue; @@ -903,6 +912,8 @@ public function updateDoctrineHydratorConfig(DoctrineRestServiceEntity $original /** * Update the content negotiation configuration for the service + * + * @return void */ public function updateContentNegotiationConfig( DoctrineRestServiceEntity $original, @@ -931,6 +942,8 @@ public function updateContentNegotiationConfig( /** * Update Doctrine configuration + * + * @return void */ public function updateDoctrineConfig(DoctrineRestServiceEntity $original, DoctrineRestServiceEntity $update) { @@ -945,6 +958,8 @@ public function updateDoctrineConfig(DoctrineRestServiceEntity $original, Doctri /** * Delete the files which were automatically created + * + * @return void */ public function deleteFiles(DoctrineRestServiceEntity $entity) { @@ -962,6 +977,8 @@ public function deleteFiles(DoctrineRestServiceEntity $entity) /** * Delete the route associated with the given service + * + * @return void */ public function deleteRoute(DoctrineRestServiceEntity $entity) { @@ -981,13 +998,15 @@ public function deleteRoute(DoctrineRestServiceEntity $entity) /** * Delete the REST configuration associated with the given * service + * + * @return void */ public function deleteDoctrineRestConfig(DoctrineRestServiceEntity $entity) { // Get hydrator name - $config = $this->configResource->fetch(true); - $hydratorName = $config['api-tools-hal']['metadata_map'][$entity->entityClass]['hydrator']; - $objectManagerClass = $config['doctrine-hydrator'][$hydratorName]['object_manager']; + $config = $this->configResource->fetch(true); + $hydratorName = $config['api-tools-hal']['metadata_map'][$entity->entityClass]['hydrator']; + $config['doctrine-hydrator'][$hydratorName]['object_manager']; $key = ['doctrine-hydrator', $hydratorName]; $this->configResource->deleteKey($key); @@ -1129,6 +1148,7 @@ protected function getRouteNameFilter() * Retrieve route information for a given service based on the configuration available * * @param array $config + * @return void */ protected function getRouteInfo(DoctrineRestServiceEntity $metadata, array $config) { @@ -1151,6 +1171,7 @@ protected function getRouteInfo(DoctrineRestServiceEntity $metadata, array $conf * * @param string $controllerServiceName * @param array $config + * @return void */ protected function mergeContentNegotiationConfig( $controllerServiceName, @@ -1187,6 +1208,7 @@ protected function mergeContentNegotiationConfig( * * @param string $controllerServiceName * @param array $config + * @return void */ protected function mergeHalConfig($controllerServiceName, DoctrineRestServiceEntity $metadata, array $config) { diff --git a/src/Admin/Model/DoctrineRestServiceResource.php b/src/Admin/Model/DoctrineRestServiceResource.php index 658e0a5c..f460a8b3 100644 --- a/src/Admin/Model/DoctrineRestServiceResource.php +++ b/src/Admin/Model/DoctrineRestServiceResource.php @@ -7,6 +7,7 @@ use Exception; use Laminas\ApiTools\Admin\Model\DocumentationModel; use Laminas\ApiTools\Admin\Model\InputFilterModel; +use Laminas\ApiTools\Admin\Model\RestServiceModel; use Laminas\ApiTools\Admin\Model\RestServiceResource; use Laminas\ApiTools\ApiProblem\ApiProblem; @@ -39,7 +40,7 @@ public function setModuleName($moduleName) /** * @param string $type - * @return DoctrineRestServiceModel + * @return RestServiceModel */ public function getModel($type = DoctrineRestServiceModelFactory::TYPE_DEFAULT) { diff --git a/src/Admin/Model/DoctrineRpcServiceModel.php b/src/Admin/Model/DoctrineRpcServiceModel.php index 4701f486..86bae15e 100644 --- a/src/Admin/Model/DoctrineRpcServiceModel.php +++ b/src/Admin/Model/DoctrineRpcServiceModel.php @@ -107,7 +107,8 @@ public function fetch($controllerServiceName) * Fetch all services * * @param string $version - * @return DoctrineRpcServiceEntity[] + * @return (DoctrineRpcServiceEntity|false)[] + * @psalm-return list */ public function fetchAll($version = null) { @@ -164,7 +165,7 @@ public function fetchAll($version = null) * @param array $httpMethods * @param null|string $selector * @param array $options - * @return DoctrineRpcServiceEntity + * @return DoctrineRpcServiceEntity|false */ public function createService($serviceName, $route, $httpMethods, $selector, $options) { @@ -208,10 +209,12 @@ public function deleteService(DoctrineRpcServiceEntity $entity, $deleteFiles = t /** * Delete the files which were automatically created + * + * @return void */ public function deleteFiles(DoctrineRpcServiceEntity $entity) { - $config = $this->configResource->fetch(true); + $this->configResource->fetch(true); $reflector = new ReflectionClass($entity->controllerClass); unlink($reflector->getFileName()); @@ -421,7 +424,7 @@ public function createContentNegotiationConfig($controllerService, $selector = n * * @param string $controllerService * @param string $routeMatch - * @return true + * @return bool */ public function updateRoute($controllerService, $routeMatch) { @@ -500,6 +503,7 @@ public function updateContentNegotiationWhitelist($controllerService, $headerTyp * Removes the route configuration for a named route * * @param string $routeName + * @return void */ public function deleteRouteConfig($routeName) { @@ -516,6 +520,7 @@ public function deleteRouteConfig($routeName) * Delete the RPC configuration for a named RPC service * * @param string $serviceName + * @return void */ public function deleteDoctrineRpcConfig($serviceName) { @@ -551,6 +556,7 @@ public function deleteDoctrineRpcConfig($serviceName) * service * * @param string $serviceName + * @return void */ public function deleteContentNegotiationConfig($serviceName) { diff --git a/src/Admin/Model/DoctrineRpcServiceResource.php b/src/Admin/Model/DoctrineRpcServiceResource.php index 79a4990c..f0453c16 100644 --- a/src/Admin/Model/DoctrineRpcServiceResource.php +++ b/src/Admin/Model/DoctrineRpcServiceResource.php @@ -7,6 +7,7 @@ use Exception; use Laminas\ApiTools\Admin\Model\DocumentationModel; use Laminas\ApiTools\Admin\Model\InputFilterModel; +use Laminas\ApiTools\Admin\Model\RpcServiceModel; use Laminas\ApiTools\Admin\Model\RpcServiceResource; use Laminas\ApiTools\ApiProblem\ApiProblem; use Laminas\ApiTools\Rest\Exception\CreationException; @@ -42,7 +43,7 @@ public function setModuleName($moduleName) } /** - * @return DoctrineRpcServiceModel + * @return RpcServiceModel */ public function getModel() { diff --git a/src/Server/Event/Listener/CollectionListener.php b/src/Server/Event/Listener/CollectionListener.php index b5276923..ed4ea487 100644 --- a/src/Server/Event/Listener/CollectionListener.php +++ b/src/Server/Event/Listener/CollectionListener.php @@ -16,6 +16,7 @@ use Laminas\Hydrator\HydratorInterface; use Laminas\InputFilter\CollectionInputFilter; use Laminas\InputFilter\InputFilterInterface; +use Laminas\InputFilter\InputInterface; use Laminas\ServiceManager\ServiceLocatorInterface; use Laminas\Stdlib\ArrayObject; use Phpro\DoctrineHydrationModule\Service\DoctrineHydratorFactory; @@ -280,7 +281,7 @@ protected function validateAssociationData($association, $data) /** * @param string $association - * @return InputFilterInterface + * @return InputFilterInterface|InputInterface */ protected function getAssociatedEntityInputFilter($association, InputFilterInterface $inputFilter) { diff --git a/src/Server/Module.php b/src/Server/Module.php index c4adafd1..5f7511d4 100644 --- a/src/Server/Module.php +++ b/src/Server/Module.php @@ -22,6 +22,8 @@ public function getConfig() /** * Module init + * + * @return void */ public function init(ModuleManager $moduleManager) { diff --git a/src/Server/Paginator/Adapter/DoctrineOdmAdapter.php b/src/Server/Paginator/Adapter/DoctrineOdmAdapter.php index 8e9f7395..849096ac 100644 --- a/src/Server/Paginator/Adapter/DoctrineOdmAdapter.php +++ b/src/Server/Paginator/Adapter/DoctrineOdmAdapter.php @@ -22,6 +22,7 @@ public function __construct($queryBuilder) /** * @param Builder $queryBuilder + * @return void */ public function setQueryBuilder($queryBuilder) { diff --git a/src/Server/Query/CreateFilter/AbstractCreateFilter.php b/src/Server/Query/CreateFilter/AbstractCreateFilter.php index 0bd4d3ed..9b563d62 100644 --- a/src/Server/Query/CreateFilter/AbstractCreateFilter.php +++ b/src/Server/Query/CreateFilter/AbstractCreateFilter.php @@ -22,6 +22,8 @@ abstract public function filter(ResourceEvent $event, $entityClass, $data); /** * Set the object manager + * + * @return void */ public function setObjectManager(ObjectManager $objectManager) { diff --git a/src/Server/Query/Provider/AbstractQueryProvider.php b/src/Server/Query/Provider/AbstractQueryProvider.php index 3fe35029..2a95a79b 100644 --- a/src/Server/Query/Provider/AbstractQueryProvider.php +++ b/src/Server/Query/Provider/AbstractQueryProvider.php @@ -19,6 +19,8 @@ abstract class AbstractQueryProvider implements ObjectManagerAwareInterface, Que /** * Set the object manager + * + * @return void */ public function setObjectManager(ObjectManager $objectManager) { diff --git a/src/Server/Resource/DoctrineResource.php b/src/Server/Resource/DoctrineResource.php index c9ba5fec..8a5ca8b5 100644 --- a/src/Server/Resource/DoctrineResource.php +++ b/src/Server/Resource/DoctrineResource.php @@ -160,7 +160,7 @@ public function getEventManager() /** * Set the object manager * - * @param ObjectManager|EntityManagerInterface $objectManager + * @return void */ public function setObjectManager(ObjectManager $objectManager) { @@ -179,6 +179,7 @@ public function getObjectManager() /** * @param array|QueryProviderInterface[] $queryProviders + * @return void * @throws InvalidArgumentException If parameter is not an array or \Traversable object. */ public function setQueryProviders($queryProviders) @@ -197,7 +198,7 @@ public function setQueryProviders($queryProviders) } /** - * @return array|QueryProviderInterface[] + * @return QueryProviderInterface|array */ public function getQueryProviders() { @@ -539,7 +540,7 @@ public function fetchAll($data = []) } // Add event to set extra HAL data - $entityClass = $this->getEntityClass(); + $this->getEntityClass(); $this->getSharedEventManager()->attach( RestController::class, diff --git a/src/Server/Validator/NoObjectExistsFactory.php b/src/Server/Validator/NoObjectExistsFactory.php index 33e85efa..8ee07e48 100644 --- a/src/Server/Validator/NoObjectExistsFactory.php +++ b/src/Server/Validator/NoObjectExistsFactory.php @@ -59,6 +59,7 @@ public function createService(ServiceLocatorInterface $container) * Allow injecting options at build time; required for v2 compatibility. * * @param array $options + * @return void */ public function setCreationOptions(array $options) { diff --git a/src/Server/Validator/ObjectExistsFactory.php b/src/Server/Validator/ObjectExistsFactory.php index a82e7df8..d6f2c2c8 100644 --- a/src/Server/Validator/ObjectExistsFactory.php +++ b/src/Server/Validator/ObjectExistsFactory.php @@ -59,6 +59,7 @@ public function createService(ServiceLocatorInterface $container) * Allow injecting options at build time; required for v2 compatibility. * * @param array $options + * @return void */ public function setCreationOptions(array $options) { diff --git a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Album.php b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Album.php index e2efaaa8..a0f3eda5 100644 --- a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Album.php +++ b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Album.php @@ -23,7 +23,10 @@ public function getName() return $this->name; } - public function setName($value) + /** + * @return static + */ + public function setName(string $value): self { $this->name = $value; @@ -37,7 +40,10 @@ public function getCreatedAt() return $this->createdAt; } - public function setCreatedAt(DateTime $value) + /** + * @return static + */ + public function setCreatedAt(DateTime $value): self { $this->createdAt = $value; @@ -51,7 +57,10 @@ public function getArtist() return $this->artist; } - public function setArtist($value) + /** + * @return static + */ + public function setArtist(Artist $value): self { $this->artist = $value; diff --git a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Artist.php b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Artist.php index a7d573e6..4d09f6d9 100644 --- a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Artist.php +++ b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Artist.php @@ -33,7 +33,10 @@ public function getName() return $this->name; } - public function setName($value) + /** + * @return static + */ + public function setName(string $value): self { $this->name = $value; @@ -47,7 +50,10 @@ public function getCreatedAt() return $this->createdAt; } - public function setCreatedAt(DateTime $value) + /** + * @return static + */ + public function setCreatedAt(DateTime $value): self { $this->createdAt = $value; @@ -88,9 +94,12 @@ public function addAlbum($album) * Remove album * * @param Album $album + * * @throws Exception + * + * @return void */ - public function removeAlbum($album) + public function removeAlbum($album): void { if ($album instanceof Album) { $this->album[] = $album; diff --git a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Product.php b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Product.php index 37dbb29b..23804b6c 100644 --- a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Product.php +++ b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Entity/Product.php @@ -20,7 +20,7 @@ public function getVersion() return $this->version; } - public function setVersion($version) + public function setVersion($version): void { $this->version = $version; } diff --git a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/EventListener/ArtistAggregateListener.php b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/EventListener/ArtistAggregateListener.php index 1fdf6614..629babf7 100644 --- a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/EventListener/ArtistAggregateListener.php +++ b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/EventListener/ArtistAggregateListener.php @@ -20,9 +20,9 @@ public function attach(EventManagerInterface $events, $priority = 1) ); } - public function createPost(DoctrineResourceEvent $event) + public function createPost(DoctrineResourceEvent $event): void { - $objectManager = $event->getObjectManager(); + $event->getObjectManager(); $event->getEntity(); $event->getData(); diff --git a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Module.php b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Module.php index 99f4410c..b24eda00 100644 --- a/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Module.php +++ b/test/assets/module/LaminasTestApiToolsDb/src/LaminasTestApiToolsDb/Module.php @@ -14,7 +14,11 @@ public function getConfig() return include __DIR__ . '/../../config/module.config.php'; } - public function getAutoloaderConfig() + /** + * @return string[][][] + * @psalm-return array>> + */ + public function getAutoloaderConfig(): array { return [ StandardAutoloader::class => [ diff --git a/test/assets/module/LaminasTestApiToolsDbApi/src/LaminasTestApiToolsDbApi/Module.php b/test/assets/module/LaminasTestApiToolsDbApi/src/LaminasTestApiToolsDbApi/Module.php index 6f1df590..ed9fd87b 100644 --- a/test/assets/module/LaminasTestApiToolsDbApi/src/LaminasTestApiToolsDbApi/Module.php +++ b/test/assets/module/LaminasTestApiToolsDbApi/src/LaminasTestApiToolsDbApi/Module.php @@ -9,12 +9,21 @@ class Module implements ApiToolsProviderInterface { - public function getConfig() + /** + * @return array + * + * @psalm-return array + */ + public function getConfig(): array { return include __DIR__ . '/../../config/module.config.php'; } - public function getAutoloaderConfig() + /** + * @return string[][][] + * @psalm-return array>> + */ + public function getAutoloaderConfig(): array { return [ StandardAutoloader::class => [ diff --git a/test/assets/module/LaminasTestApiToolsDbMongo/src/LaminasTestApiToolsDbMongo/Document/Meta.php b/test/assets/module/LaminasTestApiToolsDbMongo/src/LaminasTestApiToolsDbMongo/Document/Meta.php index a05c63bf..e84a8b94 100644 --- a/test/assets/module/LaminasTestApiToolsDbMongo/src/LaminasTestApiToolsDbMongo/Document/Meta.php +++ b/test/assets/module/LaminasTestApiToolsDbMongo/src/LaminasTestApiToolsDbMongo/Document/Meta.php @@ -22,7 +22,10 @@ public function getName() return $this->name; } - public function setName($value) + /** + * @return static + */ + public function setName(string $value): self { $this->name = $value; @@ -36,12 +39,17 @@ public function getCreatedAt() return $this->createdAt; } - public function setCreatedAt(DateTime $value) + public function setCreatedAt(DateTime $value): void { $this->createdAt = $value; } - public function getArrayCopy() + /** + * @return array + * + * @psalm-return array{name: mixed, createdAt: mixed} + */ + public function getArrayCopy(): array { return [ 'name' => $this->getName(), @@ -49,7 +57,7 @@ public function getArrayCopy() ]; } - public function exchangeArray($values) + public function exchangeArray($values): void { $this->setName($values['name'] ?? null); $this->setCreatedAt($values['createdAt'] ?? null); diff --git a/test/assets/module/LaminasTestApiToolsDbMongo/src/LaminasTestApiToolsDbMongo/Module.php b/test/assets/module/LaminasTestApiToolsDbMongo/src/LaminasTestApiToolsDbMongo/Module.php index 2d3990a1..5993803c 100644 --- a/test/assets/module/LaminasTestApiToolsDbMongo/src/LaminasTestApiToolsDbMongo/Module.php +++ b/test/assets/module/LaminasTestApiToolsDbMongo/src/LaminasTestApiToolsDbMongo/Module.php @@ -14,7 +14,11 @@ public function getConfig() return include __DIR__ . '/../../config/module.config.php'; } - public function getAutoloaderConfig() + /** + * @return string[][][] + * @psalm-return array>> + */ + public function getAutoloaderConfig(): array { return [ StandardAutoloader::class => [ diff --git a/test/assets/module/LaminasTestApiToolsDbMongoApi/src/LaminasTestApiToolsDbMongoApi/Module.php b/test/assets/module/LaminasTestApiToolsDbMongoApi/src/LaminasTestApiToolsDbMongoApi/Module.php index bb749c64..c16873e1 100644 --- a/test/assets/module/LaminasTestApiToolsDbMongoApi/src/LaminasTestApiToolsDbMongoApi/Module.php +++ b/test/assets/module/LaminasTestApiToolsDbMongoApi/src/LaminasTestApiToolsDbMongoApi/Module.php @@ -9,12 +9,21 @@ class Module implements ApiToolsProviderInterface { - public function getConfig() + /** + * @return array + * + * @psalm-return array + */ + public function getConfig(): array { return include __DIR__ . '/../../config/module.config.php'; } - public function getAutoloaderConfig() + /** + * @return string[][][] + * @psalm-return array>> + */ + public function getAutoloaderConfig(): array { return [ StandardAutoloader::class => [ diff --git a/test/assets/module/LaminasTestApiToolsGeneral/src/LaminasTestApiToolsGeneral/Listener/EventCatcher.php b/test/assets/module/LaminasTestApiToolsGeneral/src/LaminasTestApiToolsGeneral/Listener/EventCatcher.php index c757ebb9..9f9be637 100644 --- a/test/assets/module/LaminasTestApiToolsGeneral/src/LaminasTestApiToolsGeneral/Listener/EventCatcher.php +++ b/test/assets/module/LaminasTestApiToolsGeneral/src/LaminasTestApiToolsGeneral/Listener/EventCatcher.php @@ -21,7 +21,7 @@ class EventCatcher /** @var array */ protected $caughtEvents = []; - public function attachShared(SharedEventManagerInterface $events) + public function attachShared(SharedEventManagerInterface $events): void { $listener = $events->attach(self::EVENT_IDENTIFIER, '*', [$this, 'listen']); @@ -32,7 +32,7 @@ public function attachShared(SharedEventManagerInterface $events) $this->listeners[] = $listener; } - public function detachShared(SharedEventManagerInterface $events) + public function detachShared(SharedEventManagerInterface $events): void { $eventManagerVersion = method_exists($events, 'getEvents') ? 2 : 3; @@ -52,7 +52,7 @@ public function detachShared(SharedEventManagerInterface $events) } } - public function listen(Event $e) + public function listen(Event $e): void { $this->caughtEvents[] = $e->getName(); array_unique($this->caughtEvents); diff --git a/test/assets/module/LaminasTestApiToolsGeneral/src/LaminasTestApiToolsGeneral/Module.php b/test/assets/module/LaminasTestApiToolsGeneral/src/LaminasTestApiToolsGeneral/Module.php index f2a79561..d229be67 100644 --- a/test/assets/module/LaminasTestApiToolsGeneral/src/LaminasTestApiToolsGeneral/Module.php +++ b/test/assets/module/LaminasTestApiToolsGeneral/src/LaminasTestApiToolsGeneral/Module.php @@ -17,7 +17,11 @@ public function getConfig() return include __DIR__ . '/../../config/module.config.php'; } - public function getAutoloaderConfig() + /** + * @return string[][][] + * @psalm-return array>> + */ + public function getAutoloaderConfig(): array { return [ StandardAutoloader::class => [ @@ -31,7 +35,7 @@ public function getAutoloaderConfig() /** * Add the event catcher * - * @return array + * @return void */ public function onBootstrap(EventInterface $e) { diff --git a/test/src/Admin/Controller/DoctrineAutodiscoveryControllerFactoryTest.php b/test/src/Admin/Controller/DoctrineAutodiscoveryControllerFactoryTest.php index 0ce1b700..c46d4b21 100644 --- a/test/src/Admin/Controller/DoctrineAutodiscoveryControllerFactoryTest.php +++ b/test/src/Admin/Controller/DoctrineAutodiscoveryControllerFactoryTest.php @@ -34,7 +34,7 @@ protected function setUp(): void $this->container->get(DoctrineAutodiscoveryModel::class)->willReturn($this->model); } - public function testInvokableFactoryReturnsDoctrineAutodiscoveryController() + public function testInvokableFactoryReturnsDoctrineAutodiscoveryController(): void { $factory = new DoctrineAutodiscoveryControllerFactory(); $controller = $factory($this->container->reveal(), DoctrineAutodiscoveryController::class); @@ -43,7 +43,7 @@ public function testInvokableFactoryReturnsDoctrineAutodiscoveryController() $this->assertAttributeSame($this->model, 'model', $controller); } - public function testLegacyFactoryReturnsDoctrineAutodiscoveryController() + public function testLegacyFactoryReturnsDoctrineAutodiscoveryController(): void { $controllers = $this->prophesize(AbstractPluginManager::class); $controllers->getServiceLocator()->willReturn($this->container->reveal()); diff --git a/test/src/Admin/Model/DoctrineAutodiscoveryModelFactoryTest.php b/test/src/Admin/Model/DoctrineAutodiscoveryModelFactoryTest.php index 58e2c28d..6033643d 100644 --- a/test/src/Admin/Model/DoctrineAutodiscoveryModelFactoryTest.php +++ b/test/src/Admin/Model/DoctrineAutodiscoveryModelFactoryTest.php @@ -30,7 +30,7 @@ protected function setUp(): void $this->container->willImplement(ContainerInterface::class); } - public function testFactoryRaisesExceptionIfConfigServiceIsMissing() + public function testFactoryRaisesExceptionIfConfigServiceIsMissing(): void { $factory = new DoctrineAutodiscoveryModelFactory(); @@ -41,7 +41,7 @@ public function testFactoryRaisesExceptionIfConfigServiceIsMissing() $factory($this->container->reveal()); } - public function testFactoryReturnsDoctrineAutodiscoveryModelComposingConfigAndContainer() + public function testFactoryReturnsDoctrineAutodiscoveryModelComposingConfigAndContainer(): void { $factory = new DoctrineAutodiscoveryModelFactory(); diff --git a/test/src/Admin/Model/DoctrineAutodiscoveryModelTest.php b/test/src/Admin/Model/DoctrineAutodiscoveryModelTest.php index 014c4038..68bc60b7 100644 --- a/test/src/Admin/Model/DoctrineAutodiscoveryModelTest.php +++ b/test/src/Admin/Model/DoctrineAutodiscoveryModelTest.php @@ -16,7 +16,7 @@ class DoctrineAutodiscoveryModelTest extends TestCase { - public function testORMAutodiscoveryEntitiesWithFields() + public function testORMAutodiscoveryEntitiesWithFields(): void { $this->setApplicationConfig( include __DIR__ . '/../../../config/ORM/application.config.php' @@ -47,7 +47,7 @@ public function testORMAutodiscoveryEntitiesWithFields() $this->assertCount(1, $result[2]['fields']); } - public function testODMAutodiscoveryEntitiesWithFields() + public function testODMAutodiscoveryEntitiesWithFields(): void { $this->setApplicationConfig( include __DIR__ . '/../../../config/ODM/application.config.php' diff --git a/test/src/Admin/Model/DoctrineMetadata1Test.php b/test/src/Admin/Model/DoctrineMetadata1Test.php index 10cdad5f..dcaf2a8c 100644 --- a/test/src/Admin/Model/DoctrineMetadata1Test.php +++ b/test/src/Admin/Model/DoctrineMetadata1Test.php @@ -35,10 +35,10 @@ protected function tearDown(): void /** * @see https://github.com/zfcampus/zf-apigility/issues/18 */ - public function testDoctrineMetadataResource() + public function testDoctrineMetadataResource(): void { $serviceManager = $this->getApplication()->getServiceManager(); - $em = $serviceManager->get('doctrine.entitymanager.orm_default'); + $serviceManager->get('doctrine.entitymanager.orm_default'); $this->getRequest()->getHeaders()->addHeaders([ 'Accept' => 'application/json', @@ -57,13 +57,13 @@ public function testDoctrineMetadataResource() $this->assertArrayHasKey('_embedded', $body); } - public function testDoctrineService() + public function testDoctrineService(): void { $serviceManager = $this->getApplication()->getServiceManager(); $em = $serviceManager->get('doctrine.entitymanager.orm_default'); $tool = new SchemaTool($em); - $res = $tool->createSchema($em->getMetadataFactory()->getAllMetadata()); + $tool->createSchema($em->getMetadataFactory()->getAllMetadata()); // Create DB $resourceDefinition = [ diff --git a/test/src/Admin/Model/DoctrineMetadata2Test.php b/test/src/Admin/Model/DoctrineMetadata2Test.php index e133b785..11facb75 100644 --- a/test/src/Admin/Model/DoctrineMetadata2Test.php +++ b/test/src/Admin/Model/DoctrineMetadata2Test.php @@ -31,10 +31,10 @@ protected function tearDown(): void /** * @see https://github.com/zfcampus/zf-apigility/issues/18 */ - public function testDoctrineService() + public function testDoctrineService(): void { $serviceManager = $this->getApplication()->getServiceManager(); - $em = $serviceManager->get('doctrine.entitymanager.orm_default'); + $serviceManager->get('doctrine.entitymanager.orm_default'); $this->getRequest()->getHeaders()->addHeaders([ 'Accept' => 'application/json', @@ -66,7 +66,7 @@ public function testDoctrineService() $this->resource->setModuleName('DbApi'); $this->assertEquals($this->resource->getModuleName(), 'DbApi'); - $entity = $this->resource->patch( + $this->resource->patch( 'DbApi\\V1\\Rest\\Artist\\Controller', [ 'routematch' => '/doctrine-changed/test', diff --git a/test/src/Admin/Model/DoctrineMetadataServiceResourceFactoryTest.php b/test/src/Admin/Model/DoctrineMetadataServiceResourceFactoryTest.php index f9e9933f..42c2d58d 100644 --- a/test/src/Admin/Model/DoctrineMetadataServiceResourceFactoryTest.php +++ b/test/src/Admin/Model/DoctrineMetadataServiceResourceFactoryTest.php @@ -25,7 +25,7 @@ protected function setUp(): void $this->container = $this->prophesize(ServiceManager::class); } - public function testFactoryReturnsDoctrineMetadataServiceResource() + public function testFactoryReturnsDoctrineMetadataServiceResource(): void { $factory = new DoctrineMetadataServiceResourceFactory(); diff --git a/test/src/Admin/Model/DoctrineRestServiceModelFactoryFactoryTest.php b/test/src/Admin/Model/DoctrineRestServiceModelFactoryFactoryTest.php index 6055647b..6aa2e9f6 100644 --- a/test/src/Admin/Model/DoctrineRestServiceModelFactoryFactoryTest.php +++ b/test/src/Admin/Model/DoctrineRestServiceModelFactoryFactoryTest.php @@ -84,7 +84,7 @@ public function missingDependencies(): array /** * @dataProvider missingDependencies */ - public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $dependencies) + public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $dependencies): void { $factory = new DoctrineRestServiceModelFactoryFactory(); @@ -97,7 +97,7 @@ public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $depend $factory($this->container->reveal()); } - public function testFactoryReturnsConfiguredDoctrineRestServiceModelFactory() + public function testFactoryReturnsConfiguredDoctrineRestServiceModelFactory(): void { $factory = new DoctrineRestServiceModelFactoryFactory(); $pathSpec = $this->prophesize(ModulePathSpec::class)->reveal(); diff --git a/test/src/Admin/Model/DoctrineRestServiceResourceFactoryTest.php b/test/src/Admin/Model/DoctrineRestServiceResourceFactoryTest.php index 0391e10f..cfc5aef5 100644 --- a/test/src/Admin/Model/DoctrineRestServiceResourceFactoryTest.php +++ b/test/src/Admin/Model/DoctrineRestServiceResourceFactoryTest.php @@ -31,7 +31,12 @@ protected function setUp(): void $this->container = $this->prophesize(ContainerInterface::class); } - /** @psalm-return array}> */ + /** + * @return bool[][][] + * @psalm-return array + * }> + */ public function missingDependencies(): array { return [ @@ -69,7 +74,7 @@ public function missingDependencies(): array /** * @dataProvider missingDependencies */ - public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $dependencies) + public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $dependencies): void { $factory = new DoctrineRestServiceResourceFactory(); @@ -82,7 +87,7 @@ public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $depend $factory($this->container->reveal()); } - public function testFactoryReturnsConfiguredDoctrineRestServiceResource() + public function testFactoryReturnsConfiguredDoctrineRestServiceResource(): void { $factory = new DoctrineRestServiceResourceFactory(); $restFactory = $this->prophesize(DoctrineRestServiceModelFactory::class)->reveal(); diff --git a/test/src/Admin/Model/DoctrineRestServiceResourceTest.php b/test/src/Admin/Model/DoctrineRestServiceResourceTest.php index 2f571498..39e900af 100644 --- a/test/src/Admin/Model/DoctrineRestServiceResourceTest.php +++ b/test/src/Admin/Model/DoctrineRestServiceResourceTest.php @@ -11,8 +11,6 @@ use Laminas\ApiTools\Doctrine\Admin\Model\DoctrineRestServiceResource; use LaminasTest\ApiTools\Doctrine\TestCase; -use function print_r; - class DoctrineRestServiceResourceTest extends TestCase { protected function setUp(): void @@ -33,12 +31,12 @@ protected function tearDown(): void /** * @see https://github.com/zfcampus/zf-apigility/issues/18 */ - public function testCreateReturnsRestServiceEntityWithControllerServiceNamePopulated() + public function testCreateReturnsRestServiceEntityWithControllerServiceNamePopulated(): void { $serviceManager = $this->getApplication()->getServiceManager(); $em = $serviceManager->get('doctrine.entitymanager.orm_default'); - $tool = new SchemaTool($em); + new SchemaTool($em); // Create DB $resourceDefinition = [ @@ -76,10 +74,8 @@ public function testCreateReturnsRestServiceEntityWithControllerServiceNamePopul ] ); - $x = $this->dispatch('/db-api/artist'); + $this->dispatch('/db-api/artist'); $this->resource->delete('DbApi\\V1\\Rest\\Artist\\Controller'); - - print_r($x); } } diff --git a/test/src/Admin/Model/DoctrineRpcServiceModelFactoryFactoryTest.php b/test/src/Admin/Model/DoctrineRpcServiceModelFactoryFactoryTest.php index 1326433c..d149d2fb 100644 --- a/test/src/Admin/Model/DoctrineRpcServiceModelFactoryFactoryTest.php +++ b/test/src/Admin/Model/DoctrineRpcServiceModelFactoryFactoryTest.php @@ -83,7 +83,7 @@ public function missingDependencies(): array /** * @dataProvider missingDependencies */ - public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $dependencies) + public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $dependencies): void { $factory = new DoctrineRpcServiceModelFactoryFactory(); @@ -96,7 +96,7 @@ public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $depend $factory($this->container->reveal()); } - public function testFactoryReturnsConfiguredDoctrineRpcServiceModelFactory() + public function testFactoryReturnsConfiguredDoctrineRpcServiceModelFactory(): void { $factory = new DoctrineRpcServiceModelFactoryFactory(); $pathSpec = $this->prophesize(ModulePathSpec::class)->reveal(); diff --git a/test/src/Admin/Model/DoctrineRpcServiceResourceFactoryTest.php b/test/src/Admin/Model/DoctrineRpcServiceResourceFactoryTest.php index 42e3e117..d8058efb 100644 --- a/test/src/Admin/Model/DoctrineRpcServiceResourceFactoryTest.php +++ b/test/src/Admin/Model/DoctrineRpcServiceResourceFactoryTest.php @@ -82,7 +82,7 @@ public function missingDependencies(): array /** * @dataProvider missingDependencies */ - public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $dependencies) + public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $dependencies): void { $factory = new DoctrineRpcServiceResourceFactory(); @@ -95,7 +95,7 @@ public function testFactoryRaisesExceptionIfDependenciesAreMissing(array $depend $factory($this->container->reveal()); } - public function testFactoryReturnsConfiguredDoctrineRpcServiceResource() + public function testFactoryReturnsConfiguredDoctrineRpcServiceResource(): void { $factory = new DoctrineRpcServiceResourceFactory(); $rpcFactory = $this->prophesize(DoctrineRpcServiceModelFactory::class)->reveal(); diff --git a/test/src/Server/ODM/CRUD/CRUDTest.php b/test/src/Server/ODM/CRUD/CRUDTest.php index ce45cb70..a53c2955 100644 --- a/test/src/Server/ODM/CRUD/CRUDTest.php +++ b/test/src/Server/ODM/CRUD/CRUDTest.php @@ -47,7 +47,7 @@ protected function tearDown(): void parent::tearDown(); } - protected function buildODMApi() + protected function buildODMApi(): void { $serviceManager = $this->getApplication()->getServiceManager(); @@ -74,7 +74,7 @@ protected function buildODMApi() $this->dm = $serviceManager->get('doctrine.documentmanager.odm_default'); } - protected function clearData() + protected function clearData(): void { $config = $this->getApplication()->getConfig(); $config = $config['doctrine']['connection']['odm_default']; @@ -85,7 +85,7 @@ protected function clearData() $collection->remove(); } - public function testCreate() + public function testCreate(): void { $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); @@ -107,7 +107,7 @@ public function testCreate() ]); } - public function testCreateWithListenerThatReturnsApiProblem() + public function testCreateWithListenerThatReturnsApiProblem(): void { $sharedEvents = $this->getApplication()->getEventManager()->getSharedManager(); $sharedEvents->attach( @@ -132,7 +132,7 @@ function (DoctrineResourceEvent $e) { $this->assertEquals('LaminasTestCreateFailure', $body['detail']); } - public function testCreateByExplicitlySettingEntityFactoryInConstructor() + public function testCreateByExplicitlySettingEntityFactoryInConstructor(): void { /** @var InstantiatorInterface|PHPUnit_Framework_MockObject_MockObject $entityFactoryMock */ $entityFactoryMock = $this->getMockBuilder(InstantiatorInterface::class)->getMock(); @@ -182,7 +182,7 @@ public function testCreateByExplicitlySettingEntityFactoryInConstructor() ]); } - public function testFetch() + public function testFetch(): void { $meta = $this->createMeta('Meta Fetch'); $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); @@ -199,7 +199,7 @@ public function testFetch() ]); } - public function testFetchWithListenerThatReturnsApiProblem() + public function testFetchWithListenerThatReturnsApiProblem(): void { $meta = $this->createMeta('Meta Fetch ApiProblem'); $sharedEvents = $this->getApplication()->getEventManager()->getSharedManager(); @@ -222,7 +222,7 @@ function (DoctrineResourceEvent $e) { $this->assertEquals('LaminasTestFetchFailure', $body['detail']); } - public function testFetchAll() + public function testFetchAll(): void { $meta1 = $this->createMeta('Meta 1'); $meta2 = $this->createMeta('Meta 2'); @@ -243,7 +243,7 @@ public function testFetchAll() ]); } - public function testFetchAllEmptyCollection() + public function testFetchAllEmptyCollection(): void { $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); $this->getRequest()->setMethod(Request::METHOD_GET); @@ -260,7 +260,7 @@ public function testFetchAllEmptyCollection() ]); } - public function testFetchAllWithListenerThatReturnsApiProblem() + public function testFetchAllWithListenerThatReturnsApiProblem(): void { $this->createMeta('Meta FetchAll ApiProblem'); $sharedEvents = $this->getApplication()->getEventManager()->getSharedManager(); @@ -282,7 +282,7 @@ function (DoctrineResourceEvent $e) { $this->assertEquals('LaminasTestFetchAllFailure', $body['detail']); } - public function testPatch() + public function testPatch(): void { $meta = $this->createMeta('Meta Patch'); $this->getRequest()->getHeaders()->addHeaders([ @@ -306,7 +306,7 @@ public function testPatch() ]); } - public function testPatchWithListenerThatReturnsApiProblem() + public function testPatchWithListenerThatReturnsApiProblem(): void { $meta = $this->createMeta('Meta Patch ApiProblem'); $sharedEvents = $this->getApplication()->getEventManager()->getSharedManager(); @@ -333,7 +333,7 @@ function (DoctrineResourceEvent $e) { $this->assertEquals('LaminasTestPatchFailure', $body['detail']); } - public function testPut() + public function testPut(): void { $meta = $this->createMeta('Meta Put'); $this->getRequest()->getHeaders()->addHeaders([ @@ -360,7 +360,7 @@ public function testPut() ]); } - public function testPutWithListenerThatReturnsApiProblem() + public function testPutWithListenerThatReturnsApiProblem(): void { $meta = $this->createMeta('Meta Put ApiProblem'); $sharedEvents = $this->getApplication()->getEventManager()->getSharedManager(); @@ -390,7 +390,7 @@ function (DoctrineResourceEvent $e) { $this->assertEquals('LaminasTestPutFailure', $body['detail']); } - public function testDelete() + public function testDelete(): void { $meta = $this->createMeta('Meta Delete'); $id = $meta->getId(); @@ -407,7 +407,7 @@ public function testDelete() ]); } - public function testDeleteWithListenerThatReturnsApiProblem() + public function testDeleteWithListenerThatReturnsApiProblem(): void { $meta = $this->createMeta('Meta Delete ApiProblem'); $sharedEvents = $this->getApplication()->getEventManager()->getSharedManager(); @@ -432,7 +432,7 @@ function (DoctrineResourceEvent $e) { $this->assertEquals($meta->getId(), $foundEntity->getId()); } - public function testDeleteEntityNotFound() + public function testDeleteEntityNotFound(): void { $meta = $this->createMeta(); $id = $meta->getId() . '0'; @@ -446,7 +446,7 @@ public function testDeleteEntityNotFound() $this->assertNull($this->dm->getRepository(Meta::class)->find($id)); } - public function testDeleteEntityDeleted() + public function testDeleteEntityDeleted(): void { $meta = $this->createMeta(); $id = $meta->getId(); @@ -465,7 +465,7 @@ public function testDeleteEntityDeleted() /** * @param array $expectedEvents */ - protected function validateTriggeredEvents(array $expectedEvents) + protected function validateTriggeredEvents(array $expectedEvents): void { $serviceManager = $this->getApplication()->getServiceManager(); $eventCatcher = $serviceManager->get(EventCatcher::class); diff --git a/test/src/Server/ORM/CRUD/CRUDTest.php b/test/src/Server/ORM/CRUD/CRUDTest.php index 7da70f47..9c67001a 100644 --- a/test/src/Server/ORM/CRUD/CRUDTest.php +++ b/test/src/Server/ORM/CRUD/CRUDTest.php @@ -53,7 +53,7 @@ protected function setUp(): void $this->buildORMApi(); } - protected function buildORMApi() + protected function buildORMApi(): void { $serviceManager = $this->getApplication()->getServiceManager(); /** @var EntityManager $em */ @@ -183,7 +183,7 @@ protected function buildORMApi() $this->em = $em; } - public function testCreate() + public function testCreate(): void { $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); @@ -205,7 +205,7 @@ public function testCreate() ]); } - public function testCreateWithRelation() + public function testCreateWithRelation(): void { $artist = $this->createArtist(); $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); @@ -231,7 +231,7 @@ public function testCreateWithRelation() * @param string $method * @param string $message */ - public function testCreateWithListenerThatReturnsApiProblem($method, $message) + public function testCreateWithListenerThatReturnsApiProblem($method, $message): void { $this->$method(DoctrineResourceEvent::EVENT_CREATE_PRE); $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); @@ -254,7 +254,7 @@ public function testCreateWithListenerThatReturnsApiProblem($method, $message) ); } - public function testFetchByCustomIdField() + public function testFetchByCustomIdField(): void { $product = $this->createProduct(); @@ -275,7 +275,7 @@ public function testFetchByCustomIdField() /** * @see https://github.com/zfcampus/zf-apigility-doctrine/pull/316 */ - public function testFetchByCustomIdFieldIncludesApiToolsResourceEventInDoctrineResourceEvent() + public function testFetchByCustomIdFieldIncludesApiToolsResourceEventInDoctrineResourceEvent(): void { $product = $this->createProduct(); @@ -299,7 +299,7 @@ function (DoctrineResourceEvent $e) use ($spy) { $this->assertTrue($spy->caught, 'EVENT_FETCH_PRE listener was not triggered'); } - public function testFetchEntityWithVersionFieldWithVersionParamInPath() + public function testFetchEntityWithVersionFieldWithVersionParamInPath(): void { $product = $this->createProduct(); @@ -318,7 +318,7 @@ public function testFetchEntityWithVersionFieldWithVersionParamInPath() ]); } - public function testFetchByCustomIdFieldWithInvalidIdValue() + public function testFetchByCustomIdFieldWithInvalidIdValue(): void { $product = $this->createProduct(); @@ -331,7 +331,7 @@ public function testFetchByCustomIdFieldWithInvalidIdValue() $this->validateTriggeredEvents([DoctrineResourceEvent::EVENT_FETCH_PRE]); } - public function testCreateByExplicitlySettingEntityFactoryInConstructor() + public function testCreateByExplicitlySettingEntityFactoryInConstructor(): void { /** @var InstantiatorInterface|PHPUnit_Framework_MockObject_MockObject $entityFactoryMock */ $entityFactoryMock = $this->getMockBuilder(InstantiatorInterface::class)->getMock(); @@ -375,7 +375,7 @@ public function testCreateByExplicitlySettingEntityFactoryInConstructor() $this->assertResponseStatusCode(201); } - public function testFetch() + public function testFetch(): void { $artist = $this->createArtist('Artist Name'); $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); @@ -392,7 +392,7 @@ public function testFetch() ]); } - public function testFetchWithNonPrimaryKeyIdentifier() + public function testFetchWithNonPrimaryKeyIdentifier(): void { $artist = $this->createArtist('ArtistTwo'); $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); @@ -405,7 +405,7 @@ public function testFetchWithNonPrimaryKeyIdentifier() $this->assertEquals('ArtistTwo', $body['name']); } - public function testFetchWithRelation() + public function testFetchWithRelation(): void { $artist = $this->createArtist('NewArtist'); $album = $this->createAlbum('NewAlbum', $artist); @@ -424,7 +424,7 @@ public function testFetchWithRelation() * @param string $method * @param string $message */ - public function testFetchWithListenerThatReturnsApiProblem($method, $message) + public function testFetchWithListenerThatReturnsApiProblem($method, $message): void { $artist = $this->createArtist('Artist Fetch ApiProblem'); $this->$method(DoctrineResourceEvent::EVENT_FETCH_PRE); @@ -441,7 +441,7 @@ public function testFetchWithListenerThatReturnsApiProblem($method, $message) ); } - public function testFetchAll() + public function testFetchAll(): void { $artist1 = $this->createArtist('Artist 1'); $artist2 = $this->createArtist('Artist 2'); @@ -462,7 +462,7 @@ public function testFetchAll() ]); } - public function testFetchAllEmptyCollection() + public function testFetchAllEmptyCollection(): void { $this->getRequest()->getHeaders()->addHeaderLine('Accept', 'application/json'); $this->getRequest()->setMethod(Request::METHOD_GET); @@ -484,7 +484,7 @@ public function testFetchAllEmptyCollection() * @param string $method * @param string $message */ - public function testFetchAllWithListenerThatReturnsApiProblem($method, $message) + public function testFetchAllWithListenerThatReturnsApiProblem($method, $message): void { $this->createArtist('Artist FetchAll ApiProblem'); $this->$method(DoctrineResourceEvent::EVENT_FETCH_ALL_PRE); @@ -501,7 +501,7 @@ public function testFetchAllWithListenerThatReturnsApiProblem($method, $message) ); } - public function testPatch() + public function testPatch(): void { $artist = $this->createArtist('Artist Patch'); $this->getRequest()->getHeaders()->addHeaders([ @@ -530,7 +530,7 @@ public function testPatch() * @param string $method * @param string $message */ - public function testPatchWithListenerThatReturnsApiProblem($method, $message) + public function testPatchWithListenerThatReturnsApiProblem($method, $message): void { $artist = $this->createArtist('Artist Patch ApiProblem'); $this->$method(DoctrineResourceEvent::EVENT_PATCH_PRE); @@ -552,7 +552,7 @@ public function testPatchWithListenerThatReturnsApiProblem($method, $message) ); } - public function testPatchList() + public function testPatchList(): void { $artist1 = $this->createArtist('Artist Patch List 1'); $artist2 = $this->createArtist('Artist Patch List 2'); @@ -600,7 +600,7 @@ public function testPatchList() * @param string $method * @param string $message */ - public function testPatchListWithListenerThatReturnsApiProblem($method, $message) + public function testPatchListWithListenerThatReturnsApiProblem($method, $message): void { $artist = $this->createArtist('Artist Patch List ApiProblem'); $this->$method(DoctrineResourceEvent::EVENT_PATCH_LIST_PRE); @@ -627,7 +627,7 @@ public function testPatchListWithListenerThatReturnsApiProblem($method, $message ); } - public function testPut() + public function testPut(): void { $artist = $this->createArtist('Artist Put'); $this->getRequest()->getHeaders()->addHeaders([ @@ -659,7 +659,7 @@ public function testPut() * @param string $method * @param string $message */ - public function testPutWithListenerThatReturnsApiProblem($method, $message) + public function testPutWithListenerThatReturnsApiProblem($method, $message): void { $artist = $this->createArtist('Artist Put ApiProblem'); $this->$method(DoctrineResourceEvent::EVENT_UPDATE_PRE); @@ -684,7 +684,7 @@ public function testPutWithListenerThatReturnsApiProblem($method, $message) ); } - public function testDelete() + public function testDelete(): void { $artist = $this->createArtist('Artist Delete'); $id = $artist->getId(); @@ -706,7 +706,7 @@ public function testDelete() * @param string $method * @param string $message */ - public function testDeleteWithListenerThatReturnsApiProblem($method, $message) + public function testDeleteWithListenerThatReturnsApiProblem($method, $message): void { $artist = $this->createArtist('Artist Delete ApiProblem'); $this->$method(DoctrineResourceEvent::EVENT_DELETE_PRE); @@ -726,7 +726,7 @@ public function testDeleteWithListenerThatReturnsApiProblem($method, $message) $this->assertEquals($artist->getId(), $foundEntity->getId()); } - public function testDeleteEntityNotFound() + public function testDeleteEntityNotFound(): void { $artist = $this->createArtist(); $id = $artist->getId() + 1; @@ -740,7 +740,7 @@ public function testDeleteEntityNotFound() $this->assertNull($this->em->getRepository(Artist::class)->find($id)); } - public function testDeleteEntityDeleted() + public function testDeleteEntityDeleted(): void { $artist = $this->createArtist(); $id = $artist->getId(); @@ -756,7 +756,7 @@ public function testDeleteEntityDeleted() $this->assertNull($this->em->getRepository(Artist::class)->find($id)); } - public function testDeleteList() + public function testDeleteList(): void { $artist1 = $this->createArtist('Artist Delete 1'); $artist2 = $this->createArtist('Artist Delete 2'); @@ -794,7 +794,7 @@ public function testDeleteList() * @param string $method * @param string $message */ - public function testDeleteListWithListenerThatReturnsApiProblem($method, $message) + public function testDeleteListWithListenerThatReturnsApiProblem($method, $message): void { $this->$method(DoctrineResourceEvent::EVENT_DELETE_LIST_PRE); @@ -834,6 +834,10 @@ public function testDeleteListWithListenerThatReturnsApiProblem($method, $messag $this->assertEquals($artist3->getId(), $foundEntity3->getId()); } + /** + * @return void + * @psalm-return never + */ public function testGetRpcNoParams() { $this->markTestIncomplete('Doctrine RPC Services are not fully implemented.'); @@ -846,6 +850,10 @@ public function testGetRpcNoParams() print_r($body); } + /** + * @return void + * @psalm-return never + */ public function testGetRpcWithParams() { $this->markTestIncomplete('Doctrine RPC Services are not fully implemented.'); @@ -864,7 +872,7 @@ public function testGetRpcWithParams() /** * @param array $expectedEvents */ - protected function validateTriggeredEvents(array $expectedEvents) + protected function validateTriggeredEvents(array $expectedEvents): void { $serviceManager = $this->getApplication()->getServiceManager(); $eventCatcher = $serviceManager->get(EventCatcher::class); @@ -875,7 +883,7 @@ protected function validateTriggeredEvents(array $expectedEvents) /** * @param array $expectedEvents */ - protected function validateTriggeredEventsContains(array $expectedEvents) + protected function validateTriggeredEventsContains(array $expectedEvents): void { $serviceManager = $this->getApplication()->getServiceManager(); $eventCatcher = $serviceManager->get(EventCatcher::class); diff --git a/test/src/Server/Validator/NoObjectExistsFactoryTest.php b/test/src/Server/Validator/NoObjectExistsFactoryTest.php index 7c3293a8..80e700e9 100644 --- a/test/src/Server/Validator/NoObjectExistsFactoryTest.php +++ b/test/src/Server/Validator/NoObjectExistsFactoryTest.php @@ -40,7 +40,7 @@ protected function setUp(): void $this->validators = new ValidatorPluginManager($this->serviceManager->reveal(), $validatorsConfig); } - public function testCreate() + public function testCreate(): void { $validator = $this->validators->get( NoObjectExists::class, @@ -53,7 +53,7 @@ public function testCreate() $this->assertInstanceOf(NoObjectExistsOrigin::class, $validator); } - public function testCreateWithEntityClassProvided() + public function testCreateWithEntityClassProvided(): void { $entityManager = $this->prophesize(EntityManager::class); $entityManager->getRepository('MyEntity')->willReturn($this->objectRepository->reveal()); diff --git a/test/src/Server/Validator/ObjectExistsFactoryTest.php b/test/src/Server/Validator/ObjectExistsFactoryTest.php index 6530d455..7d6c4764 100644 --- a/test/src/Server/Validator/ObjectExistsFactoryTest.php +++ b/test/src/Server/Validator/ObjectExistsFactoryTest.php @@ -40,7 +40,7 @@ protected function setUp(): void $this->validators = new ValidatorPluginManager($this->serviceManager->reveal(), $validatorsConfig); } - public function testCreate() + public function testCreate(): void { $validator = $this->validators->get( ObjectExists::class, @@ -53,7 +53,7 @@ public function testCreate() $this->assertInstanceOf(ObjectExistsOrigin::class, $validator); } - public function testCreateWithEntityClassProvided() + public function testCreateWithEntityClassProvided(): void { $entityManager = $this->prophesize(EntityManager::class); $entityManager->getRepository('MyEntity')->willReturn($this->objectRepository->reveal()); diff --git a/test/src/TestCase.php b/test/src/TestCase.php index b28a2548..362430c4 100644 --- a/test/src/TestCase.php +++ b/test/src/TestCase.php @@ -64,7 +64,7 @@ private function removeDir(string $dir): void rmdir($dir); } - private function clearAssets() + private function clearAssets(): void { foreach ($this->enabledModules as $module => $path) { $configPath = sprintf('%s/config/', $path);