From 70745c7dcb15256a0e592ab0e78f3643229f66c3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 27 Jun 2020 17:54:35 +0200 Subject: [PATCH] Bump dependencies --- composer.lock | 48 +++++++++++-------- phpcs.xml.dist | 1 + src/DocBlock/StandardTagFactory.php | 3 +- src/DocBlock/Tags/Deprecated.php | 2 +- src/DocBlock/Tags/Since.php | 2 +- tests/unit/Assets/CustomParam.php | 40 ++++++++++++++++ tests/unit/Assets/CustomServiceClass.php | 39 +++++++++++++++ tests/unit/Assets/CustomServiceInterface.php | 38 +++++++++++++++ .../unit/DocBlock/StandardTagFactoryTest.php | 33 ++++++------- 9 files changed, 166 insertions(+), 40 deletions(-) create mode 100644 tests/unit/Assets/CustomParam.php create mode 100644 tests/unit/Assets/CustomServiceClass.php create mode 100644 tests/unit/Assets/CustomServiceInterface.php diff --git a/composer.lock b/composer.lock index be5f580..510e84b 100644 --- a/composer.lock +++ b/composer.lock @@ -102,16 +102,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.14.0", + "version": "v1.17.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" + "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", "shasum": "" }, "require": { @@ -123,7 +123,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -156,20 +160,20 @@ "polyfill", "portable" ], - "time": "2020-01-13T11:15:53+00:00" + "time": "2020-06-06T08:46:27+00:00" }, { "name": "webmozart/assert", - "version": "1.7.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" + "reference": "9dc4f203e36f2b486149058bade43c851dd97451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", + "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", + "reference": "9dc4f203e36f2b486149058bade43c851dd97451", "shasum": "" }, "require": { @@ -177,7 +181,8 @@ "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "vimeo/psalm": "<3.6.0" + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" @@ -204,7 +209,7 @@ "check", "validate" ], - "time": "2020-02-14T12:15:55+00:00" + "time": "2020-06-16T10:16:42+00:00" } ], "packages-dev": [ @@ -258,30 +263,33 @@ }, { "name": "mockery/mockery", - "version": "1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be" + "reference": "6c6a7c533469873deacf998237e7649fc6b36223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", - "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", + "url": "https://api.github.com/repos/mockery/mockery/zipball/6c6a7c533469873deacf998237e7649fc6b36223", + "reference": "6c6a7c533469873deacf998237e7649fc6b36223", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "~2.0", "lib-pcre": ">=7.0", - "php": ">=5.6.0" + "php": "^7.3.0" + }, + "conflict": { + "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" + "phpunit/phpunit": "^8.0.0 || ^9.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -319,7 +327,7 @@ "test double", "testing" ], - "time": "2019-12-26T09:49:15+00:00" + "time": "2020-05-19T14:25:16+00:00" } ], "aliases": [], diff --git a/phpcs.xml.dist b/phpcs.xml.dist index b20596d..86e6d20 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -5,6 +5,7 @@ src tests/unit */tests/unit/Types/ContextFactoryTest.php + */tests/unit/Assets/* diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 015a0d8..8fb4aca 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -17,7 +17,6 @@ use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock\Tags\Author; use phpDocumentor\Reflection\DocBlock\Tags\Covers; use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; use phpDocumentor\Reflection\DocBlock\Tags\Generic; use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; @@ -165,7 +164,7 @@ final class StandardTagFactory implements TagFactory { Assert::stringNotEmpty($tagName); Assert::classExists($handler); - Assert::implementsInterface($handler, StaticMethod::class); + Assert::implementsInterface($handler, Tag::class); if (strpos($tagName, '\\') && $tagName[0] !== '\\') { throw new InvalidArgumentException( diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 2a9f1bf..9b05d22 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -48,7 +48,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod public function __construct(?string $version = null, ?Description $description = null) { - Assert::nullOrStringNotEmpty($version); + Assert::nullOrNotEmpty($version); $this->version = $version; $this->description = $description; diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index d00ca38..dc12624 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -48,7 +48,7 @@ final class Since extends BaseTag implements Factory\StaticMethod public function __construct(?string $version = null, ?Description $description = null) { - Assert::nullOrStringNotEmpty($version); + Assert::nullOrNotEmpty($version); $this->version = $version; $this->description = $description; diff --git a/tests/unit/Assets/CustomParam.php b/tests/unit/Assets/CustomParam.php new file mode 100644 index 0000000..36abb80 --- /dev/null +++ b/tests/unit/Assets/CustomParam.php @@ -0,0 +1,40 @@ +fqsenResolver = $fqsenResolver; + $tag->myParam = $myParam; + + return $tag; + } + + public function render(?Formatter $formatter = null) : string + { + return $this->getName(); + } + + public function __toString() : string + { + return $this->getName(); + } +} diff --git a/tests/unit/Assets/CustomServiceClass.php b/tests/unit/Assets/CustomServiceClass.php new file mode 100644 index 0000000..c68c2eb --- /dev/null +++ b/tests/unit/Assets/CustomServiceClass.php @@ -0,0 +1,39 @@ +formatter = $formatter; + + return $tag; + } + + public function render(?Formatter $formatter = null) : string + { + return $this->getName(); + } + + public function __toString() : string + { + return $this->getName(); + } +} diff --git a/tests/unit/Assets/CustomServiceInterface.php b/tests/unit/Assets/CustomServiceInterface.php new file mode 100644 index 0000000..14b96b3 --- /dev/null +++ b/tests/unit/Assets/CustomServiceInterface.php @@ -0,0 +1,38 @@ +formatter = $formatter; + + return $tag; + } + + public function render(?Formatter $formatter = null) : string + { + return $this->getName(); + } + + public function __toString() : string + { + return $this->getName(); + } +} diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 2ea0aaa..1154eb6 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -15,6 +15,9 @@ namespace phpDocumentor\Reflection\DocBlock; use InvalidArgumentException; use Mockery as m; +use phpDocumentor\Reflection\Assets\CustomParam; +use phpDocumentor\Reflection\Assets\CustomServiceClass; +use phpDocumentor\Reflection\Assets\CustomServiceInterface; use phpDocumentor\Reflection\DocBlock\Tags\Author; use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; @@ -169,13 +172,13 @@ class StandardTagFactoryTest extends TestCase { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->addParameter('myParam', 'myValue'); + $tagFactory->registerTagHandler('spy', CustomParam::class); - $this->assertAttributeSame( - [FqsenResolver::class => $resolver, 'myParam' => 'myValue'], - 'serviceLocator', - $tagFactory - ); + $tagFactory->addParameter('myParam', 'myValue'); + $spy = $tagFactory->create('@spy'); + + $this->assertSame($resolver, $spy->fqsenResolver); + $this->assertSame('myValue', $spy->myParam); } /** @@ -190,12 +193,11 @@ class StandardTagFactoryTest extends TestCase $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->addService($service); + $tagFactory->registerTagHandler('spy', CustomServiceClass::class); - $this->assertAttributeSame( - [FqsenResolver::class => $resolver, PassthroughFormatter::class => $service], - 'serviceLocator', - $tagFactory - ); + $spy = $tagFactory->create('@spy'); + + $this->assertSame($service, $spy->formatter); } /** @@ -211,12 +213,11 @@ class StandardTagFactoryTest extends TestCase $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->addService($service, $interfaceName); + $tagFactory->registerTagHandler('spy', CustomServiceInterface::class); - $this->assertAttributeSame( - [FqsenResolver::class => $resolver, $interfaceName => $service], - 'serviceLocator', - $tagFactory - ); + $spy = $tagFactory->create('@spy'); + + $this->assertSame($service, $spy->formatter); } /**