diff --git a/composer.json b/composer.json index 81199342..09770492 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ ], "require": { "php": "^7.2 || ^8.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1", - "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9", + "phpdocumentor/reflection-common": "^2.2", "ext-filter": "*" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 26b0d1e6..4d575081 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": "5d0d3ec49d1159ef26291092b2c55192", + "content-hash": "1870f1078b375f5c81d74285af700f1c", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -164,20 +164,20 @@ }, { "name": "webmozart/assert", - "version": "1.9.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451" + "reference": "69d0ffbc0a4a1974c110152f1f192e77fd3ff55d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451", + "url": "https://api.github.com/repos/webmozart/assert/zipball/69d0ffbc0a4a1974c110152f1f192e77fd3ff55d", + "reference": "69d0ffbc0a4a1974c110152f1f192e77fd3ff55d", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -209,26 +209,26 @@ "check", "validate" ], - "time": "2020-06-16T10:16:42+00:00" + "time": "2020-07-05T13:00:00+00:00" } ], "packages-dev": [ { "name": "hamcrest/hamcrest-php", - "version": "v2.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" + "reference": "459c78890d3653178c6a02b4b8aa210e832d28ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", - "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/459c78890d3653178c6a02b4b8aa210e832d28ea", + "reference": "459c78890d3653178c6a02b4b8aa210e832d28ea", "shasum": "" }, "require": { - "php": "^5.3|^7.0" + "php": "^5.3|^7.0|^8.0" }, "replace": { "cordoval/hamcrest-php": "*", @@ -236,14 +236,13 @@ "kodova/hamcrest-php": "*" }, "require-dev": { - "phpunit/php-file-iterator": "1.3.3", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "^1.0" + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -253,26 +252,26 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause" ], "description": "This is the PHP port of Hamcrest Matchers", "keywords": [ "test" ], - "time": "2016-01-20T08:20:44+00:00" + "time": "2020-07-06T18:30:46+00:00" }, { "name": "mockery/mockery", - "version": "1.3.1", + "version": "1.3.x-dev", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be" + "reference": "42daaa724beb47b56a8efe87619430c5c346888d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", - "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", + "url": "https://api.github.com/repos/mockery/mockery/zipball/42daaa724beb47b56a8efe87619430c5c346888d", + "reference": "42daaa724beb47b56a8efe87619430c5c346888d", "shasum": "" }, "require": { @@ -281,7 +280,7 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" + "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0|~9.0" }, "type": "library", "extra": { @@ -324,17 +323,29 @@ "test double", "testing" ], - "time": "2019-12-26T09:49:15+00:00" + "time": "2020-07-06T18:21:40+00:00" + } + ], + "aliases": [ + { + "alias": "1.9.1", + "alias_normalized": "1.9.1.0", + "version": "9999999-dev", + "package": "webmozart/assert" } ], - "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "webmozart/assert": 20, + "mockery/mockery": 20, + "hamcrest/hamcrest-php": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": "^7.2 || ^8.0", "ext-filter": "*" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index e64b587e..a3f52273 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -255,17 +255,7 @@ private function getArgumentsForParametersFromWiring(array $parameters, array $l { $arguments = []; foreach ($parameters as $parameter) { - $type = $parameter->getType(); - $typeHint = null; - if ($type instanceof ReflectionNamedType) { - $typeHint = $type->getName(); - if ($typeHint === 'self') { - $declaringClass = $parameter->getDeclaringClass(); - if ($declaringClass !== null) { - $typeHint = $declaringClass->getName(); - } - } - } + $typeHint = self::getTypeHintAsString($parameter); if (isset($locator[$typeHint])) { $arguments[] = $locator[$typeHint]; @@ -284,6 +274,26 @@ private function getArgumentsForParametersFromWiring(array $parameters, array $l return $arguments; } + private static function getTypeHintAsString(ReflectionParameter $parameter) : ?string + { + $type = $parameter->getType(); + + if (!$type instanceof ReflectionNamedType) { + return null; + } + + $name = $type->getName(); + + if ($name === 'self') { + $declaringClass = $parameter->getDeclaringClass(); + if ($declaringClass !== null) { + return $declaringClass->getName(); + } + } + + return $name; + } + /** * Retrieves a series of ReflectionParameter objects for the static 'create' method of the given * tag handler class name.