diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/composer.json php-phpdocumentor-reflection-docblock-5.3.0/composer.json --- php-phpdocumentor-reflection-docblock-5.2.2/composer.json 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/composer.json 2021-10-19 17:43:47.000000000 +0000 @@ -21,7 +21,8 @@ "ext-filter": "*" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "autoload": { "psr-4": { @@ -30,7 +31,7 @@ }, "autoload-dev": { "psr-4": { - "phpDocumentor\\Reflection\\": "tests/unit" + "phpDocumentor\\Reflection\\": ["tests/unit", "tests/integration"] } }, "extra": { diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/composer.lock php-phpdocumentor-reflection-docblock-5.3.0/composer.lock --- php-phpdocumentor-reflection-docblock-5.2.2/composer.lock 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/composer.lock 2021-10-19 17:43:47.000000000 +0000 @@ -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": "8a52bc233d90a2f83a3d5ac697d9ccdc", + "content-hash": "f1e7818879f1626c05926f50c2c96f44", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -53,20 +53,24 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.3.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", "shasum": "" }, "require": { @@ -74,7 +78,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -98,24 +103,28 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-27T10:12:23+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + }, + "time": "2021-10-02T14:08:47+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-ctype": "For best performance" @@ -123,7 +132,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -160,34 +169,56 @@ "polyfill", "portable" ], - "time": "2020-06-06T08:46:27+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -209,7 +240,11 @@ "check", "validate" ], - "time": "2020-07-08T17:02:28+00:00" + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.10.0" + }, + "time": "2021-03-09T10:59:23+00:00" } ], "packages-dev": [ @@ -258,20 +293,24 @@ "keywords": [ "test" ], + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, "time": "2020-07-09T08:09:16+00:00" }, { "name": "mockery/mockery", - "version": "1.3.3", + "version": "1.3.5", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d" + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/60fa2f67f6e4d3634bb4a45ff3171fa52215800d", - "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", "shasum": "" }, "require": { @@ -323,7 +362,46 @@ "test double", "testing" ], - "time": "2020-08-11T18:10:21+00:00" + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.3.5" + }, + "time": "2021-09-13T15:33:03+00:00" + }, + { + "name": "psalm/phar", + "version": "4.10.0", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "79c5b2210e1a1cabeee671db1160c96869572d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/79c5b2210e1a1cabeee671db1160c96869572d08", + "reference": "79c5b2210e1a1cabeee671db1160c96869572d08", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/4.10.0" + }, + "time": "2021-09-05T00:07:08+00:00" } ], "aliases": [], @@ -336,5 +414,5 @@ "ext-filter": "*" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.1.0" } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/autoloaders/php-phpdocumentor-reflection-docblock php-phpdocumentor-reflection-docblock-5.3.0/debian/autoloaders/php-phpdocumentor-reflection-docblock --- php-phpdocumentor-reflection-docblock-5.2.2/debian/autoloaders/php-phpdocumentor-reflection-docblock 1970-01-01 00:00:00.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/autoloaders/php-phpdocumentor-reflection-docblock 2021-10-30 20:24:35.000000000 +0000 @@ -0,0 +1 @@ +phpdocumentor reflection-docblock phpDocumentor/Reflection/DocBlock/autoload.php diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/autoload.php.tests.tpl php-phpdocumentor-reflection-docblock-5.3.0/debian/autoload.php.tests.tpl --- php-phpdocumentor-reflection-docblock-5.2.2/debian/autoload.php.tests.tpl 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/autoload.php.tests.tpl 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ - Tue, 26 Oct 2021 23:43:29 +0000 - -php-phpdocumentor-reflection-docblock (5.2.2-1build1) impish; urgency=medium - - * No change rebuild for PHP 8.0 - - -- Bryce Harrington Fri, 14 May 2021 21:12:43 +0000 + -- David Prévot Sat, 30 Oct 2021 16:51:04 -0400 php-phpdocumentor-reflection-docblock (5.2.2-1) unstable; urgency=medium diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/clean php-phpdocumentor-reflection-docblock-5.3.0/debian/clean --- php-phpdocumentor-reflection-docblock-5.2.2/debian/clean 2020-09-19 10:59:28.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/clean 2021-10-30 20:36:57.000000000 +0000 @@ -1,5 +1,7 @@ .phpunit.result.cache build/ +debian/autoload.php.tests.tpl +debian/autoload.php.tpl phpDocumentor/ src/DocBlock/autoload.php vendor/ diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/control php-phpdocumentor-reflection-docblock-5.3.0/debian/control --- php-phpdocumentor-reflection-docblock-5.2.2/debian/control 2021-10-26 23:43:04.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/control 2021-10-30 20:49:13.000000000 +0000 @@ -1,18 +1,18 @@ Source: php-phpdocumentor-reflection-docblock Section: php Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian PHP PEAR Maintainers +Maintainer: Debian PHP PEAR Maintainers Uploaders: David Prévot , Prach Pongpanich Build-Depends: debhelper-compat (= 13), + dh-sequence-phpcomposer, php-mockery, php-phpdocumentor-type-resolver, php-webmozart-assert, phpab, phpunit, - pkg-php-tools -Standards-Version: 4.5.0 + pkg-php-tools (>= 1.41~) +Standards-Version: 4.6.0 Homepage: https://phpdoc.org/ Vcs-Git: https://salsa.debian.org/php-team/pear/php-phpdocumentor-reflection-docblock.git -b debian/latest Vcs-Browser: https://salsa.debian.org/php-team/pear/php-phpdocumentor-reflection-docblock diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/gbp.conf php-phpdocumentor-reflection-docblock-5.3.0/debian/gbp.conf --- php-phpdocumentor-reflection-docblock-5.2.2/debian/gbp.conf 2020-09-19 10:50:25.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/gbp.conf 2021-10-30 20:21:38.000000000 +0000 @@ -1,9 +1,5 @@ [DEFAULT] debian-branch = debian/latest +filter = [ '.gitattributes' ] pristine-tar = True -pristine-tar-commit = True - -## Once --filter support gets added to gbp import-ref, we should be able -## to simplify the workflow and ignore the upstream branch. -# filter = [ '.gitattributes' ] -# upstream-tag = %(version%~%-)s +upstream-vcs-tag = %(version%~%-)s diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/install php-phpdocumentor-reflection-docblock-5.3.0/debian/install --- php-phpdocumentor-reflection-docblock-5.2.2/debian/install 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/install 2021-10-30 20:25:21.000000000 +0000 @@ -1 +1,2 @@ -src/* usr/share/php/phpDocumentor/Reflection +debian/autoloaders usr/share/pkg-php-tools +src/* usr/share/php/phpDocumentor/Reflection diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/patches/0001-Adapt-autoload-path-in-examples.patch php-phpdocumentor-reflection-docblock-5.3.0/debian/patches/0001-Adapt-autoload-path-in-examples.patch --- php-phpdocumentor-reflection-docblock-5.2.2/debian/patches/0001-Adapt-autoload-path-in-examples.patch 2020-09-19 10:51:06.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/patches/0001-Adapt-autoload-path-in-examples.patch 2021-10-30 20:21:41.000000000 +0000 @@ -34,7 +34,7 @@ use phpDocumentor\Reflection\DocBlockFactory; diff --git a/examples/03-reconstituting-a-docblock.php b/examples/03-reconstituting-a-docblock.php -index 6bc10ba..eba2214 100644 +index 482a6dd..e54164e 100644 --- a/examples/03-reconstituting-a-docblock.php +++ b/examples/03-reconstituting-a-docblock.php @@ -1,6 +1,6 @@ @@ -46,7 +46,7 @@ use phpDocumentor\Reflection\DocBlock\Serializer; use phpDocumentor\Reflection\DocBlockFactory; diff --git a/examples/04-adding-your-own-tag.php b/examples/04-adding-your-own-tag.php -index 63ba5bf..6cf9c44 100644 +index 49f751d..c27a4de 100644 --- a/examples/04-adding-your-own-tag.php +++ b/examples/04-adding-your-own-tag.php @@ -3,7 +3,7 @@ @@ -57,7 +57,7 @@ +require_once('phpDocumentor/Reflection/DocBlock/autoload.php'); use phpDocumentor\Reflection\DocBlock\Serializer; - use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; + use phpDocumentor\Reflection\DocBlock\Tag; diff --git a/examples/playing-with-descriptions/02-escaping.php b/examples/playing-with-descriptions/02-escaping.php index 5ec772f..aaaf017 100644 --- a/examples/playing-with-descriptions/02-escaping.php diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/patches/0002-Use-system-version-of-php-mockery.patch php-phpdocumentor-reflection-docblock-5.3.0/debian/patches/0002-Use-system-version-of-php-mockery.patch --- php-phpdocumentor-reflection-docblock-5.2.2/debian/patches/0002-Use-system-version-of-php-mockery.patch 2020-09-19 10:51:06.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/patches/0002-Use-system-version-of-php-mockery.patch 2021-10-30 20:21:41.000000000 +0000 @@ -8,10 +8,10 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist -index b14e136..d0ca904 100644 +index fd7ab74..9c2b9b9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist -@@ -32,7 +32,7 @@ +@@ -33,7 +33,7 @@ debian/autoload.php.tpl phpab \ --template debian/autoload.php.tpl \ --output src/DocBlock/autoload.php \ @@ -10,6 +11,10 @@ # Mimic path for tests mkdir --parents phpDocumentor/Reflection vendor ln -s ../../src/DocBlock phpDocumentor/Reflection + phpabtpl \ + --require phpdocumentor/reflection-docblock \ + --require mockery/mockery \ + > debian/autoload.php.tests.tpl phpab \ --template debian/autoload.php.tests.tpl \ --output vendor/autoload.php \ diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/tests/control php-phpdocumentor-reflection-docblock-5.3.0/debian/tests/control --- php-phpdocumentor-reflection-docblock-5.2.2/debian/tests/control 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/tests/control 2021-10-30 20:49:13.000000000 +0000 @@ -1,2 +1,3 @@ -Test-Command: mkdir -p vendor && phpab -t debian/autoload.php.tests.tpl -o vendor/autoload.php tests/unit && phpunit -Depends: php-mockery, phpab, phpunit, @ +Restrictions: rw-build-tree, allow-stderr +Test-Command: mkdir -p vendor && phpabtpl --require phpdocumentor/reflection-docblock --require mockery/mockery > debian/autoload.php.tests.tpl && phpab -t debian/autoload.php.tests.tpl -o vendor/autoload.php tests/unit && phpunit +Depends: php-mockery, phpab, phpunit, pkg-php-tools, @ diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/upstream/changelog php-phpdocumentor-reflection-docblock-5.3.0/debian/upstream/changelog --- php-phpdocumentor-reflection-docblock-5.2.2/debian/upstream/changelog 2020-09-19 10:54:01.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/upstream/changelog 2021-10-30 20:49:13.000000000 +0000 @@ -1,3 +1,27 @@ +• Oct 30, 2021 + 5.3.0 + +Added + + • Get tags with type by name by @voku in #260 + +Fixed + + • Tests: fix typo in test method name by @jrfnl in #279 + • Tests: fix incorrect namespace by @jrfnl in #280 + • Docblock/Tags/Author: fix typo in method docblock by @jrfnl in #283 + • Tests: fix missing @covers tag by @jrfnl in #286 + • Tests: mark test without assertions as such by @jrfnl in #285 + • GH Actions: allow for manually triggering a workflow by @jrfnl in #281 + • GH Actions: simplify Composer caching by @jrfnl in #282 + • Composer: fix autoload-dev directive by @jrfnl in #289 + • DocBlock/Tags/Source: remove redundant code by @jrfnl in #288 + • Improve line-endings for windows. by @jaapio in #296 + • Fix undefined index by @villfa in #298 + • PHPUnit: update configuration by @jrfnl in #303 + • Phive: upgrade used version of PHPUnit by @jrfnl in #292 + • Remove deprecated StaticMethod and fix comment by @kea in #306 + • Sep 17, 2020 5.2.2 diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/debian/watch php-phpdocumentor-reflection-docblock-5.3.0/debian/watch --- php-phpdocumentor-reflection-docblock-5.2.2/debian/watch 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/debian/watch 2021-10-30 20:22:43.000000000 +0000 @@ -1,4 +1,5 @@ -version=3 -options=uversionmangle=s/-?([^\d.])\.?/~$1/i;tr/A-Z/a-z/ \ -https://github.com/phpDocumentor/ReflectionDocBlock/releases \ -.*/archive/v?(\d.+).tar.gz +version=4 +options=uversionmangle=s/-?([^\d.])\.?/~$1/i;tr/A-Z/a-z/,\ +mode=git,gitmode=full,gitexport=all \ +https://github.com/phpDocumentor/ReflectionDocBlock \ +refs/tags/v?(\d.+) diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/examples/03-reconstituting-a-docblock.php php-phpdocumentor-reflection-docblock-5.3.0/examples/03-reconstituting-a-docblock.php --- php-phpdocumentor-reflection-docblock-5.2.2/examples/03-reconstituting-a-docblock.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/examples/03-reconstituting-a-docblock.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,7 +20,7 @@ $docblock = $factory->create($docComment); // Create the serializer that will reconstitute the DocBlock back to its original form. -$serializer = new Serializer(); +$serializer = new Serializer(0, '', true, null, null, PHP_EOL); // Reconstitution is performed by the `getDocComment()` method. $reconstitutedDocComment = $serializer->getDocComment($docblock); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/examples/04-adding-your-own-tag.php php-phpdocumentor-reflection-docblock-5.3.0/examples/04-adding-your-own-tag.php --- php-phpdocumentor-reflection-docblock-5.2.2/examples/04-adding-your-own-tag.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/examples/04-adding-your-own-tag.php 2021-10-19 17:43:47.000000000 +0000 @@ -6,7 +6,7 @@ require_once(__DIR__ . '/../vendor/autoload.php'); use phpDocumentor\Reflection\DocBlock\Serializer; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; +use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlockFactory; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; @@ -30,9 +30,10 @@ * documentation in the form of a Value Object whose properties should not be changed after instantiation (it should be * immutable). * - * > Important: Tag classes that act as Factories using the `create` method should implement the TagFactory interface. + * > Important: Tag classes that act as Factories using the `create` method should implement the Tag interface. + * > Instead, you could extend the abstract class BaseTag that already implements the Tag interface */ -final class MyTag extends BaseTag implements StaticMethod +final class MyTag extends BaseTag { /** * A required property that is used by Formatters to reconstitute the complete tag line. @@ -126,5 +127,5 @@ // As an experiment: let's reconstitute the DocBlock and observe that because we added a __toString() method // to the tag class that we can now also see it. -$serializer = new Serializer(); +$serializer = new Serializer(0, '',true, null, null, PHP_EOL); $reconstitutedDocComment = $serializer->getDocComment($docblock); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/.gitattributes php-phpdocumentor-reflection-docblock-5.3.0/.gitattributes --- php-phpdocumentor-reflection-docblock-5.2.2/.gitattributes 1970-01-01 00:00:00.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/.gitattributes 2021-10-19 17:43:47.000000000 +0000 @@ -0,0 +1,17 @@ +/.gitattributes export-ignore +/.gitignore export-ignore +/.scrutinizer.yml export-ignore +/.travis.yml export-ignore +/composer-require-config.json export-ignore +/composer.lock export-ignore +/phpmd.xml.dist export-ignore +/phpunit.xml.dist export-ignore +/Makefile export-ignore +/phive.xml export-ignore +/phpcs.xml.dist export-ignore +/phpstan.neon export-ignore +/psalm.xml export-ignore +/tests/ export-ignore +/examples/ export-ignore +/.dependabot/ export-ignore +/.github/ export-ignore diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/.github/workflows/push.yml php-phpdocumentor-reflection-docblock-5.3.0/.github/workflows/push.yml --- php-phpdocumentor-reflection-docblock-5.2.2/.github/workflows/push.yml 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/.github/workflows/push.yml 2021-10-19 17:43:47.000000000 +0000 @@ -3,6 +3,8 @@ branches: - master pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: name: Qa workflow env: phiveGPGKeys: 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8A03EA3B385DBAA1 @@ -52,12 +54,13 @@ name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }} strategy: + fail-fast: false matrix: operating-system: - ubuntu-latest - windows-latest - macOS-latest - php-versions: ['7.2', '7.3', '7.4', '8.0'] + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] env: extensions: mbstring key: cache-v1 # can be any string, change to clear the extension cache. @@ -78,7 +81,7 @@ key: ${{ env.key }} - name: Cache extensions - uses: actions/cache@v2 + uses: actions/cache@v2.1.6 with: path: ${{ steps.cache-env.outputs.dir }} key: ${{ steps.cache-env.outputs.key }} @@ -102,22 +105,12 @@ GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} phpunit:^8.5 - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install dependencies - run: composer install --no-interaction --prefer-dist --optimize-autoloader + - name: Install Composer dependencies & cache dependencies + uses: "ramsey/composer-install@v1" + with: + composer-options: --optimize-autoloader - name: Run PHPUnit - continue-on-error: true run: php tools/phpunit codestyle: @@ -126,7 +119,7 @@ steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v2 + uses: actions/cache@v2.1.6 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -185,7 +178,7 @@ key: ${{ env.key }} - name: Cache extensions - uses: actions/cache@v2 + uses: actions/cache@v2.1.6 with: path: ${{ steps.cache-env.outputs.dir }} key: ${{ steps.cache-env.outputs.key }} @@ -195,25 +188,15 @@ with: php-version: ${{ matrix.php-versions }} extensions: ${{ env.extensions }} - tools: psalm ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install dependencies - run: composer install --no-interaction --prefer-dist --optimize-autoloader + - name: Install Composer dependencies & cache dependencies + uses: "ramsey/composer-install@v1" + with: + composer-options: --optimize-autoloader - name: Run psalm - run: psalm --output-format=github + run: vendor/bin/psalm.phar --output-format=github bc_check: diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/Makefile php-phpdocumentor-reflection-docblock-5.3.0/Makefile --- php-phpdocumentor-reflection-docblock-5.2.2/Makefile 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/Makefile 2021-10-19 17:43:47.000000000 +0000 @@ -25,7 +25,7 @@ .PHONY: psalm psalm: - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.2 tools/psalm + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.3 vendor/bin/psalm.phar .PHONY: test test: diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/phive.xml php-phpdocumentor-reflection-docblock-5.3.0/phive.xml --- php-phpdocumentor-reflection-docblock-5.2.2/phive.xml 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/phive.xml 2021-10-19 17:43:47.000000000 +0000 @@ -1,5 +1,4 @@ - - + diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/phpcs.xml.dist php-phpdocumentor-reflection-docblock-5.3.0/phpcs.xml.dist --- php-phpdocumentor-reflection-docblock-5.2.2/phpcs.xml.dist 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/phpcs.xml.dist 2021-10-19 17:43:47.000000000 +0000 @@ -1,22 +1,25 @@ - - The coding standard for phpDocumentor. + + The coding standard for this library. src tests/unit - */tests/unit/Types/ContextFactoryTest.php + */tests/unit/Types/ContextFactoryTest\.php */tests/unit/Assets/* + + + - - - */src/*/Abstract*.php + + - - */src/DocBlock/Tags/InvalidTag.php + + */src/*/Abstract*\.php diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/phpunit.xml.dist php-phpdocumentor-reflection-docblock-5.3.0/phpunit.xml.dist --- php-phpdocumentor-reflection-docblock-5.2.2/phpunit.xml.dist 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/phpunit.xml.dist 2021-10-19 17:43:47.000000000 +0000 @@ -4,6 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.0/phpunit.xsd" colors="true" + convertDeprecationsToExceptions="true" beStrictAboutOutputDuringTests="true" forceCoversAnnotation="true" verbose="true" diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/psalm.xml php-phpdocumentor-reflection-docblock-5.3.0/psalm.xml --- php-phpdocumentor-reflection-docblock-5.2.2/psalm.xml 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/psalm.xml 2021-10-19 17:43:47.000000000 +0000 @@ -41,5 +41,12 @@ + + + + + + + diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/DescriptionFactory.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/DescriptionFactory.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/DescriptionFactory.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/DescriptionFactory.php 2021-10-19 17:43:47.000000000 +0000 @@ -15,8 +15,8 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; + use function count; -use function explode; use function implode; use function ltrim; use function min; @@ -25,6 +25,7 @@ use function strpos; use function substr; use function trim; + use const PREG_SPLIT_DELIM_CAPTURE; /** @@ -60,7 +61,7 @@ /** * Returns the parsed text of this description. */ - public function create(string $contents, ?TypeContext $context = null) : Description + public function create(string $contents, ?TypeContext $context = null): Description { $tokens = $this->lex($contents); $count = count($tokens); @@ -88,7 +89,7 @@ * * @return string[] A series of tokens of which the description text is composed. */ - private function lex(string $contents) : array + private function lex(string $contents): array { $contents = $this->removeSuperfluousStartingWhitespace($contents); @@ -142,9 +143,9 @@ * If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent * lines and this may cause rendering issues when, for example, using a Markdown converter. */ - private function removeSuperfluousStartingWhitespace(string $contents) : string + private function removeSuperfluousStartingWhitespace(string $contents): string { - $lines = explode("\n", $contents); + $lines = Utils::pregSplit("/\r\n?|\n/", $contents); // if there is only one line then we don't have lines with superfluous whitespace and // can use the contents as-is diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Description.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Description.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Description.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Description.php 2021-10-19 17:43:47.000000000 +0000 @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; + use function vsprintf; /** @@ -71,7 +72,7 @@ /** * Returns the body template. */ - public function getBodyTemplate() : string + public function getBodyTemplate(): string { return $this->bodyTemplate; } @@ -81,7 +82,7 @@ * * @return Tag[] */ - public function getTags() : array + public function getTags(): array { return $this->tags; } @@ -90,7 +91,7 @@ * Renders this description as a string where the provided formatter will format the tags in the expected string * format. */ - public function render(?Formatter $formatter = null) : string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new PassthroughFormatter(); @@ -107,7 +108,7 @@ /** * Returns a plain string representation of this description. */ - public function __toString() : string + public function __toString(): string { return $this->render(); } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/ExampleFinder.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/ExampleFinder.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/ExampleFinder.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/ExampleFinder.php 2021-10-19 17:43:47.000000000 +0000 @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Tags\Example; + use function array_slice; use function file; use function getcwd; @@ -22,6 +23,7 @@ use function rtrim; use function sprintf; use function trim; + use const DIRECTORY_SEPARATOR; /** @@ -38,7 +40,7 @@ /** * Attempts to find the example contents for the given descriptor. */ - public function find(Example $example) : string + public function find(Example $example): string { $filename = $example->getFilePath(); @@ -53,7 +55,7 @@ /** * Registers the project's root directory where an 'examples' folder can be expected. */ - public function setSourceDirectory(string $directory = '') : void + public function setSourceDirectory(string $directory = ''): void { $this->sourceDirectory = $directory; } @@ -61,7 +63,7 @@ /** * Returns the project's root directory where an 'examples' folder can be expected. */ - public function getSourceDirectory() : string + public function getSourceDirectory(): string { return $this->sourceDirectory; } @@ -71,7 +73,7 @@ * * @param string[] $directories */ - public function setExampleDirectories(array $directories) : void + public function setExampleDirectories(array $directories): void { $this->exampleDirectories = $directories; } @@ -81,7 +83,7 @@ * * @return string[] */ - public function getExampleDirectories() : array + public function getExampleDirectories(): array { return $this->exampleDirectories; } @@ -99,7 +101,7 @@ * * @return string[] all lines of the example file */ - private function getExampleFileContents(string $filename) : ?array + private function getExampleFileContents(string $filename): ?array { $normalizedPath = null; @@ -129,7 +131,7 @@ /** * Get example filepath based on the example directory inside your project. */ - private function getExamplePathFromExampleDirectory(string $file) : string + private function getExamplePathFromExampleDirectory(string $file): string { return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file; } @@ -137,7 +139,7 @@ /** * Returns a path to the example file in the given directory.. */ - private function constructExamplePath(string $directory, string $file) : string + private function constructExamplePath(string $directory, string $file): string { return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file; } @@ -145,7 +147,7 @@ /** * Get example filepath based on sourcecode. */ - private function getExamplePathFromSource(string $file) : string + private function getExamplePathFromSource(string $file): string { return sprintf( '%s%s%s', diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Serializer.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Serializer.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Serializer.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Serializer.php 2021-10-19 17:43:47.000000000 +0000 @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; + use function sprintf; use function str_repeat; use function str_replace; @@ -41,6 +42,8 @@ /** @var Formatter A custom tag formatter. */ protected $tagFormatter; + /** @var string */ + private $lineEnding; /** * Create a Serializer instance. @@ -50,19 +53,22 @@ * @param bool $indentFirstLine Whether to indent the first line. * @param int|null $lineLength The max length of a line or NULL to disable line wrapping. * @param Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter. + * @param string $lineEnding Line ending used in the output, by default \n is used. */ public function __construct( int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, ?int $lineLength = null, - ?Formatter $tagFormatter = null + ?Formatter $tagFormatter = null, + string $lineEnding = "\n" ) { $this->indent = $indent; $this->indentString = $indentString; $this->isFirstLineIndented = $indentFirstLine; $this->lineLength = $lineLength; $this->tagFormatter = $tagFormatter ?: new PassthroughFormatter(); + $this->lineEnding = $lineEnding; } /** @@ -72,7 +78,7 @@ * * @return string The serialized doc block. */ - public function getDocComment(DocBlock $docblock) : string + public function getDocComment(DocBlock $docblock): string { $indent = str_repeat($this->indentString, $this->indent); $firstIndent = $this->isFirstLineIndented ? $indent : ''; @@ -95,10 +101,10 @@ $comment = $this->addTagBlock($docblock, $wrapLength, $indent, $comment); - return $comment . $indent . ' */'; + return str_replace("\n", $this->lineEnding, $comment . $indent . ' */'); } - private function removeTrailingSpaces(string $indent, string $text) : string + private function removeTrailingSpaces(string $indent, string $text): string { return str_replace( sprintf("\n%s * \n", $indent), @@ -107,7 +113,7 @@ ); } - private function addAsterisksForEachLine(string $indent, string $text) : string + private function addAsterisksForEachLine(string $indent, string $text): string { return str_replace( "\n", @@ -116,7 +122,7 @@ ); } - private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength) : string + private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength): string { $text = $docblock->getSummary() . ((string) $docblock->getDescription() ? "\n\n" . $docblock->getDescription() : ''); @@ -129,7 +135,7 @@ return $text; } - private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment) : string + private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment): string { foreach ($docblock->getTags() as $tag) { $tagText = $this->tagFormatter->format($tag); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/StandardTagFactory.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/StandardTagFactory.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/StandardTagFactory.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/StandardTagFactory.php 2021-10-19 17:43:47.000000000 +0000 @@ -39,6 +39,7 @@ use ReflectionNamedType; use ReflectionParameter; use Webmozart\Assert\Assert; + use function array_merge; use function array_slice; use function call_user_func_array; @@ -137,7 +138,7 @@ $this->addService($fqsenResolver, FqsenResolver::class); } - public function create(string $tagLine, ?TypeContext $context = null) : Tag + public function create(string $tagLine, ?TypeContext $context = null): Tag { if (!$context) { $context = new TypeContext(''); @@ -151,17 +152,17 @@ /** * @param mixed $value */ - public function addParameter(string $name, $value) : void + public function addParameter(string $name, $value): void { $this->serviceLocator[$name] = $value; } - public function addService(object $service, ?string $alias = null) : void + public function addService(object $service, ?string $alias = null): void { $this->serviceLocator[$alias ?: get_class($service)] = $service; } - public function registerTagHandler(string $tagName, string $handler) : void + public function registerTagHandler(string $tagName, string $handler): void { Assert::stringNotEmpty($tagName); Assert::classExists($handler); @@ -181,7 +182,7 @@ * * @return string[] */ - private function extractTagParts(string $tagLine) : array + private function extractTagParts(string $tagLine): array { $matches = []; if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{])\s*([^\s].*)|$)/us', $tagLine, $matches)) { @@ -201,7 +202,7 @@ * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the * body was invalid. */ - private function createTag(string $body, string $name, TypeContext $context) : Tag + private function createTag(string $body, string $name, TypeContext $context): Tag { $handlerClassName = $this->findHandlerClassName($name, $context); $arguments = $this->getArgumentsForParametersFromWiring( @@ -226,7 +227,7 @@ * * @return class-string */ - private function findHandlerClassName(string $tagName, TypeContext $context) : string + private function findHandlerClassName(string $tagName, TypeContext $context): string { $handlerClassName = Generic::class; if (isset($this->tagHandlerMappings[$tagName])) { @@ -251,7 +252,7 @@ * @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters * is provided with this method. */ - private function getArgumentsForParametersFromWiring(array $parameters, array $locator) : array + private function getArgumentsForParametersFromWiring(array $parameters, array $locator): array { $arguments = []; foreach ($parameters as $parameter) { @@ -292,7 +293,7 @@ * * @return ReflectionParameter[] */ - private function fetchParametersForHandlerFactoryMethod(string $handlerClassName) : array + private function fetchParametersForHandlerFactoryMethod(string $handlerClassName): array { if (!isset($this->tagHandlerParameterCache[$handlerClassName])) { $methodReflection = new ReflectionMethod($handlerClassName, 'create'); @@ -319,7 +320,7 @@ TypeContext $context, string $tagName, string $tagBody - ) : array { + ): array { return array_merge( $this->serviceLocator, [ @@ -335,7 +336,7 @@ * * @todo this method should be populated once we implement Annotation notation support. */ - private function isAnnotation(string $tagContent) : bool + private function isAnnotation(string $tagContent): bool { // 1. Contains a namespace separator // 2. Contains parenthesis diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/TagFactory.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/TagFactory.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/TagFactory.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/TagFactory.php 2021-10-19 17:43:47.000000000 +0000 @@ -38,7 +38,7 @@ * * @param mixed $value */ - public function addParameter(string $name, $value) : void; + public function addParameter(string $name, $value): void; /** * Factory method responsible for instantiating the correct sub type. @@ -49,7 +49,7 @@ * * @throws InvalidArgumentException If an invalid tag line was presented. */ - public function create(string $tagLine, ?TypeContext $context = null) : Tag; + public function create(string $tagLine, ?TypeContext $context = null): Tag; /** * Registers a service with the Service Locator using the FQCN of the class or the alias, if provided. @@ -60,7 +60,7 @@ * Because interfaces are regularly used as type-hints this method provides an alias parameter; if the FQCN of the * interface is passed as alias then every time that interface is requested the provided service will be returned. */ - public function addService(object $service) : void; + public function addService(object $service): void; /** * Registers a handler for tags. @@ -80,5 +80,5 @@ * @throws InvalidArgumentException If the handler is not an existing class. * @throws InvalidArgumentException If the handler does not implement the {@see Tag} interface. */ - public function registerTagHandler(string $tagName, string $handler) : void; + public function registerTagHandler(string $tagName, string $handler): void; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tag.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tag.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tag.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tag.php 2021-10-19 17:43:47.000000000 +0000 @@ -17,16 +17,15 @@ interface Tag { - public function getName() : string; + public function getName(): string; /** * @return Tag|mixed Class that implements Tag - * * @phpstan-return ?Tag */ public static function create(string $body); - public function render(?Formatter $formatter = null) : string; + public function render(?Formatter $formatter = null): string; - public function __toString() : string; + public function __toString(): string; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Author.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Author.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Author.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Author.php 2021-10-19 17:43:47.000000000 +0000 @@ -14,9 +14,11 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; use InvalidArgumentException; + use function filter_var; use function preg_match; use function trim; + use const FILTER_VALIDATE_EMAIL; /** @@ -51,7 +53,7 @@ * * @return string The author's name. */ - public function getAuthorName() : string + public function getAuthorName(): string { return $this->authorName; } @@ -61,7 +63,7 @@ * * @return string The author's email. */ - public function getEmail() : string + public function getEmail(): string { return $this->authorEmail; } @@ -69,7 +71,7 @@ /** * Returns this tag in string form. */ - public function __toString() : string + public function __toString(): string { if ($this->authorEmail) { $authorEmail = '<' . $this->authorEmail . '>'; @@ -77,15 +79,15 @@ $authorEmail = ''; } - $authorName = (string) $this->authorName; + $authorName = $this->authorName; return $authorName . ($authorEmail !== '' ? ($authorName !== '' ? ' ' : '') . $authorEmail : ''); } /** - * Attempts to create a new Author object based on †he tag body. + * Attempts to create a new Author object based on the tag body. */ - public static function create(string $body) : ?self + public static function create(string $body): ?self { $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches); if (!$splitTagContent) { diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/BaseTag.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/BaseTag.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/BaseTag.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/BaseTag.php 2021-10-19 17:43:47.000000000 +0000 @@ -32,17 +32,17 @@ * * @return string The name of this tag. */ - public function getName() : string + public function getName(): string { return $this->name; } - public function getDescription() : ?Description + public function getDescription(): ?Description { return $this->description; } - public function render(?Formatter $formatter = null) : string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new Formatter\PassthroughFormatter(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Covers.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Covers.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Covers.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Covers.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,6 +20,7 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; use Webmozart\Assert\Assert; + use function array_key_exists; use function explode; @@ -48,7 +49,7 @@ ?DescriptionFactory $descriptionFactory = null, ?FqsenResolver $resolver = null, ?TypeContext $context = null - ) : self { + ): self { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); Assert::notNull($resolver); @@ -61,7 +62,7 @@ ); } - private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen + private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen { Assert::notNull($fqsenResolver); $fqsenParts = explode('::', $parts); @@ -77,7 +78,7 @@ /** * Returns the structural element this tag refers to. */ - public function getReference() : Fqsen + public function getReference(): Fqsen { return $this->refers; } @@ -85,7 +86,7 @@ /** * Returns a string representation of this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Deprecated.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Deprecated.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Deprecated.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Deprecated.php 2021-10-19 17:43:47.000000000 +0000 @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; + use function preg_match; /** @@ -61,7 +62,7 @@ ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { if (empty($body)) { return new static(); } @@ -85,7 +86,7 @@ /** * Gets the version section of the tag. */ - public function getVersion() : ?string + public function getVersion(): ?string { return $this->version; } @@ -93,7 +94,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Example.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Example.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Example.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Example.php 2021-10-19 17:43:47.000000000 +0000 @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock\Tag; use Webmozart\Assert\Assert; + use function array_key_exists; use function preg_match; use function rawurlencode; @@ -66,7 +67,7 @@ $this->isURI = $isURI; } - public function getContent() : string + public function getContent(): string { if ($this->content === null || $this->content === '') { $filePath = $this->filePath; @@ -82,12 +83,12 @@ return $this->content; } - public function getDescription() : ?string + public function getDescription(): ?string { return $this->content; } - public static function create(string $body) : ?Tag + public static function create(string $body): ?Tag { // File component: File path in quotes or File URI / Source information if (!preg_match('/^\s*(?:(\"[^\"]+\")|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { @@ -137,7 +138,7 @@ * @return string Path to a file to use as an example. * May also be an absolute URI. */ - public function getFilePath() : string + public function getFilePath(): string { return trim($this->filePath, '"'); } @@ -145,9 +146,9 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { - $filePath = (string) $this->filePath; + $filePath = $this->filePath; $isDefaultLine = $this->startingLine === 1 && $this->lineCount === 0; $startingLine = !$isDefaultLine ? (string) $this->startingLine : ''; $lineCount = !$isDefaultLine ? (string) $this->lineCount : ''; @@ -168,27 +169,27 @@ /** * Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute). */ - private function isUriRelative(string $uri) : bool + private function isUriRelative(string $uri): bool { return strpos($uri, ':') === false; } - public function getStartingLine() : int + public function getStartingLine(): int { return $this->startingLine; } - public function getLineCount() : int + public function getLineCount(): int { return $this->lineCount; } - public function getName() : string + public function getName(): string { return 'example'; } - public function render(?Formatter $formatter = null) : string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new Formatter\PassthroughFormatter(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Formatter/AlignFormatter.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Formatter/AlignFormatter.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Formatter/AlignFormatter.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Formatter/AlignFormatter.php 2021-10-19 17:43:47.000000000 +0000 @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tags\Formatter; + use function max; use function str_repeat; use function strlen; @@ -37,7 +38,7 @@ /** * Formats the given tag to return a simple plain text version. */ - public function format(Tag $tag) : string + public function format(Tag $tag): string { return '@' . $tag->getName() . str_repeat( diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Formatter/PassthroughFormatter.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Formatter/PassthroughFormatter.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Formatter/PassthroughFormatter.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Formatter/PassthroughFormatter.php 2021-10-19 17:43:47.000000000 +0000 @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tags\Formatter; + use function trim; class PassthroughFormatter implements Formatter @@ -22,7 +23,7 @@ /** * Formats the given tag to return a simple plain text version. */ - public function format(Tag $tag) : string + public function format(Tag $tag): string { return trim('@' . $tag->getName() . ' ' . $tag); } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Formatter.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Formatter.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Formatter.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Formatter.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,5 +20,5 @@ /** * Formats a tag into a string representation according to a specific format, such as Markdown. */ - public function format(Tag $tag) : string; + public function format(Tag $tag): string; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Generic.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Generic.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Generic.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Generic.php 2021-10-19 17:43:47.000000000 +0000 @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; + use function preg_match; /** @@ -50,7 +51,7 @@ string $name = '', ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); @@ -62,7 +63,7 @@ /** * Returns the tag as a serialized string */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -76,7 +77,7 @@ /** * Validates if the tag name matches the expected format, otherwise throws an exception. */ - private function validateTagName(string $name) : void + private function validateTagName(string $name): void { if (!preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) { throw new InvalidArgumentException( diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/InvalidTag.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/InvalidTag.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/InvalidTag.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/InvalidTag.php 2021-10-19 17:43:47.000000000 +0000 @@ -11,6 +11,7 @@ use ReflectionException; use ReflectionFunction; use Throwable; + use function array_map; use function get_class; use function get_resource_type; @@ -46,22 +47,22 @@ $this->body = $body; } - public function getException() : ?Throwable + public function getException(): ?Throwable { return $this->throwable; } - public function getName() : string + public function getName(): string { return $this->name; } - public static function create(string $body, string $name = '') : self + public static function create(string $body, string $name = ''): self { return new self($name, $body); } - public function withError(Throwable $exception) : self + public function withError(Throwable $exception): self { $this->flattenExceptionBacktrace($exception); $tag = new self($this->name, $this->body); @@ -76,7 +77,7 @@ * Not all objects are serializable. So we need to remove them from the * stored exception to be sure that we do not break existing library usage. */ - private function flattenExceptionBacktrace(Throwable $exception) : void + private function flattenExceptionBacktrace(Throwable $exception): void { $traceProperty = (new ReflectionClass(Exception::class))->getProperty('trace'); $traceProperty->setAccessible(true); @@ -85,8 +86,8 @@ $trace = $exception->getTrace(); if (isset($trace[0]['args'])) { $trace = array_map( - function (array $call) : array { - $call['args'] = array_map([$this, 'flattenArguments'], $call['args']); + function (array $call): array { + $call['args'] = array_map([$this, 'flattenArguments'], $call['args'] ?? []); return $call; }, @@ -128,7 +129,7 @@ return $value; } - public function render(?Formatter $formatter = null) : string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new Formatter\PassthroughFormatter(); @@ -137,7 +138,7 @@ return $formatter->format($this); } - public function __toString() : string + public function __toString(): string { return $this->body; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Link.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Link.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Link.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Link.php 2021-10-19 17:43:47.000000000 +0000 @@ -43,7 +43,7 @@ string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::notNull($descriptionFactory); $parts = Utils::pregSplit('/\s+/Su', $body, 2); @@ -55,7 +55,7 @@ /** * Gets the link */ - public function getLink() : string + public function getLink(): string { return $this->link; } @@ -63,7 +63,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -71,7 +71,7 @@ $description = ''; } - $link = (string) $this->link; + $link = $this->link; return $link . ($description !== '' ? ($link !== '' ? ' ' : '') . $description : ''); } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Method.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Method.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Method.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Method.php 2021-10-19 17:43:47.000000000 +0000 @@ -22,6 +22,7 @@ use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\Void_; use Webmozart\Assert\Assert; + use function array_keys; use function explode; use function implode; @@ -58,7 +59,6 @@ /** * @param array> $arguments - * * @phpstan-param array $arguments */ public function __construct( @@ -86,7 +86,7 @@ ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : ?self { + ): ?self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -100,8 +100,9 @@ // 5. then a word with underscores, followed by ( and any character // until a ) and whitespace : as method name with signature // 6. any remaining text : as description - if (!preg_match( - '/^ + if ( + !preg_match( + '/^ # Static keyword # Declares a static method ONLY if type is also present (?: @@ -131,9 +132,10 @@ # Description (.*) $/sux', - $body, - $matches - )) { + $body, + $matches + ) + ) { return null; } @@ -176,17 +178,16 @@ /** * Retrieves the method name. */ - public function getMethodName() : string + public function getMethodName(): string { return $this->methodName; } /** * @return array> - * * @phpstan-return array */ - public function getArguments() : array + public function getArguments(): array { return $this->arguments; } @@ -196,17 +197,17 @@ * * @return bool TRUE if the method declaration is for a static method, FALSE otherwise. */ - public function isStatic() : bool + public function isStatic(): bool { return $this->isStatic; } - public function getReturnType() : Type + public function getReturnType(): Type { return $this->returnType; } - public function __toString() : string + public function __toString(): string { $arguments = []; foreach ($this->arguments as $argument) { @@ -225,7 +226,7 @@ $returnType = (string) $this->returnType; - $methodName = (string) $this->methodName; + $methodName = $this->methodName; return $static . ($returnType !== '' ? ($static !== '' ? ' ' : '') . $returnType : '') @@ -236,13 +237,12 @@ /** * @param mixed[][]|string[] $arguments + * @phpstan-param array $arguments * * @return mixed[][] - * - * @phpstan-param array $arguments * @phpstan-return array */ - private function filterArguments(array $arguments = []) : array + private function filterArguments(array $arguments = []): array { $result = []; foreach ($arguments as $argument) { @@ -268,7 +268,7 @@ return $result; } - private static function stripRestArg(string $argument) : string + private static function stripRestArg(string $argument): string { if (strpos($argument, '...') === 0) { $argument = trim(substr($argument, 3)); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Param.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Param.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Param.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Param.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,11 +20,13 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; use Webmozart\Assert\Assert; + use function array_shift; use function array_unshift; use function implode; use function strpos; use function substr; + use const PREG_SPLIT_DELIM_CAPTURE; /** @@ -61,7 +63,7 @@ ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -114,7 +116,7 @@ /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } @@ -122,7 +124,7 @@ /** * Returns whether this tag is variadic. */ - public function isVariadic() : bool + public function isVariadic(): bool { return $this->isVariadic; } @@ -130,7 +132,7 @@ /** * Returns whether this tag is passed by reference. */ - public function isReference() : bool + public function isReference(): bool { return $this->isReference; } @@ -138,7 +140,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -159,7 +161,7 @@ . ($description !== '' ? ($type !== '' || $variableName !== '' ? ' ' : '') . $description : ''); } - private static function strStartsWithVariable(string $str) : bool + private static function strStartsWithVariable(string $str): bool { return strpos($str, '$') === 0 || diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Property.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Property.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Property.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Property.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,11 +20,13 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; use Webmozart\Assert\Assert; + use function array_shift; use function array_unshift; use function implode; use function strpos; use function substr; + use const PREG_SPLIT_DELIM_CAPTURE; /** @@ -50,7 +52,7 @@ ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -88,7 +90,7 @@ /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } @@ -96,7 +98,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/PropertyRead.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/PropertyRead.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/PropertyRead.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/PropertyRead.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,11 +20,13 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; use Webmozart\Assert\Assert; + use function array_shift; use function array_unshift; use function implode; use function strpos; use function substr; + use const PREG_SPLIT_DELIM_CAPTURE; /** @@ -50,7 +52,7 @@ ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -88,7 +90,7 @@ /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } @@ -96,7 +98,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/PropertyWrite.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/PropertyWrite.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/PropertyWrite.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/PropertyWrite.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,11 +20,13 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; use Webmozart\Assert\Assert; + use function array_shift; use function array_unshift; use function implode; use function strpos; use function substr; + use const PREG_SPLIT_DELIM_CAPTURE; /** @@ -50,7 +52,7 @@ ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -88,7 +90,7 @@ /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } @@ -96,7 +98,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Reference/Fqsen.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Reference/Fqsen.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Reference/Fqsen.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Reference/Fqsen.php 2021-10-19 17:43:47.000000000 +0000 @@ -31,7 +31,7 @@ /** * @return string string representation of the referenced fqsen */ - public function __toString() : string + public function __toString(): string { return (string) $this->fqsen; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Reference/Reference.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Reference/Reference.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Reference/Reference.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Reference/Reference.php 2021-10-19 17:43:47.000000000 +0000 @@ -18,5 +18,5 @@ */ interface Reference { - public function __toString() : string; + public function __toString(): string; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Reference/Url.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Reference/Url.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Reference/Url.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Reference/Url.php 2021-10-19 17:43:47.000000000 +0000 @@ -29,7 +29,7 @@ $this->uri = $uri; } - public function __toString() : string + public function __toString(): string { return $this->uri; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Return_.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Return_.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Return_.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Return_.php 2021-10-19 17:43:47.000000000 +0000 @@ -37,7 +37,7 @@ ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -49,7 +49,7 @@ return new static($type, $description); } - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -59,6 +59,6 @@ $type = $this->type ? '' . $this->type : 'mixed'; - return $type . ($description !== '' ? ($type !== '' ? ' ' : '') . $description : ''); + return $type . ($description !== '' ? ' ' . $description : ''); } } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/See.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/See.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/See.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/See.php 2021-10-19 17:43:47.000000000 +0000 @@ -23,6 +23,7 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; use Webmozart\Assert\Assert; + use function array_key_exists; use function explode; use function preg_match; @@ -52,21 +53,21 @@ ?FqsenResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::notNull($descriptionFactory); $parts = Utils::pregSplit('/\s+/Su', $body, 2); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; // https://tools.ietf.org/html/rfc2396#section-3 - if (preg_match('/\w:\/\/\w/i', $parts[0])) { + if (preg_match('#\w://\w#', $parts[0])) { return new static(new Url($parts[0]), $description); } return new static(new FqsenRef(self::resolveFqsen($parts[0], $typeResolver, $context)), $description); } - private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen + private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen { Assert::notNull($fqsenResolver); $fqsenParts = explode('::', $parts); @@ -82,7 +83,7 @@ /** * Returns the ref of this tag. */ - public function getReference() : Reference + public function getReference(): Reference { return $this->refers; } @@ -90,7 +91,7 @@ /** * Returns a string representation of this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Since.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Since.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Since.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Since.php 2021-10-19 17:43:47.000000000 +0000 @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; + use function preg_match; /** @@ -58,7 +59,7 @@ ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : ?self { + ): ?self { if (empty($body)) { return new static(); } @@ -79,7 +80,7 @@ /** * Gets the version section of the tag. */ - public function getVersion() : ?string + public function getVersion(): ?string { return $this->version; } @@ -87,7 +88,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Source.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Source.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Source.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Source.php 2021-10-19 17:43:47.000000000 +0000 @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; + use function preg_match; /** @@ -51,7 +52,7 @@ string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); @@ -69,7 +70,7 @@ $description = $matches[3]; } - return new static($startingLine, $lineCount, $descriptionFactory->create($description??'', $context)); + return new static($startingLine, $lineCount, $descriptionFactory->create($description ?? '', $context)); } /** @@ -78,7 +79,7 @@ * @return int The starting line, relative to the structural element's * location. */ - public function getStartingLine() : int + public function getStartingLine(): int { return $this->startingLine; } @@ -89,12 +90,12 @@ * @return int|null The number of lines, relative to the starting line. NULL * means "to the end". */ - public function getLineCount() : ?int + public function getLineCount(): ?int { return $this->lineCount; } - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -104,14 +105,12 @@ $startingLine = (string) $this->startingLine; - $lineCount = $this->lineCount !== null ? '' . $this->lineCount : ''; + $lineCount = $this->lineCount !== null ? ' ' . $this->lineCount : ''; return $startingLine - . ($lineCount !== '' - ? ($startingLine || $startingLine === '0' ? ' ' : '') . $lineCount - : '') + . $lineCount . ($description !== '' - ? ($startingLine || $startingLine === '0' || $lineCount !== '' ? ' ' : '') . $description + ? ' ' . $description : ''); } } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/TagWithType.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/TagWithType.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/TagWithType.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/TagWithType.php 2021-10-19 17:43:47.000000000 +0000 @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; use phpDocumentor\Reflection\Type; + use function in_array; use function strlen; use function substr; @@ -27,7 +28,7 @@ /** * Returns the type section of the variable. */ - public function getType() : ?Type + public function getType(): ?Type { return $this->type; } @@ -35,7 +36,7 @@ /** * @return string[] */ - protected static function extractTypeFromBody(string $body) : array + protected static function extractTypeFromBody(string $body): array { $type = ''; $nestingLevel = 0; diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Throws.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Throws.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Throws.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Throws.php 2021-10-19 17:43:47.000000000 +0000 @@ -37,7 +37,7 @@ ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -49,7 +49,7 @@ return new static($type, $description); } - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Uses.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Uses.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Uses.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Uses.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,6 +20,7 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; use Webmozart\Assert\Assert; + use function array_key_exists; use function explode; @@ -48,7 +49,7 @@ ?FqsenResolver $resolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::notNull($resolver); Assert::notNull($descriptionFactory); @@ -60,7 +61,7 @@ ); } - private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen + private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen { Assert::notNull($fqsenResolver); $fqsenParts = explode('::', $parts); @@ -76,7 +77,7 @@ /** * Returns the structural element this tag refers to. */ - public function getReference() : Fqsen + public function getReference(): Fqsen { return $this->refers; } @@ -84,7 +85,7 @@ /** * Returns a string representation of this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Var_.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Var_.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Var_.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Var_.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,11 +20,13 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; use Webmozart\Assert\Assert; + use function array_shift; use function array_unshift; use function implode; use function strpos; use function substr; + use const PREG_SPLIT_DELIM_CAPTURE; /** @@ -50,7 +52,7 @@ ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : self { + ): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -89,7 +91,7 @@ /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } @@ -97,7 +99,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Version.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Version.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock/Tags/Version.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock/Tags/Version.php 2021-10-19 17:43:47.000000000 +0000 @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; + use function preg_match; /** @@ -58,7 +59,7 @@ ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) : ?self { + ): ?self { if (empty($body)) { return new static(); } @@ -82,7 +83,7 @@ /** * Gets the version section of the tag. */ - public function getVersion() : ?string + public function getVersion(): ?string { return $this->version; } @@ -90,7 +91,7 @@ /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlockFactoryInterface.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlockFactoryInterface.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlockFactoryInterface.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlockFactoryInterface.php 2021-10-19 17:43:47.000000000 +0000 @@ -14,10 +14,10 @@ * * @param array> $additionalTags */ - public static function createInstance(array $additionalTags = []) : DocBlockFactory; + public static function createInstance(array $additionalTags = []): DocBlockFactory; /** * @param string|object $docblock */ - public function create($docblock, ?Types\Context $context = null, ?Location $location = null) : DocBlock; + public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlockFactory.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlockFactory.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlockFactory.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlockFactory.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,6 +20,7 @@ use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\TagFactory; use Webmozart\Assert\Assert; + use function array_shift; use function count; use function explode; @@ -54,7 +55,7 @@ * * @param array> $additionalTags */ - public static function createInstance(array $additionalTags = []) : self + public static function createInstance(array $additionalTags = []): self { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); @@ -75,7 +76,7 @@ * @param object|string $docblock A string containing the DocBlock to parse or an object supporting the * getDocComment method (such as a ReflectionClass object). */ - public function create($docblock, ?Types\Context $context = null, ?Location $location = null) : DocBlock + public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock { if (is_object($docblock)) { if (!method_exists($docblock, 'getDocComment')) { @@ -112,7 +113,7 @@ /** * @param class-string $handler */ - public function registerTagHandler(string $tagName, string $handler) : void + public function registerTagHandler(string $tagName, string $handler): void { $this->tagFactory->registerTagHandler($tagName, $handler); } @@ -122,7 +123,7 @@ * * @param string $comment String containing the comment text. */ - private function stripDocComment(string $comment) : string + private function stripDocComment(string $comment): string { $comment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]?(.*)?#u', '$1', $comment); Assert::string($comment); @@ -231,7 +232,7 @@ * * @return DocBlock\Tag[] */ - private function parseTagBlock(string $tags, Types\Context $context) : array + private function parseTagBlock(string $tags, Types\Context $context): array { $tags = $this->filterTagBlock($tags); if ($tags === null) { @@ -250,7 +251,7 @@ /** * @return string[] */ - private function splitTagBlockIntoTagLines(string $tags) : array + private function splitTagBlockIntoTagLines(string $tags): array { $result = []; foreach (explode("\n", $tags) as $tagLine) { @@ -264,7 +265,7 @@ return $result; } - private function filterTagBlock(string $tags) : ?string + private function filterTagBlock(string $tags): ?string { $tags = trim($tags); if (!$tags) { diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock.php php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/DocBlock.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/DocBlock.php 2021-10-19 17:43:47.000000000 +0000 @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection; use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\TagWithType; use Webmozart\Assert\Assert; final class DocBlock @@ -68,12 +69,12 @@ $this->isTemplateStart = $isTemplateStart; } - public function getSummary() : string + public function getSummary(): string { return $this->summary; } - public function getDescription() : DocBlock\Description + public function getDescription(): DocBlock\Description { return $this->description; } @@ -81,7 +82,7 @@ /** * Returns the current context. */ - public function getContext() : ?Types\Context + public function getContext(): ?Types\Context { return $this->context; } @@ -89,7 +90,7 @@ /** * Returns the current location. */ - public function getLocation() : ?Location + public function getLocation(): ?Location { return $this->location; } @@ -113,7 +114,7 @@ * * @see self::isTemplateEnd() for the check whether a closing marker was provided. */ - public function isTemplateStart() : bool + public function isTemplateStart(): bool { return $this->isTemplateStart; } @@ -123,7 +124,7 @@ * * @see self::isTemplateStart() for a more complete description of the Docblock Template functionality. */ - public function isTemplateEnd() : bool + public function isTemplateEnd(): bool { return $this->isTemplateEnd; } @@ -133,7 +134,7 @@ * * @return Tag[] */ - public function getTags() : array + public function getTags(): array { return $this->tags; } @@ -146,7 +147,7 @@ * * @return Tag[] */ - public function getTagsByName(string $name) : array + public function getTagsByName(string $name): array { $result = []; @@ -162,11 +163,34 @@ } /** + * Returns an array of tags with type matching the given name. If no tags are found + * an empty array is returned. + * + * @param string $name String to search by. + * + * @return TagWithType[] + */ + public function getTagsWithTypeByName(string $name): array + { + $result = []; + + foreach ($this->getTagsByName($name) as $tag) { + if (!$tag instanceof TagWithType) { + continue; + } + + $result[] = $tag; + } + + return $result; + } + + /** * Checks if a tag of a certain type is present in this DocBlock. * * @param string $name Tag name to check for. */ - public function hasTag(string $name) : bool + public function hasTag(string $name): bool { foreach ($this->getTags() as $tag) { if ($tag->getName() === $name) { @@ -182,7 +206,7 @@ * * @param Tag $tagToRemove The tag to remove. */ - public function removeTag(Tag $tagToRemove) : void + public function removeTag(Tag $tagToRemove): void { foreach ($this->tags as $key => $tag) { if ($tag === $tagToRemove) { @@ -197,7 +221,7 @@ * * @param Tag $tag The tag to add. */ - private function addTag(Tag $tag) : void + private function addTag(Tag $tag): void { $this->tags[] = $tag; } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/Exception/PcreException.php php-phpdocumentor-reflection-docblock-5.3.0/src/Exception/PcreException.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/Exception/PcreException.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/Exception/PcreException.php 2021-10-19 17:43:47.000000000 +0000 @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\Exception; use InvalidArgumentException; + use const PREG_BACKTRACK_LIMIT_ERROR; use const PREG_BAD_UTF8_ERROR; use const PREG_BAD_UTF8_OFFSET_ERROR; @@ -15,19 +16,24 @@ final class PcreException extends InvalidArgumentException { - public static function createFromPhpError(int $errorCode) : self + public static function createFromPhpError(int $errorCode): self { switch ($errorCode) { case PREG_BACKTRACK_LIMIT_ERROR: return new self('Backtrack limit error'); + case PREG_RECURSION_LIMIT_ERROR: return new self('Recursion limit error'); + case PREG_BAD_UTF8_ERROR: return new self('Bad UTF8 error'); + case PREG_BAD_UTF8_OFFSET_ERROR: return new self('Bad UTF8 offset error'); + case PREG_JIT_STACKLIMIT_ERROR: return new self('Jit stacklimit error'); + case PREG_NO_ERROR: case PREG_INTERNAL_ERROR: default: diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/src/Utils.php php-phpdocumentor-reflection-docblock-5.3.0/src/Utils.php --- php-phpdocumentor-reflection-docblock-5.2.2/src/Utils.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/src/Utils.php 2021-10-19 17:43:47.000000000 +0000 @@ -14,6 +14,8 @@ namespace phpDocumentor\Reflection; use phpDocumentor\Reflection\Exception\PcreException; +use Webmozart\Assert\Assert; + use function preg_last_error; use function preg_split as php_preg_split; @@ -28,7 +30,7 @@ * * @param string $pattern The pattern to search for, as a string. * @param string $subject The input string. - * @param int|null $limit If specified, then only substrings up to limit are returned with the + * @param int $limit If specified, then only substrings up to limit are returned with the * rest of the string being placed in the last substring. A limit of -1 or 0 means "no limit". * @param int $flags flags can be any combination of the following flags (combined with the | bitwise operator): * *PREG_SPLIT_NO_EMPTY* @@ -41,17 +43,20 @@ * Note that this changes the return value in an array where every element is an array consisting of the * matched string at offset 0 and its string offset into subject at offset 1. * - * @return string[] Returns an array containing substrings of subject split along boundaries matched by pattern + * @return string[] Returns an array containing substrings of subject + * split along boundaries matched by pattern * * @throws PcreException */ - public static function pregSplit(string $pattern, string $subject, ?int $limit = -1, int $flags = 0) : array + public static function pregSplit(string $pattern, string $subject, int $limit = -1, int $flags = 0): array { $parts = php_preg_split($pattern, $subject, $limit, $flags); if ($parts === false) { throw PcreException::createFromPhpError(preg_last_error()); } + Assert::allString($parts); + return $parts; } } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/integration/DocblockSeeTagResolvingTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/integration/DocblockSeeTagResolvingTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/integration/DocblockSeeTagResolvingTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/integration/DocblockSeeTagResolvingTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -8,6 +8,9 @@ use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; +/** + * @coversNothing + */ class DocblockSeeTagResolvingTest extends TestCase { public function testResolvesSeeFQSENOfInlineTags() diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/integration/InterpretingDocBlocksTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/integration/InterpretingDocBlocksTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/integration/InterpretingDocBlocksTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/integration/InterpretingDocBlocksTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -79,7 +79,14 @@ $this->assertInstanceOf(DocBlock::class, $docblock); $this->assertSame('This is an example of a summary.', $summary); $this->assertInstanceOf(Description::class, $description); - $this->assertSame($descriptionText, $description->render()); + $this->assertSame( + str_replace( + PHP_EOL, + "\n", + $descriptionText + ), + $description->render() + ); $this->assertEmpty($docblock->getTags()); } @@ -124,6 +131,9 @@ include(__DIR__ . '/../../examples/playing-with-descriptions/02-escaping.php'); $this->assertSame( + str_replace( + PHP_EOL, + "\n", <<<'DESCRIPTION' You can escape the @-sign by surrounding it with braces, for example: @. And escape a closing brace within an inline tag by adding an opening brace in front of it like this: }. @@ -135,7 +145,7 @@ Do note that an {@internal inline tag that has an opening brace ({) does not break out}. DESCRIPTION - , + ), $foundDescription ); } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/integration/ModifyBackTraceSafeTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/integration/ModifyBackTraceSafeTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/integration/ModifyBackTraceSafeTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/integration/ModifyBackTraceSafeTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -12,6 +12,9 @@ */ class ModifyBackTraceSafeTest extends TestCase { + /** + * @doesNotPerformAssertions + */ public function testBackTraceModificationDoesNotImpactFunctionArguments() { $traverser = new Traverser(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/DescriptionFactoryTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/DescriptionFactoryTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/DescriptionFactoryTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/DescriptionFactoryTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,6 +20,10 @@ use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; +use function str_replace; + +use const PHP_EOL; + /** * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @covers :: @@ -29,7 +33,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -41,7 +45,7 @@ * @covers ::create * @dataProvider provideSimpleExampleDescriptions */ - public function testDescriptionCanParseASimpleString(string $contents) : void + public function testDescriptionCanParseASimpleString(string $contents): void { $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->never(); @@ -59,7 +63,7 @@ * @covers ::create * @dataProvider provideEscapeSequences */ - public function testEscapeSequences(string $contents, string $expected) : void + public function testEscapeSequences(string $contents, string $expected): void { $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->never(); @@ -80,7 +84,7 @@ * @covers ::__construct * @covers ::create */ - public function testDescriptionCanParseAStringWithInlineTag() : void + public function testDescriptionCanParseAStringWithInlineTag(): void { $contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.'; $context = new Context(''); @@ -106,7 +110,7 @@ * @covers ::__construct * @covers ::create */ - public function testDescriptionCanParseAStringStartingWithInlineTag() : void + public function testDescriptionCanParseAStringStartingWithInlineTag(): void { $contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.'; $context = new Context(''); @@ -132,7 +136,7 @@ * @covers ::__construct * @covers ::create */ - public function testDescriptionCanParseAStringContainingMultipleTags() : void + public function testDescriptionCanParseAStringContainingMultipleTags(): void { $contents = 'This description has a {@link http://phpdoc.org/ This} another {@link http://phpdoc.org/ This2}'; $context = new Context(''); @@ -159,7 +163,7 @@ * @covers ::__construct * @covers ::create */ - public function testIfSuperfluousStartingSpacesAreRemoved() : void + public function testIfSuperfluousStartingSpacesAreRemoved(): void { $factory = new DescriptionFactory(m::mock(TagFactory::class)); $descriptionText = <<create($descriptionText, new Context('')); - $this->assertSame($expectedDescription, $description->render()); + $this->assertSame(str_replace(PHP_EOL, "\n", $expectedDescription), $description->render()); } /** @@ -204,7 +208,7 @@ * @covers ::__construct * @covers ::create */ - public function testDescriptionWithBrokenInlineTags() : void + public function testDescriptionWithBrokenInlineTags(): void { $contents = 'This {@see $name} is a broken use case, but used in real life.'; $context = new Context(''); @@ -225,7 +229,7 @@ * * @return string[][] */ - public function provideSimpleExampleDescriptions() : array + public function provideSimpleExampleDescriptions(): array { return [ ['This is text for a description.'], @@ -238,7 +242,7 @@ /** * @return string[][] */ - public function provideEscapeSequences() : array + public function provideEscapeSequences(): array { return [ ['This is text for a description with a {@}.', 'This is text for a description with a @.'], diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/DescriptionTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/DescriptionTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/DescriptionTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/DescriptionTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -26,7 +26,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -39,7 +39,7 @@ * @covers ::__construct * @covers ::render */ - public function testDescriptionCanRenderUsingABodyWithPlaceholdersAndTags() : void + public function testDescriptionCanRenderUsingABodyWithPlaceholdersAndTags(): void { $body = 'This is a %1$s body.'; $expected = 'This is a {@internal significant} body.'; @@ -65,7 +65,7 @@ * @covers ::render * @covers ::__toString */ - public function testDescriptionCanBeCastToString() : void + public function testDescriptionCanBeCastToString(): void { $body = 'This is a %1$s body.'; $expected = 'This is a {@internal significant} body.'; @@ -82,7 +82,7 @@ * * @covers ::getTags */ - public function testDescriptionTagsGetter() : void + public function testDescriptionTagsGetter(): void { $body = '@JoinTable(name="table", joinColumns=%1$s, inverseJoinColumns=%2$s)'; @@ -107,7 +107,7 @@ /** * @covers ::getBodyTemplate */ - public function testDescriptionBodyTemplateGetter() : void + public function testDescriptionBodyTemplateGetter(): void { $body = 'See https://github.com/phpDocumentor/ReflectionDocBlock/pull/171 for more information'; @@ -125,7 +125,7 @@ * @covers ::render * @covers ::__toString */ - public function testDescriptionMultipleTagsCanBeCastToString() : void + public function testDescriptionMultipleTagsCanBeCastToString(): void { $body = '@JoinTable(name="table", joinColumns=%1$s, inverseJoinColumns=%2$s)'; diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/ExampleFinderTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/ExampleFinderTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/ExampleFinderTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/ExampleFinderTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -20,12 +20,12 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } - public function setUp() : void + public function setUp(): void { $this->fixture = new ExampleFinder(); } @@ -37,7 +37,7 @@ * @covers ::find * @covers ::getSourceDirectory */ - public function testFileNotFound() : void + public function testFileNotFound(): void { $example = new Example('./example.php', false, 1, 0, 'Test'); $this->assertSame('** File not found : ./example.php **', $this->fixture->find($example)); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/SerializerTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/SerializerTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/SerializerTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/SerializerTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -17,6 +17,10 @@ use phpDocumentor\Reflection\DocBlock; use PHPUnit\Framework\TestCase; +use function str_replace; + +use const PHP_EOL; + /** * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Serializer * @covers :: @@ -26,7 +30,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -41,7 +45,7 @@ * @covers ::__construct * @covers ::getDocComment */ - public function testReconstructsADocCommentFromADocBlock() : void + public function testReconstructsADocCommentFromADocBlock(): void { $expected = <<<'DOCCOMMENT' /** @@ -63,7 +67,7 @@ ] ); - $this->assertSame($expected, $fixture->getDocComment($docBlock)); + $this->assertSameString($expected, $fixture->getDocComment($docBlock)); } /** @@ -76,7 +80,7 @@ * @covers ::__construct * @covers ::getDocComment */ - public function testAddPrefixToDocBlock() : void + public function testAddPrefixToDocBlock(): void { $expected = <<<'DOCCOMMENT' aa/** @@ -98,7 +102,7 @@ ] ); - $this->assertSame($expected, $fixture->getDocComment($docBlock)); + $this->assertSameString($expected, $fixture->getDocComment($docBlock)); } /** @@ -111,7 +115,7 @@ * @covers ::__construct * @covers ::getDocComment */ - public function testAddPrefixToDocBlockExceptFirstLine() : void + public function testAddPrefixToDocBlockExceptFirstLine(): void { $expected = <<<'DOCCOMMENT' /** @@ -133,7 +137,7 @@ ] ); - $this->assertSame($expected, $fixture->getDocComment($docBlock)); + $this->assertSameString($expected, $fixture->getDocComment($docBlock)); } /** @@ -146,7 +150,7 @@ * @covers ::__construct * @covers ::getDocComment */ - public function testWordwrapsAroundTheGivenAmountOfCharacters() : void + public function testWordwrapsAroundTheGivenAmountOfCharacters(): void { $expected = <<<'DOCCOMMENT' /** @@ -174,14 +178,14 @@ ] ); - $this->assertSame($expected, $fixture->getDocComment($docBlock)); + $this->assertSameString($expected, $fixture->getDocComment($docBlock)); } /** * @covers ::__construct * @covers ::getDocComment */ - public function testNoExtraSpacesAfterTagRemoval() : void + public function testNoExtraSpacesAfterTagRemoval(): void { $expected = <<<'DOCCOMMENT' /** @@ -198,9 +202,16 @@ $genericTag = new DocBlock\Tags\Generic('unknown-tag'); $docBlock = new DocBlock('', null, [$genericTag]); - $this->assertSame($expected, $fixture->getDocComment($docBlock)); + $this->assertSameString($expected, $fixture->getDocComment($docBlock)); $docBlock->removeTag($genericTag); - $this->assertSame($expectedAfterRemove, $fixture->getDocComment($docBlock)); + $this->assertSameString($expectedAfterRemove, $fixture->getDocComment($docBlock)); + } + + public function assertSameString(string $expected, string $actual): void + { + $expected = str_replace(PHP_EOL, "\n", $expected); + + self::assertSame($expected, $actual); } } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/StandardTagFactoryTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/StandardTagFactoryTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/StandardTagFactoryTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/StandardTagFactoryTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -40,7 +40,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -54,7 +54,7 @@ * @covers ::__construct * @covers ::create */ - public function testCreatingAGenericTag() : void + public function testCreatingAGenericTag(): void { $expectedTagName = 'unknown-tag'; $expectedDescriptionText = 'This is a description'; @@ -80,13 +80,37 @@ /** * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Description + * + * @covers ::__construct + * @covers ::create + */ + public function testCreatingAGenericTagWithDescriptionText(): void + { + $expectedTagName = 'unknown-tag'; + $expectedDescriptionText = ' foo Bar 123 '; + $context = new Context(''); + + $tagFactory = new StandardTagFactory(new FqsenResolver()); + $tagFactory->addService(new DescriptionFactory($tagFactory), DescriptionFactory::class); + + $tag = $tagFactory->create('@' . $expectedTagName . $expectedDescriptionText, $context); + + $this->assertInstanceOf(Generic::class, $tag); + $this->assertSame('foo Bar 123', $tag . ''); + } + + /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * * @covers ::__construct * @covers ::create */ - public function testCreatingASpecificTag() : void + public function testCreatingASpecificTag(): void { $context = new Context(''); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); @@ -107,7 +131,7 @@ * @covers ::__construct * @covers ::create */ - public function testAnEmptyContextIsCreatedIfNoneIsProvided() : void + public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void { $fqsen = '\Tag'; $resolver = m::mock(FqsenResolver::class) @@ -135,7 +159,7 @@ * @covers ::__construct * @covers ::create */ - public function testPassingYourOwnSetOfTagHandlers() : void + public function testPassingYourOwnSetOfTagHandlers(): void { $context = new Context(''); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class), ['user' => Author::class]); @@ -147,12 +171,96 @@ } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * + * @covers ::__construct + * @covers ::create + */ + public function testPassingYourOwnSetOfTagHandlersWithGermanChars(): void + { + $typeResolver = new TypeResolver(); + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $tagFactory = new StandardTagFactory( + $fqsenResolver, + ['my-täg' => Author::class] + ); + + $tag = $tagFactory->create('@my-täg foo bar ', $context); + + $this->assertInstanceOf(Author::class, $tag); + $this->assertSame('author', $tag->getName()); + $this->assertSame('foo bar', $tag . ''); + } + + /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * + * @covers ::__construct + * @covers ::create + */ + public function testPassingYourOwnSetOfTagHandlersWithoutComment(): void + { + $typeResolver = new TypeResolver(); + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $tagFactory = new StandardTagFactory( + $fqsenResolver, + ['my-täg' => Author::class] + ); + + $tag = $tagFactory->create('@my-täg', $context); + + $this->assertInstanceOf(Author::class, $tag); + $this->assertSame('author', $tag->getName()); + } + + /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * + * @covers ::__construct + * @covers ::create + */ + public function testPassingYourOwnSetOfTagHandlersWithEmptyComment(): void + { + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage( + 'The tag "@my-täg " does not seem to be wellformed, please check it for errors' + ); + + $typeResolver = new TypeResolver(); + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $tagFactory = new StandardTagFactory( + $fqsenResolver, + ['my-täg' => Author::class] + ); + + $tag = $tagFactory->create('@my-täg ', $context); + } + + /** * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * * @covers ::create */ - public function testExceptionIsThrownIfProvidedTagIsNotWellformed() : void + public function testExceptionIsThrownIfProvidedTagIsNotWellformed(): void { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage( @@ -168,7 +276,7 @@ * @covers ::__construct * @covers ::addParameter */ - public function testAddParameterToServiceLocator() : void + public function testAddParameterToServiceLocator(): void { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); @@ -186,7 +294,7 @@ * * @covers ::addService */ - public function testAddServiceToServiceLocator() : void + public function testAddServiceToServiceLocator(): void { $service = new PassthroughFormatter(); @@ -205,7 +313,7 @@ * * @covers ::addService */ - public function testInjectConcreteServiceForInterfaceToServiceLocator() : void + public function testInjectConcreteServiceForInterfaceToServiceLocator(): void { $interfaceName = Formatter::class; $service = new PassthroughFormatter(); @@ -228,7 +336,7 @@ * * @covers ::registerTagHandler */ - public function testRegisteringAHandlerForANewTag() : void + public function testRegisteringAHandlerForANewTag(): void { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); @@ -246,7 +354,7 @@ * * @covers ::registerTagHandler */ - public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() : void + public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void { $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); @@ -261,7 +369,7 @@ * * @covers ::registerTagHandler */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void + public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void { $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); @@ -275,7 +383,7 @@ * * @covers ::registerTagHandler */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() : void + public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void { $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); @@ -289,7 +397,7 @@ * * @covers ::registerTagHandler */ - public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() : void + public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void { $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); @@ -306,7 +414,7 @@ * * @covers ::create */ - public function testReturnTagIsMappedCorrectly() : void + public function testReturnTagIsMappedCorrectly(): void { $context = new Context(''); @@ -329,7 +437,7 @@ $this->assertSame('return', $tag->getName()); } - public function testInvalidTagIsReturnedOnFailure() : void + public function testInvalidTagIsReturnedOnFailure(): void { $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); @@ -341,7 +449,7 @@ /** * @dataProvider validTagProvider */ - public function testValidFormattedTags(string $input, string $tagName, string $render) : void + public function testValidFormattedTags(string $input, string $tagName, string $render): void { $fqsenResolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($fqsenResolver); @@ -354,10 +462,9 @@ /** * @return string[][] - * * @phpstan-return array> */ - public function validTagProvider() : array + public function validTagProvider(): array { //rendered result is adding a space, because the tags are not rendered properly. return [ @@ -407,7 +514,7 @@ /** * @dataProvider invalidTagProvider */ - public function testInValidFormattedTags(string $input) : void + public function testInValidFormattedTags(string $input): void { $this->expectException(InvalidArgumentException::class); $fqsenResolver = m::mock(FqsenResolver::class); @@ -418,10 +525,9 @@ /** * @return string[][] - * * @phpstan-return list> */ - public function invalidTagProvider() : array + public function invalidTagProvider(): array { return [ ['@tag[invalid]'], diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/AuthorTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/AuthorTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/AuthorTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/AuthorTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -25,7 +25,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -35,7 +35,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -50,7 +50,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -62,7 +62,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -76,7 +76,7 @@ * @covers ::__construct * @covers ::getAuthorName */ - public function testHasTheAuthorName() : void + public function testHasTheAuthorName(): void { $expected = 'Mike van Riel'; @@ -89,7 +89,7 @@ * @covers ::__construct * @covers ::getEmail */ - public function testHasTheAuthorMailAddress() : void + public function testHasTheAuthorMailAddress(): void { $expected = 'mike@phpdoc.org'; @@ -101,7 +101,7 @@ /** * @covers ::__construct */ - public function testInitializationFailsIfEmailIsNotValid() : void + public function testInitializationFailsIfEmailIsNotValid(): void { $this->expectException('InvalidArgumentException'); new Author('Mike van Riel', 'mike'); @@ -111,7 +111,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -128,7 +128,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutName() : void + public function testStringRepresentationIsReturnedWithoutName(): void { $fixture = new Author('', 'mike@phpdoc.org'); @@ -139,7 +139,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationWithEmtpyEmail() : void + public function testStringRepresentationWithEmtpyEmail(): void { $fixture = new Author('Mike van Riel', ''); @@ -152,7 +152,7 @@ * @covers ::create * @dataProvider authorTagProvider */ - public function testFactoryMethod(string $input, string $output, string $name, string $email) : void + public function testFactoryMethod(string $input, string $output, string $name, string $email): void { $fixture = Author::create($input); @@ -162,7 +162,7 @@ } /** @return mixed[][] */ - public function authorTagProvider() : array + public function authorTagProvider(): array { return [ [ @@ -191,7 +191,7 @@ * * @covers ::create */ - public function testFactoryMethodReturnsNullIfItCouldNotReadBody() : void + public function testFactoryMethodReturnsNullIfItCouldNotReadBody(): void { $this->assertNull(Author::create('dfgr<')); } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/CoversTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/CoversTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/CoversTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/CoversTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -16,6 +16,7 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context; @@ -30,7 +31,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -41,7 +42,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -57,7 +58,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -70,7 +71,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -84,7 +85,7 @@ * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() : void + public function testHasReferenceToFqsen(): void { $expected = new Fqsen('\DateTime'); @@ -99,7 +100,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -114,7 +115,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -131,7 +132,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -155,7 +156,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Covers(new Fqsen('\\')); @@ -175,10 +176,39 @@ } /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\See:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\FqsenResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create + */ + public function testFactoryMethodWithSpaceBeforeClass(): void + { + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $fixture = Covers::create( + 'Foo My Description ', + $descriptionFactory, + $fqsenResolver, + $context + ); + + $this->assertSame('\Foo My Description ', (string) $fixture); + $this->assertSame('\Foo', (string) $fixture->getReference()); + $this->assertSame('My Description ', $fixture->getDescription() . ''); + } + + /** * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithDescription() : void + public function testStringRepresentationIsReturnedWithDescription(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('My Description')); @@ -188,7 +218,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Covers::create('')); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/DeprecatedTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/DeprecatedTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/DeprecatedTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/DeprecatedTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -28,7 +28,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -39,7 +39,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -55,7 +55,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -68,7 +68,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -82,7 +82,7 @@ * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber() : void + public function testHasVersionNumber(): void { $expected = '1.0'; @@ -97,7 +97,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -112,7 +112,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -131,7 +131,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Deprecated(null, new Description('')); @@ -158,7 +158,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -183,7 +183,7 @@ * * @covers ::create */ - public function testFactoryMethodCreatesEmptyDeprecatedTag() : void + public function testFactoryMethodCreatesEmptyDeprecatedTag(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -200,7 +200,7 @@ * * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void { $this->assertEquals(new Deprecated(), Deprecated::create('dkhf<')); } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/ExampleTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/ExampleTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/ExampleTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/ExampleTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -2,10 +2,9 @@ declare(strict_types=1); -namespace DocBlock\Tags; +namespace phpDocumentor\Reflection\DocBlock\Tags; use InvalidArgumentException; -use phpDocumentor\Reflection\DocBlock\Tags\Example; use PHPUnit\Framework\TestCase; /** @@ -21,7 +20,7 @@ * @covers ::__construct * @covers ::getContent */ - public function testExampleWithoutContent() : void + public function testExampleWithoutContent(): void { $tag = Example::create('"example1.php"'); $this->assertEquals('"example1.php"', $tag->getContent()); @@ -37,7 +36,7 @@ * @covers ::getFilePath * @covers ::getDescription */ - public function testWithDescription() : void + public function testWithDescription(): void { $tag = Example::create('"example1.php" some text'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -52,7 +51,7 @@ * @covers ::getFilePath * @covers ::getStartingLine */ - public function testStartlineIsParsed() : void + public function testStartlineIsParsed(): void { $tag = Example::create('"example1.php" 10'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -68,7 +67,7 @@ * @covers ::getStartingLine * @covers ::getDescription */ - public function testAllowOmitingLineCount() : void + public function testAllowOmitingLineCount(): void { $tag = Example::create('"example1.php" 10 some text'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -85,7 +84,7 @@ * @covers ::getStartingLine * @covers ::getLineCount */ - public function testLengthIsParsed() : void + public function testLengthIsParsed(): void { $tag = Example::create('"example1.php" 10 5'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -97,7 +96,7 @@ * @covers ::create * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $tag = Example::create('"example1.php" 10 5 test text'); @@ -132,7 +131,7 @@ * @covers ::create * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $tag = Example::create(''); @@ -158,7 +157,7 @@ int $lineCount, ?string $description, string $content - ) : void { + ): void { $tag = Example::create($input); $this->assertSame($filePath, $tag->getFilePath()); $this->assertSame($startLine, $tag->getStartingLine()); @@ -168,7 +167,7 @@ } /** @return mixed[][] */ - public function tagContentProvider() : array + public function tagContentProvider(): array { return [ [ @@ -232,7 +231,7 @@ int $startLine, int $lineCount, string $description - ) : void { + ): void { $this->expectException(InvalidArgumentException::class); new Example( @@ -245,7 +244,7 @@ } /** @return mixed[][] */ - public function invalidExampleProvider() : array + public function invalidExampleProvider(): array { return [ 'invalid start' => [ diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -29,7 +29,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -45,7 +45,7 @@ * @covers ::format * @covers \phpDocumentor\Reflection\DocBlock\Tags\Formatter\AlignFormatter::__construct */ - public function testFormatterCallsToStringAndReturnsAStandardRepresentation() : void + public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): void { $tags = [ new Param('foobar', new String_()), diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -26,7 +26,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -38,7 +38,7 @@ * * @covers ::format */ - public function testFormatterCallsToStringAndReturnsAStandardRepresentation() : void + public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): void { $expected = '@unknown-tag This is a description'; @@ -57,7 +57,7 @@ * * @covers ::format */ - public function testFormatterToStringWitoutDescription() : void + public function testFormatterToStringWithoutDescription(): void { $expected = '@unknown-tag'; $fixture = new PassthroughFormatter(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/GenericTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/GenericTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/GenericTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/GenericTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -28,7 +28,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -39,7 +39,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Generic('generic', new Description('Description')); @@ -55,7 +55,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Generic('generic', new Description('Description')); @@ -68,7 +68,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Generic('generic', new Description('Description')); @@ -84,7 +84,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -100,7 +100,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Generic('generic', new Description('Description')); @@ -114,7 +114,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Generic('generic'); @@ -135,7 +135,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -155,7 +155,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfNameIsNotEmpty() : void + public function testFactoryMethodFailsIfNameIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); Generic::create('', ''); @@ -165,7 +165,7 @@ * @covers ::create * @covers ::__construct */ - public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void + public function testFactoryMethodFailsIfNameContainsIllegalCharacters(): void { $this->expectException('InvalidArgumentException'); Generic::create('', 'name/myname'); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/InvalidTagTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/InvalidTagTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/InvalidTagTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/InvalidTagTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -8,6 +8,7 @@ use InvalidArgumentException; use PHPUnit\Framework\TestCase; use Throwable; + use function fopen; use function serialize; use function unserialize; @@ -22,7 +23,7 @@ */ final class InvalidTagTest extends TestCase { - public function testCreationWithoutError() : void + public function testCreationWithoutError(): void { $tag = InvalidTag::create('Body', 'name'); @@ -35,7 +36,7 @@ * @covers ::withError * @covers ::__toString */ - public function testCreationWithError() : void + public function testCreationWithError(): void { $exception = new Exception(); $tag = InvalidTag::create('Body', 'name')->withError($exception); @@ -46,7 +47,7 @@ self::assertSame($exception, $tag->getException()); } - public function testCreationWithErrorContainingClosure() : void + public function testCreationWithErrorContainingClosure(): void { try { $this->throwExceptionFromClosureWithClosureArgument(); @@ -67,16 +68,16 @@ } } - private function throwExceptionFromClosureWithClosureArgument() : void + private function throwExceptionFromClosureWithClosureArgument(): void { - $function = static function () : void { + $function = static function (): void { throw new InvalidArgumentException(); }; $function($function); } - public function testCreationWithErrorContainingResource() : void + public function testCreationWithErrorContainingResource(): void { try { $this->throwExceptionWithResourceArgument(); @@ -99,12 +100,27 @@ } } - private function throwExceptionWithResourceArgument() : void + private function throwExceptionWithResourceArgument(): void { - $function = static function () : void { + $function = static function (): void { throw new InvalidArgumentException(); }; $function(fopen(__FILE__, 'r')); } + + public function testCreationWithErrorFromEval(): void + { + $builder = static function (): InvalidArgumentException { + return new InvalidArgumentException(); + }; + + $exception = eval('return $builder();'); + $tag = InvalidTag::create('Body', 'name')->withError($exception); + + self::assertSame('name', $tag->getName()); + self::assertSame('@name Body', $tag->render()); + self::assertSame('Body', (string) $tag); + self::assertSame($exception, $tag->getException()); + } } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/LinkTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/LinkTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/LinkTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/LinkTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -16,6 +16,8 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\StandardTagFactory; +use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; @@ -28,7 +30,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -39,7 +41,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -55,7 +57,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -68,7 +70,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -82,7 +84,7 @@ * @covers ::__construct * @covers ::getLink */ - public function testHasLinkUrl() : void + public function testHasLinkUrl(): void { $expected = 'http://this.is.my/link'; @@ -97,7 +99,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -112,7 +114,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -125,7 +127,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Link('http://this.is.my/link'); @@ -146,7 +148,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -164,6 +166,60 @@ } /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\See:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\FqsenResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create + */ + public function testFactoryMethodWithoutSpaceBeforeUrl(): void + { + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $fixture = Link::create( + 'http://this.is.my/link My Description ', + $descriptionFactory, + $context + ); + + $this->assertSame('http://this.is.my/link My Description ', (string) $fixture); + $this->assertSame('My Description ', $fixture->getDescription() . ''); + } + + /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\See:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\FqsenResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create + */ + public function testFactoryMethodWithSpaceBeforeUrl(): void + { + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $fixture = Link::create( + ' http://this.is.my/link My Description ', + $descriptionFactory, + $context + ); + + $this->assertSame('http://this.is.my/link My Description ', (string) $fixture); + $this->assertSame('http://this.is.my/link My Description ', $fixture->getDescription() . ''); + } + + /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description @@ -171,7 +227,7 @@ * * @covers ::create */ - public function testFactoryMethodCreatesEmptyLinkTag() : void + public function testFactoryMethodCreatesEmptyLinkTag(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/MethodTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/MethodTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/MethodTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/MethodTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -38,7 +38,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -48,7 +48,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Method('myMethod'); @@ -65,7 +65,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], @@ -92,7 +92,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Method('myMethod'); @@ -106,7 +106,7 @@ * @covers ::__construct * @covers ::getMethodName */ - public function testHasMethodName() : void + public function testHasMethodName(): void { $expected = 'myMethod'; @@ -119,7 +119,7 @@ * @covers ::__construct * @covers ::getArguments */ - public function testHasArguments() : void + public function testHasArguments(): void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], @@ -134,7 +134,7 @@ * @covers ::__construct * @covers ::getArguments */ - public function testArgumentsMayBePassedAsString() : void + public function testArgumentsMayBePassedAsString(): void { $arguments = ['argument1']; $expected = [ @@ -150,7 +150,7 @@ * @covers ::__construct * @covers ::getArguments */ - public function testArgumentTypeCanBeInferredAsMixed() : void + public function testArgumentTypeCanBeInferredAsMixed(): void { $arguments = [['name' => 'argument1']]; $expected = [ @@ -169,7 +169,7 @@ * * @covers ::create */ - public function testRestArgumentIsParsedAsRegularArg() : void + public function testRestArgumentIsParsedAsRegularArg(): void { $expected = [ ['name' => 'arg1', 'type' => new Mixed_()], @@ -197,7 +197,7 @@ * @covers ::__construct * @covers ::getReturnType */ - public function testHasReturnType() : void + public function testHasReturnType(): void { $expected = new String_(); @@ -210,7 +210,7 @@ * @covers ::__construct * @covers ::getReturnType */ - public function testReturnTypeCanBeInferredAsVoid() : void + public function testReturnTypeCanBeInferredAsVoid(): void { $fixture = new Method('myMethod', []); @@ -221,7 +221,7 @@ * @covers ::__construct * @covers ::isStatic */ - public function testMethodCanBeStatic() : void + public function testMethodCanBeStatic(): void { $expected = false; $fixture = new Method('myMethod', [], null, $expected); @@ -238,7 +238,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -254,7 +254,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], @@ -275,7 +275,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Method('myMethod', [], null, false, new Description('')); @@ -308,7 +308,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -349,7 +349,7 @@ * * @covers ::create */ - public function testReturnTypeThis() : void + public function testReturnTypeThis(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -380,7 +380,7 @@ * * @covers ::create */ - public function testReturnTypeNoneWithLongMethodName() : void + public function testReturnTypeNoneWithLongMethodName(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -406,7 +406,7 @@ /** * @return string[][] */ - public function collectionReturnTypesProvider() : array + public function collectionReturnTypesProvider(): array { return [ ['int[]', Array_::class, Integer::class, Compound::class], @@ -434,7 +434,7 @@ string $expectedType, ?string $expectedValueType = null, ?string $expectedKeyType = null - ) : void { + ): void { $resolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create') @@ -456,7 +456,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsEmpty() : void + public function testFactoryMethodFailsIfBodyIsEmpty(): void { $this->expectException('InvalidArgumentException'); Method::create(''); @@ -465,7 +465,7 @@ /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void + public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Method::create('body(')); @@ -474,7 +474,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Method::create('body'); @@ -483,7 +483,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Method::create('body', new TypeResolver()); @@ -492,7 +492,7 @@ /** * @covers ::__construct */ - public function testCreationFailsIfBodyIsEmpty() : void + public function testCreationFailsIfBodyIsEmpty(): void { $this->expectException('InvalidArgumentException'); new Method(''); @@ -501,7 +501,7 @@ /** * @covers ::__construct */ - public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void + public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void { $this->expectException('InvalidArgumentException'); new Method('body', [['name' => 'myName', 'unknown' => 'nah']]); @@ -517,7 +517,7 @@ * * @covers ::create */ - public function testCreateMethodParenthesisMissing() : void + public function testCreateMethodParenthesisMissing(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -554,7 +554,7 @@ * * @covers ::create */ - public function testCreateMethodEmptyArguments() : void + public function testCreateMethodEmptyArguments(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -591,7 +591,7 @@ * * @covers ::create */ - public function testCreateWithoutReturnType() : void + public function testCreateWithoutReturnType(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -629,7 +629,7 @@ * * @covers ::create */ - public function testCreateWithMixedReturnTypes() : void + public function testCreateWithMixedReturnTypes(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/ParamTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/ParamTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/ParamTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/ParamTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -33,7 +33,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -44,7 +44,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Param('myParameter', null, false, new Description('Description')); @@ -61,7 +61,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Param('myParameter', new String_(), true, new Description('Description')); $this->assertSame('@param string ...$myParameter Description', $fixture->render()); @@ -81,7 +81,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Param('myParameter'); @@ -95,7 +95,7 @@ * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() : void + public function testHasVariableName(): void { $expected = 'myParameter'; @@ -108,7 +108,7 @@ * @covers ::__construct * @covers ::getType */ - public function testHasType() : void + public function testHasType(): void { $expected = new String_(); @@ -121,7 +121,7 @@ * @covers ::__construct * @covers ::isVariadic */ - public function testIfParameterIsVariadic() : void + public function testIfParameterIsVariadic(): void { $fixture = new Param('myParameter', new String_(), false); $this->assertFalse($fixture->isVariadic()); @@ -136,7 +136,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -153,7 +153,7 @@ * @covers ::isVariadic * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Param('myParameter', new String_(), true, new Description('Description')); @@ -168,7 +168,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -195,7 +195,7 @@ * * @covers ::create */ - public function testFactoryMethodWithVariadic() : void + public function testFactoryMethodWithVariadic(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -222,7 +222,7 @@ * * @covers ::create */ - public function testFactoryMethodWithReference() : void + public function testFactoryMethodWithReference(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -249,7 +249,7 @@ * * @covers ::create */ - public function testFactoryMethodWithVariadicReference() : void + public function testFactoryMethodWithVariadicReference(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -281,7 +281,7 @@ * * @covers ::create */ - public function testFactoryMethodWithReferenceWithoutType() : void + public function testFactoryMethodWithReferenceWithoutType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -312,7 +312,7 @@ * * @covers ::create */ - public function testFactoryMethodWithVariadicReferenceWithoutType() : void + public function testFactoryMethodWithVariadicReferenceWithoutType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -343,7 +343,7 @@ * * @covers ::create */ - public function testFactoryMethodWithoutType() : void + public function testFactoryMethodWithoutType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -374,7 +374,7 @@ * * @covers ::create */ - public function testFactoryMethodWithType() : void + public function testFactoryMethodWithType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -402,7 +402,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -412,7 +412,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Param::create('body'); @@ -423,7 +423,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Param::create('body', new TypeResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/PropertyReadTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/PropertyReadTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/PropertyReadTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/PropertyReadTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -33,7 +33,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -44,7 +44,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new PropertyRead('myProperty', null, new Description('Description')); @@ -60,7 +60,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new PropertyRead('myProperty', new String_(), new Description('Description')); $this->assertSame('@property-read string $myProperty Description', $fixture->render()); @@ -77,7 +77,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new PropertyRead('myProperty'); @@ -91,7 +91,7 @@ * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() : void + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -104,7 +104,7 @@ * @covers ::__construct * @covers ::getType */ - public function testHasType() : void + public function testHasType(): void { $expected = new String_(); @@ -119,7 +119,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -135,7 +135,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new PropertyRead('myProperty', new String_(), new Description('Description')); @@ -150,7 +150,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -180,7 +180,7 @@ * * @covers ::create */ - public function testFactoryMethodWithoutType() : void + public function testFactoryMethodWithoutType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -209,7 +209,7 @@ * * @covers ::create */ - public function testFactoryMethodWithType() : void + public function testFactoryMethodWithType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -237,7 +237,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -247,7 +247,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); PropertyRead::create('body'); @@ -258,7 +258,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); PropertyRead::create('body', new TypeResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/PropertyTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/PropertyTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/PropertyTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/PropertyTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -33,7 +33,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -44,7 +44,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Property('myProperty', null, new Description('Description')); @@ -60,7 +60,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Property('myProperty', new String_(), new Description('Description')); $this->assertSame('@property string $myProperty Description', $fixture->render()); @@ -77,7 +77,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Property('myProperty'); @@ -91,7 +91,7 @@ * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() : void + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -104,7 +104,7 @@ * @covers ::__construct * @covers ::getType */ - public function testHasType() : void + public function testHasType(): void { $expected = new String_(); @@ -119,7 +119,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -135,7 +135,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Property('myProperty', new String_(), new Description('Description')); @@ -150,7 +150,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -175,7 +175,7 @@ * * @covers ::create */ - public function testFactoryMethodWithoutType() : void + public function testFactoryMethodWithoutType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -204,7 +204,7 @@ * * @covers ::create */ - public function testFactoryMethodWithType() : void + public function testFactoryMethodWithType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -232,7 +232,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -242,7 +242,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Property::create('body'); @@ -253,7 +253,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Property::create('body', new TypeResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/PropertyWriteTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/PropertyWriteTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/PropertyWriteTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/PropertyWriteTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -33,7 +33,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -44,7 +44,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new PropertyWrite('myProperty', null, new Description('Description')); @@ -60,7 +60,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new PropertyWrite('myProperty', new String_(), new Description('Description')); $this->assertSame('@property-write string $myProperty Description', $fixture->render()); @@ -77,7 +77,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new PropertyWrite('myProperty'); @@ -91,7 +91,7 @@ * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() : void + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -104,7 +104,7 @@ * @covers ::__construct * @covers ::getType */ - public function testHasType() : void + public function testHasType(): void { $expected = new String_(); @@ -119,7 +119,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -135,7 +135,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new PropertyWrite('myProperty', new String_(), new Description('Description')); @@ -150,7 +150,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -180,7 +180,7 @@ * * @covers ::create */ - public function testFactoryMethodWithoutType() : void + public function testFactoryMethodWithoutType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -209,7 +209,7 @@ * * @covers ::create */ - public function testFactoryMethodWithType() : void + public function testFactoryMethodWithType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -237,7 +237,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -247,7 +247,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); PropertyWrite::create('body'); @@ -258,7 +258,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); PropertyWrite::create('body', new TypeResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/ReturnTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/ReturnTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/ReturnTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/ReturnTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -31,7 +31,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -42,7 +42,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Return_(new String_(), new Description('Description')); @@ -58,7 +58,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Return_(new String_(), new Description('Description')); @@ -71,7 +71,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Return_(new String_(), new Description('Description')); @@ -85,7 +85,7 @@ * @covers ::__construct * @covers ::getType */ - public function testHasType() : void + public function testHasType(): void { $expected = new String_(); @@ -100,7 +100,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -115,7 +115,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Return_(new String_(), new Description('Description')); @@ -128,7 +128,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Return_(new String_()); @@ -151,7 +151,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -187,7 +187,7 @@ * * @covers ::create */ - public function testFactoryMethodWithGenericWithSpace() : void + public function testFactoryMethodWithGenericWithSpace(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -216,7 +216,7 @@ * * @covers ::create */ - public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour() : void + public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour(): void { $this->markTestSkipped('A bug in the TypeResolver breaks this test'); $this->expectException(InvalidArgumentException::class); @@ -244,7 +244,7 @@ * * @covers ::create */ - public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour() : void + public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -265,7 +265,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Return_::create('')); @@ -274,7 +274,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Return_::create('body'); @@ -283,7 +283,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Return_::create('body', new TypeResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/SeeTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/SeeTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/SeeTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/SeeTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -16,7 +16,9 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as FqsenRef; +use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as TagsFqsen; use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url as UrlRef; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\FqsenResolver; @@ -32,7 +34,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -45,7 +47,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -62,7 +64,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -77,7 +79,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -94,7 +96,7 @@ * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() : void + public function testHasReferenceToFqsen(): void { $expected = new FqsenRef(new Fqsen('\DateTime')); @@ -111,7 +113,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -128,7 +130,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()')), new Description('Description')); @@ -143,7 +145,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()'))); @@ -167,7 +169,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -199,7 +201,7 @@ * * @covers ::create */ - public function testFactoryMethodWithNonClassFQSEN() : void + public function testFactoryMethodWithNonClassFQSEN(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -230,7 +232,7 @@ * * @covers ::create */ - public function testFactoryMethodWithUrl() : void + public function testFactoryMethodWithUrl(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -252,9 +254,39 @@ } /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\See:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\FqsenResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create + */ + public function testFactoryMethodWithoutUrl(): void + { + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $fixture = See::create( + 'Foo My Description ', + $fqsenResolver, + $descriptionFactory, + $context + ); + + $this->assertSame('\Foo My Description ', (string) $fixture); + $this->assertInstanceOf(TagsFqsen::class, $fixture->getReference()); + $this->assertSame('\Foo', (string) $fixture->getReference()); + $this->assertSame('My Description ', $fixture->getDescription() . ''); + } + + /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(See::create('')); @@ -263,7 +295,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); See::create('body'); @@ -272,7 +304,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); See::create('body', new FqsenResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/SinceTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/SinceTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/SinceTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/SinceTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -28,7 +28,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -39,7 +39,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Since('1.0', new Description('Description')); @@ -55,7 +55,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Since('1.0', new Description('Description')); @@ -68,7 +68,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Since('1.0', new Description('Description')); @@ -82,7 +82,7 @@ * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber() : void + public function testHasVersionNumber(): void { $expected = '1.0'; @@ -97,7 +97,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -112,7 +112,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Since('1.0', new Description('Description')); @@ -125,7 +125,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Since('1.0'); @@ -146,7 +146,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -171,7 +171,7 @@ * * @covers ::create */ - public function testFactoryMethodCreatesEmptySinceTag() : void + public function testFactoryMethodCreatesEmptySinceTag(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -186,7 +186,7 @@ /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void { $this->assertNull(Since::create('dkhf<')); } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/SourceTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/SourceTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/SourceTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/SourceTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -28,7 +28,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -39,7 +39,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Source(1, null, new Description('Description')); @@ -55,7 +55,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Source(1, 10, new Description('Description')); $this->assertSame('@source 1 10 Description', $fixture->render()); @@ -72,7 +72,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Source(1); @@ -86,7 +86,7 @@ * @covers ::__construct * @covers ::getStartingLine */ - public function testHasStartingLine() : void + public function testHasStartingLine(): void { $expected = 1; @@ -99,7 +99,7 @@ * @covers ::__construct * @covers ::getLineCount */ - public function testHasLineCount() : void + public function testHasLineCount(): void { $expected = 2; @@ -114,7 +114,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -130,7 +130,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Source(1, 10, new Description('Description')); @@ -144,7 +144,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Source(1); @@ -171,7 +171,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -194,7 +194,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -206,7 +206,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Source::create('1'); @@ -215,7 +215,7 @@ /** * @covers ::__construct */ - public function testExceptionIsThrownIfStartingLineIsNotInteger() : void + public function testExceptionIsThrownIfStartingLineIsNotInteger(): void { $this->expectException('InvalidArgumentException'); new Source('blabla'); @@ -224,7 +224,7 @@ /** * @covers ::__construct */ - public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() : void + public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull(): void { $this->expectException('InvalidArgumentException'); new Source('1', []); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/ThrowsTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/ThrowsTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/ThrowsTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/ThrowsTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -31,7 +31,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -42,7 +42,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Throws(new String_(), new Description('Description')); @@ -58,7 +58,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Throws(new String_(), new Description('Description')); @@ -71,7 +71,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Throws(new String_(), new Description('Description')); @@ -85,7 +85,7 @@ * @covers ::__construct * @covers ::getType */ - public function testHasType() : void + public function testHasType(): void { $expected = new String_(); @@ -100,7 +100,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -115,7 +115,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Throws(new String_(), new Description('Description')); @@ -134,7 +134,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Throws(new String_()); @@ -157,7 +157,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -193,7 +193,7 @@ * * @covers ::create */ - public function testFactoryMethodWithGenericWithSpace() : void + public function testFactoryMethodWithGenericWithSpace(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -222,7 +222,7 @@ * * @covers ::create */ - public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour() : void + public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour(): void { $this->markTestSkipped('A bug in the TypeResolver breaks this test'); $this->expectException(InvalidArgumentException::class); @@ -250,7 +250,7 @@ * * @covers ::create */ - public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour() : void + public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -271,7 +271,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Throws::create('')); @@ -280,7 +280,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Throws::create('body'); @@ -289,7 +289,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Throws::create('body', new TypeResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/UsesTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/UsesTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/UsesTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/UsesTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -16,6 +16,7 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context; @@ -30,7 +31,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -41,7 +42,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -57,7 +58,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -70,7 +71,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -84,7 +85,7 @@ * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() : void + public function testHasReferenceToFqsen(): void { $expected = new Fqsen('\DateTime'); @@ -99,7 +100,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -114,7 +115,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -127,8 +128,14 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { + $fixture = new Uses(new Fqsen('\\')); + + $this->assertSame('\\', (string) $fixture); + + // --- + $fixture = new Uses(new Fqsen('\DateTime')); $this->assertSame('\DateTime', (string) $fixture); @@ -150,7 +157,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -171,9 +178,69 @@ } /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\See:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\FqsenResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create + */ + public function testFactoryMethodWithoutSpaceBeforeClass(): void + { + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $fixture = Uses::create( + 'Foo My Description ', + $fqsenResolver, + $descriptionFactory, + $context + ); + + $this->assertSame('\Foo My Description ', (string) $fixture); + $this->assertInstanceOf(Fqsen::class, $fixture->getReference()); + $this->assertSame('\\Foo', (string) $fixture->getReference()); + $this->assertSame('My Description ', $fixture->getDescription() . ''); + } + + /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\See:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\FqsenResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create + */ + public function testFactoryMethodWithSpaceBeforeClass(): void + { + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + $context = new Context(''); + + $fixture = Uses::create( + ' Foo My Description ', + $fqsenResolver, + $descriptionFactory, + $context + ); + + $this->assertSame('\ Foo My Description ', (string) $fixture); + $this->assertInstanceOf(Fqsen::class, $fixture->getReference()); + $this->assertSame('\\', (string) $fixture->getReference()); + $this->assertSame('Foo My Description ', $fixture->getDescription() . ''); + } + + /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Uses::create('')); @@ -182,7 +249,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Uses::create('body'); @@ -191,7 +258,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Uses::create('body', new FqsenResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/VarTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/VarTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/VarTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/VarTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -33,7 +33,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -44,7 +44,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Var_('myVariable', null, new Description('Description')); @@ -56,7 +56,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfVariableNameIsOmmitedIfEmpty() : void + public function testIfVariableNameIsOmmitedIfEmpty(): void { $fixture = new Var_('', null, null); @@ -72,7 +72,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Var_('myVariable', new String_(), new Description('Description')); $this->assertSame('@var string $myVariable Description', $fixture->render()); @@ -89,7 +89,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Var_('myVariable'); @@ -103,7 +103,7 @@ * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() : void + public function testHasVariableName(): void { $expected = 'myVariable'; @@ -116,7 +116,7 @@ * @covers ::__construct * @covers ::getType */ - public function testHasType() : void + public function testHasType(): void { $expected = new String_(); @@ -131,7 +131,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -147,7 +147,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Var_('myVariable', new String_(), new Description('Description')); @@ -161,7 +161,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Var_('myVariable'); @@ -188,7 +188,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -213,7 +213,7 @@ * * @covers ::create */ - public function testFactoryMethodWithoutType() : void + public function testFactoryMethodWithoutType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -242,7 +242,7 @@ * * @covers ::create */ - public function testFactoryMethodWithType() : void + public function testFactoryMethodWithType(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -271,7 +271,7 @@ * * @covers ::create */ - public function testFactoryMethodWithTypeWithoutComment() : void + public function testFactoryMethodWithTypeWithoutComment(): void { $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); @@ -299,7 +299,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -309,7 +309,7 @@ /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Var_::create('body'); @@ -320,7 +320,7 @@ * * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Var_::create('body', new TypeResolver()); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/VersionTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/VersionTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlock/Tags/VersionTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlock/Tags/VersionTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -28,7 +28,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -39,7 +39,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() : void + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Version('1.0', new Description('Description')); @@ -55,7 +55,7 @@ * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() : void + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Version('1.0', new Description('Description')); @@ -68,7 +68,7 @@ * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() : void + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Version('1.0', new Description('Description')); @@ -82,7 +82,7 @@ * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber() : void + public function testHasVersionNumber(): void { $expected = '1.0'; @@ -97,7 +97,7 @@ * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription() : void + public function testHasDescription(): void { $expected = new Description('Description'); @@ -112,7 +112,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() : void + public function testStringRepresentationIsReturned(): void { $fixture = new Version('1.0', new Description('Description')); @@ -125,7 +125,7 @@ * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturnedWithoutDescription() : void + public function testStringRepresentationIsReturnedWithoutDescription(): void { $fixture = new Version('1.0'); @@ -146,7 +146,7 @@ * * @covers ::create */ - public function testFactoryMethod() : void + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -171,7 +171,7 @@ * * @covers ::create */ - public function testFactoryMethodCreatesEmptyVersionTag() : void + public function testFactoryMethodCreatesEmptyVersionTag(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -186,7 +186,7 @@ /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void { $this->assertNull(Version::create('dkhf<')); } diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlockFactoryTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlockFactoryTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlockFactoryTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlockFactoryTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -23,6 +23,10 @@ use PHPUnit\Framework\TestCase; use ReflectionClass; +use function str_replace; + +use const PHP_EOL; + /** * @uses \Webmozart\Assert\Assert * @uses \phpDocumentor\Reflection\DocBlock @@ -35,7 +39,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -47,7 +51,7 @@ * @covers ::__construct * @covers ::createInstance */ - public function testCreateFactoryUsingFactoryMethod() : void + public function testCreateFactoryUsingFactoryMethod(): void { $fixture = DocBlockFactory::createInstance(); @@ -60,7 +64,7 @@ * @covers ::__construct * @covers ::create */ - public function testCreateDocBlockFromReflection() : void + public function testCreateDocBlockFromReflection(): void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); @@ -83,7 +87,7 @@ * @covers ::__construct * @covers ::create */ - public function testCreateDocBlockFromStringWithDocComment() : void + public function testCreateDocBlockFromStringWithDocComment(): void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); @@ -103,7 +107,7 @@ * @covers ::create * @covers ::__construct */ - public function testCreateDocBlockFromStringWithoutDocComment() : void + public function testCreateDocBlockFromStringWithoutDocComment(): void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); @@ -126,7 +130,7 @@ * * @dataProvider provideSummaryAndDescriptions */ - public function testSummaryAndDescriptionAreSeparated(string $given, string $summary, string $description) : void + public function testSummaryAndDescriptionAreSeparated(string $given, string $summary, string $description): void { $tagFactory = m::mock(TagFactory::class); $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); @@ -134,7 +138,7 @@ $docblock = $fixture->create($given); $this->assertSame($summary, $docblock->getSummary()); - $this->assertEquals(new Description($description), $docblock->getDescription()); + $this->assertEquals(new Description(str_replace(PHP_EOL, "\n", $description)), $docblock->getDescription()); } /** @@ -144,7 +148,7 @@ * @covers ::__construct * @covers ::create */ - public function testDescriptionsRetainFormatting() : void + public function testDescriptionsRetainFormatting(): void { $tagFactory = m::mock(TagFactory::class); $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); @@ -159,12 +163,7 @@ */ DOCBLOCK; - $description = <<create($given); @@ -178,16 +177,11 @@ * @covers ::__construct * @covers ::create */ - public function testTagsAreInterpretedUsingFactory() : void + public function testTagsAreInterpretedUsingFactory(): void { - $tagString = << This is with - multiline description. -TAG; - $tag = m::mock(Tag::class); $tagFactory = m::mock(TagFactory::class); - $tagFactory->shouldReceive('create')->with($tagString, m::type(Context::class))->andReturn($tag); + $tagFactory->shouldReceive('create')->with(m::any(), m::type(Context::class))->andReturn($tag); $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); @@ -208,7 +202,7 @@ /** * @return string[] */ - public function provideSummaryAndDescriptions() : array + public function provideSummaryAndDescriptions(): array { return [ ['This is a DocBlock', 'This is a DocBlock', ''], @@ -268,7 +262,7 @@ * @covers ::__construct * @covers ::create */ - public function testTagsWithContextNamespace() : void + public function testTagsWithContextNamespace(): void { $tagFactoryMock = m::mock(TagFactory::class); $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), $tagFactoryMock); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlockTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlockTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/DocBlockTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/DocBlockTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -16,12 +16,13 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Types\String_; use PHPUnit\Framework\TestCase; /** * @uses \Webmozart\Assert\Assert * - * @coversDefaultClass phpDocumentor\Reflection\DocBlock + * @coversDefaultClass \phpDocumentor\Reflection\DocBlock * @covers :: */ class DocBlockTest extends TestCase @@ -29,7 +30,7 @@ /** * Call Mockery::close after each test. */ - public function tearDown() : void + public function tearDown(): void { m::close(); } @@ -40,7 +41,7 @@ * @covers ::__construct * @covers ::getSummary */ - public function testDocBlockCanHaveASummary() : void + public function testDocBlockCanHaveASummary(): void { $summary = 'This is a summary'; @@ -55,7 +56,7 @@ * @covers ::__construct * @covers ::getSummary */ - public function testDocBlockCanHaveEllipsisInSummary() : void + public function testDocBlockCanHaveEllipsisInSummary(): void { $summary = 'This is a short (...) description.'; @@ -70,7 +71,7 @@ * @covers ::__construct * @covers ::getDescription */ - public function testDocBlockCanHaveADescription() : void + public function testDocBlockCanHaveADescription(): void { $description = new DocBlock\Description(''); @@ -86,7 +87,7 @@ * @covers ::__construct * @covers ::getTags */ - public function testDocBlockCanHaveTags() : void + public function testDocBlockCanHaveTags(): void { $tags = [ m::mock(DocBlock\Tag::class), @@ -104,7 +105,7 @@ * @covers ::__construct * @covers ::getTags */ - public function testDocBlockAllowsOnlyTags() : void + public function testDocBlockAllowsOnlyTags(): void { $this->expectException('InvalidArgumentException'); $tags = [null]; @@ -119,7 +120,7 @@ * @covers ::__construct * @covers ::getTagsByName */ - public function testFindTagsInDocBlockByName() : void + public function testFindTagsInDocBlockByName(): void { $tag1 = m::mock(DocBlock\Tag::class); $tag2 = m::mock(DocBlock\Tag::class); @@ -144,9 +145,31 @@ * @uses \phpDocumentor\Reflection\DocBlock\Tag * * @covers ::__construct + * @covers ::getTagsWithTypeByName + */ + public function testFindTagsWithTypeInDocBlockByName(): void + { + $tag1 = new DocBlock\Tags\Var_('foo', new String_()); + $tag2 = new DocBlock\Tags\Var_('bar', new String_()); + $tag3 = new DocBlock\Tags\Return_(new String_()); + $tag4 = new DocBlock\Tags\Author('lall', ''); + + $fixture = new DocBlock('', null, [$tag1, $tag2, $tag3, $tag4]); + + $this->assertSame([$tag1, $tag2], $fixture->getTagsWithTypeByName('var')); + $this->assertSame([$tag3], $fixture->getTagsWithTypeByName('return')); + $this->assertSame([], $fixture->getTagsWithTypeByName('author')); + } + + /** + * @uses \phpDocumentor\Reflection\DocBlock::getTags + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tag + * + * @covers ::__construct * @covers ::hasTag */ - public function testCheckIfThereAreTagsWithAGivenName() : void + public function testCheckIfThereAreTagsWithAGivenName(): void { $tag1 = m::mock(DocBlock\Tag::class); $tag2 = m::mock(DocBlock\Tag::class); @@ -170,7 +193,7 @@ * @covers ::__construct * @covers ::getContext */ - public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre() : void + public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre(): void { $context = new Context(''); @@ -186,7 +209,7 @@ * @covers ::__construct * @covers ::getLocation */ - public function testDocBlockKnowsAtWhichLineItIs() : void + public function testDocBlockKnowsAtWhichLineItIs(): void { $location = new Location(10); @@ -202,7 +225,7 @@ * @covers ::isTemplateStart * @covers ::isTemplateEnd */ - public function testDocBlockIsNotATemplateByDefault() : void + public function testDocBlockIsNotATemplateByDefault(): void { $fixture = new DocBlock('', null, [], null, null); @@ -216,7 +239,7 @@ * @covers ::__construct * @covers ::isTemplateStart */ - public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate() : void + public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate(): void { $fixture = new DocBlock('', null, [], null, null, true); @@ -229,7 +252,7 @@ * @covers ::__construct * @covers ::isTemplateEnd */ - public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate() : void + public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate(): void { $fixture = new DocBlock('', null, [], null, null, false, true); @@ -242,7 +265,7 @@ * @covers ::__construct * @covers ::removeTag */ - public function testRemoveTag() : void + public function testRemoveTag(): void { $someTag = new Deprecated(); $anotherTag = new Deprecated(); diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/Exception/PcreExceptionTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/Exception/PcreExceptionTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/Exception/PcreExceptionTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/Exception/PcreExceptionTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\Exception; use PHPUnit\Framework\TestCase; + use const PREG_BACKTRACK_LIMIT_ERROR; use const PREG_BAD_UTF8_ERROR; use const PREG_BAD_UTF8_OFFSET_ERROR; @@ -22,7 +23,7 @@ * @covers ::createFromPhpError * @dataProvider errorCodeProvider */ - public function testErrorConversion(int $errorCode, string $message) : void + public function testErrorConversion(int $errorCode, string $message): void { $this->assertSame($message, PcreException::createFromPhpError($errorCode)->getMessage()); } @@ -30,7 +31,7 @@ /** * @return array */ - public function errorCodeProvider() : array + public function errorCodeProvider(): array { return [ [ diff -Nru php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/PregSplitTest.php php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/PregSplitTest.php --- php-phpdocumentor-reflection-docblock-5.2.2/tests/unit/PregSplitTest.php 2020-09-19 10:49:16.000000000 +0000 +++ php-phpdocumentor-reflection-docblock-5.3.0/tests/unit/PregSplitTest.php 2021-10-19 17:43:47.000000000 +0000 @@ -6,7 +6,9 @@ use phpDocumentor\Reflection\Exception\PcreException; use PHPUnit\Framework\TestCase; + use function set_error_handler; + use const E_WARNING; final class PregSplitTest extends TestCase @@ -14,7 +16,7 @@ /** @var callable|null */ private $errorHandler = null; - protected function tearDown() : void + protected function tearDown(): void { if ($this->errorHandler === null) { return; @@ -26,7 +28,7 @@ /** * @covers \phpDocumentor\Reflection\Utils::pregSplit */ - public function testSimplePregSplit() : void + public function testSimplePregSplit(): void { $result = Utils::pregSplit('/\s/', 'word split'); @@ -36,10 +38,10 @@ /** * @covers \phpDocumentor\Reflection\Utils::pregSplit */ - public function testPregSplitThrowsOnError() : void + public function testPregSplitThrowsOnError(): void { //We need to disable the error handler for phpunit... because we expect some errors here - $this->errorHandler = set_error_handler(static function () : void { + $this->errorHandler = set_error_handler(static function (): void { }, E_WARNING); $this->expectException(PcreException::class);