Compare commits

...
44 Commits
Author SHA1 Message Date
Barry vd. Heuvel bba116ba9d Merge pull request #17 from KentarouTakeda/nested-generics-and-closures-type-hint
Support nested generics and closures type hint
2024-10-16 13:06:28 +02:00
武田 憲太郎 23fa082874 Support nested generics and closures type hint 2024-10-16 18:33:31 +09:00
Barry vd. Heuvel e6811e927f Merge pull request #14 from JeRabix/master
add support parse generic type in docBlock
2023-06-14 07:06:27 +02:00
Murchenko 05596d7626 add support parse generic type in docBlock 2023-04-13 22:42:48 +03:00
Barry vd. Heuvel e5e172728c Merge pull request #13 from EspadaV8/suppress-warnings-tag-handler
Support parsing SuppressWarnings tags in doc block
2022-11-25 14:06:57 +01:00
Andrew Smith 9a2f0eb8ba Support parsing SuppressWarnings tags in doc block
Signed-off-by: Andrew Smith <[email protected]>
2022-11-03 21:08:57 +10:00
Barry vd. Heuvel bf44b757fe Merge pull request #12 from barryvdh/fix-deprecated
Fix deprecated messages
2022-10-31 16:35:43 +01:00
Barry vd. Heuvel e6526132ee Fix deprecated messages 2022-10-31 16:34:24 +01:00
Barry vd. Heuvel 6b7c110b33 Merge pull request #10 from barryvdh/test-ghactions
Create run-tests.yml
2022-10-31 16:22:38 +01:00
Barry vd. Heuvel ad1e63e15c Fix tests 2022-10-31 16:20:50 +01:00
Barry vd. Heuvel 6eafab0ff3 Revert "Check namespace + class to see if it exists"
This reverts commit 7f729dc9a7.
2022-10-31 16:13:13 +01:00
Barry vd. Heuvel fe49c3d9ee Update tests 2022-10-31 16:13:07 +01:00
Barry vd. Heuvel 3f6ec1c280 Merge pull request #8 from Kerigard/feat/separate-tags
feat: add separation of tags into groups
2022-10-31 16:06:25 +01:00
Barry vd. Heuvel 72df918400 Create run-tests.yml 2022-10-31 16:05:08 +01:00
Barry vd. Heuvel c10c41e932 Merge pull request #7 from angeljqv/patch-2
Create .gitattributes
2022-10-31 16:01:16 +01:00
Barry vd. Heuvel 977da00f0f Merge pull request #6 from Stevemoretz/patch-2
Check namespace + class to see if it exists
2022-10-31 16:01:03 +01:00
Barry vd. Heuvel 7e5538a638 Merge pull request #9 from bbprojectnet/generic-types-fix
Generic types recognitions bug fix
2022-10-31 16:00:41 +01:00
M@ster 295d2fba38 Generic types bug fix 2022-10-19 23:16:04 +02:00
Kerigard ef9f04dd59 feat: add separation of tags into groups 2022-09-17 20:54:33 +03:00
angeljqv 6171834fde Create .gitattributes 2022-06-13 16:05:10 -05:00
Steve Moretz 7f729dc9a7 Check namespace + class to see if it exists
main issue : https://github.com/barryvdh/laravel-ide-helper/issues/1273

Adds support for psaml and php-stan specific params and other possible problems.
2021-10-27 00:08:57 +03:30
Barry vd. Heuvel 144140cd39 Merge pull request #5 from GrahamCampbell/patch-2
Drop HHVM and support PHP 7
2020-01-08 14:36:02 +01:00
Graham Campbell be72a2d318 Update .gitignore 2020-01-08 10:29:51 +00:00
Graham Campbell 6d03fa81d9 Delete composer.lock 2020-01-08 10:28:55 +00:00
Graham Campbell 3e7bb6e171 Drop HHVM and support PHP 7 2020-01-08 10:28:32 +00:00
Barry vd. Heuvel 0f32bd0e61 Merge pull request #4 from liquid207/fix-annotation-error-about-typed-array
Fix annotation error about typed array like array<mixed> or array<int…
2020-01-08 10:55:58 +01:00
Shuai Yang b0b90f44f0 Fix annotation error about typed array like array<mixed> or array<int> ... 2020-01-08 15:09:57 +08:00
Barry vd. Heuvel 6b69015d83 Merge pull request #2 from JeppeKnockaert/add-brackets-for-parsing-return-types
feature - Improve method tag parsing
2018-12-13 11:34:14 +01:00
Jeppe Knockaert 053005ed4e feature - Improve method tag parsing
This is an update based on the original repository, I just cherry-picked
some code.

https://github.com/phpDocumentor/ReflectionDocBlock/blob/master/src/DocBlock/Tags/Method.php

This includes:
- https://github.com/phpDocumentor/ReflectionDocBlock/commit/e9454d844db9d8fd2f276a2069647c3c4fb15085
- https://github.com/phpDocumentor/ReflectionDocBlock/commit/e9454d844db9d8fd2f276a2069647c3c4fb15085
2018-12-13 10:13:22 +01:00
Barry vd. Heuvel 64165bd4ba Merge pull request #1 from JeppeKnockaert/allow-deleting-tags-in-docblocks
Allow deleting tags in DocBlocks
2018-10-25 21:09:52 +02:00
Jeppe Knockaert 9b08619fbd Allow deleting tags in DocBlocks 2018-10-23 15:38:27 +02:00
Barry vd. Heuvel 3dcbd98b5d Update namespace 2016-06-13 21:28:20 +02:00
Barry vd. Heuvel d411a2bc7e Merge branch 'release/2.x' of https://github.com/phpDocumentor/ReflectionDocBlock 2016-06-13 21:28:05 +02:00
Mike van Riel e6a969a640 Merge pull request #67 from mbed67/fix-bug-in-collection
fix for bug #1672 in phpDocumentor2
2016-01-25 09:17:30 +01:00
Marieke Bednarczyk 708c2c9253 fix for bug #1672 in phpDocumentor2
When dealing with inline @see or @link tags and having a relative method or property type
like LinkDescriptor::setLink() and a namespace alias like phpDocumentor\Descriptor\Tag\LinkDescriptor
Collection::expand() was checking if LinkDescriptor::setLink() could be found in the namespace aliases.
This would never be true.
In this fix, the method or type (for instance ::setLink()) part is removed for comparison
and later re-added when generating the full name
2015-12-13 15:52:57 +01:00
Barry vd. Heuvel fd9e6bd26d Move around 2013-06-08 23:04:47 +02:00
Barry vd. Heuvel d5e4b2ec73 Also check if it is not already absolute 2013-06-08 23:02:34 +02:00
Barry vd. Heuvel bae8be0dcd Test for false relative paths
Closure -> \Closure etc
2013-06-08 22:53:54 +02:00
Barry vd. Heuvel 3a5d30e027 Use parsed types for content 2013-06-08 22:37:52 +02:00
Barry vd. Heuvel d2414cd3dc Add setType and addType 2013-06-08 22:37:36 +02:00
Barry vd. Heuvel 070b13745a Correct namespace 2013-06-08 12:58:42 +02:00
Barry vd. Heuvel df7807cd73 Add markdown to suggest instead of require 2013-06-08 12:52:45 +02:00
Barry vd. Heuvel b07e3c36b7 Change namespace 2013-06-08 12:45:35 +02:00
Barry vd. Heuvel 163dd7877e Add __toString() methods for Description and Tag
And let the Serializer make use of the (string) $tag
2013-06-08 12:40:01 +02:00
52 changed files with 803 additions and 1088 deletions
+10
View File
@@ -0,0 +1,10 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Ignore all test and documentation with "export-ignore".
/.gitignore export-ignore
/.gitattributes export-ignore
/.travis.yml export-ignore
/composer.lock export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
+43
View File
@@ -0,0 +1,43 @@
name: Unit Tests
on:
push:
branches:
- master
pull_request:
branches:
- "*"
schedule:
- cron: '0 0 * * *'
jobs:
php-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
COMPOSER_NO_INTERACTION: 1
strategy:
matrix:
php: [8.1, 8.0, 7.4, 7.3, 7.2]
dependency-version: [prefer-lowest, prefer-stable]
name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2
- name: Install dependencies
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress
- name: Execute Unit Tests
run: vendor/bin/phpunit
+1
View File
@@ -1,2 +1,3 @@
.idea .idea
composer.lock
vendor vendor
-32
View File
@@ -1,32 +0,0 @@
language: php
php:
- 5.3.3
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
- hhvm-nightly
matrix:
allow_failures:
- php: hhvm
- php: hhvm-nightly
script:
- vendor/bin/phpunit
before_script:
- sudo apt-get -qq update > /dev/null
- phpenv rehash > /dev/null
- composer selfupdate --quiet
- composer install --no-interaction --prefer-source --dev
- vendor/bin/phpunit
- composer update --no-interaction --prefer-source --dev
notifications:
irc: "irc.freenode.org#phpdocumentor"
email:
- [email protected]
- [email protected]
- [email protected]
+3 -3
View File
@@ -1,5 +1,5 @@
{ {
"name": "phpdocumentor/reflection-docblock", "name": "barryvdh/reflection-docblock",
"type": "library", "type": "library",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
@@ -9,10 +9,10 @@
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"autoload": { "autoload": {
"psr-0": {"phpDocumentor": ["src/"]} "psr-0": {"Barryvdh": ["src/"]}
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0" "phpunit/phpunit": "^8.5.14|^9"
}, },
"suggest": { "suggest": {
"dflydev/markdown": "~1.0", "dflydev/markdown": "~1.0",
Generated
-827
View File
@@ -1,827 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "ea1734d11b8c878445c2c6e58de8b85f",
"packages": [],
"packages-dev": [
{
"name": "ocramius/instantiator",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/Instantiator.git",
"reference": "a7abbb5fc9df6e7126af741dd6c140d1a7369435"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/a7abbb5fc9df6e7126af741dd6c140d1a7369435",
"reference": "a7abbb5fc9df6e7126af741dd6c140d1a7369435",
"shasum": ""
},
"require": {
"ocramius/lazy-map": "1.0.*",
"php": "~5.3"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "2.0.*@ALPHA"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Instantiator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "[email protected]",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/Ocramius/Instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2014-08-14 15:10:55"
},
{
"name": "ocramius/lazy-map",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/LazyMap.git",
"reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/LazyMap/zipball/7fe3d347f5e618bcea7d39345ff83f3651d8b752",
"reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"athletic/athletic": "~0.1.6",
"phpmd/phpmd": "1.5.*",
"phpunit/phpunit": ">=3.7",
"satooshi/php-coveralls": "~0.6",
"squizlabs/php_codesniffer": "1.4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"LazyMap\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "[email protected]",
"homepage": "http://ocramius.github.com/",
"role": "Developer"
}
],
"description": "A library that provides lazy instantiation logic for a map of objects",
"homepage": "https://github.com/Ocramius/LazyMap",
"keywords": [
"lazy",
"lazy instantiation",
"lazy loading",
"map",
"service location"
],
"time": "2013-11-09 22:30:54"
},
{
"name": "phpunit/php-code-coverage",
"version": "2.0.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "6d196af48e8c100a3ae881940123e693da5a9217"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6d196af48e8c100a3ae881940123e693da5a9217",
"reference": "6d196af48e8c100a3ae881940123e693da5a9217",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": "~1.3.1",
"phpunit/php-text-template": "~1.2.0",
"phpunit/php-token-stream": "~1.2.2",
"sebastian/environment": "~1.0.0",
"sebastian/version": "~1.0.3"
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4.0.14"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.2.1",
"ext-xmlwriter": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2014-08-06 06:39:42"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"File/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2013-10-10 15:34:57"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"Text/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2014-01-30 17:20:04"
},
{
"name": "phpunit/php-timer",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2013-08-02 07:42:54"
},
{
"name": "phpunit/php-token-stream",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32",
"reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2014-03-03 05:10:30"
},
{
"name": "phpunit/phpunit",
"version": "4.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a33fa68ece9f8c68589bfc2da8d2794e27b820bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a33fa68ece9f8c68589bfc2da8d2794e27b820bc",
"reference": "a33fa68ece9f8c68589bfc2da8d2794e27b820bc",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": "~2.0",
"phpunit/php-file-iterator": "~1.3.1",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0.2",
"phpunit/phpunit-mock-objects": "~2.2",
"sebastian/comparator": "~1.0",
"sebastian/diff": "~1.1",
"sebastian/environment": "~1.0",
"sebastian/exporter": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2014-08-18 05:12:30"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "42e589e08bc86e3e9bdf20d385e948347788505b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/42e589e08bc86e3e9bdf20d385e948347788505b",
"reference": "42e589e08bc86e3e9bdf20d385e948347788505b",
"shasum": ""
},
"require": {
"ocramius/instantiator": "~1.0",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "4.2.*@dev"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2014-08-02 13:50:58"
},
{
"name": "sebastian/comparator",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2",
"reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.1",
"sebastian/exporter": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
},
{
"name": "Jeff Welch",
"email": "[email protected]"
},
{
"name": "Volker Dusch",
"email": "[email protected]"
},
{
"name": "Bernhard Schussek",
"email": "[email protected]"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2014-05-02 07:05:58"
},
{
"name": "sebastian/diff",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
},
{
"name": "Kore Nordmann",
"email": "[email protected]"
}
],
"description": "Diff implementation",
"homepage": "http://www.github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2013-08-03 16:46:33"
},
{
"name": "sebastian/environment",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a",
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "4.0.*@dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2014-02-18 16:17:19"
},
{
"name": "sebastian/exporter",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "4.0.*@dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
},
{
"name": "Jeff Welch",
"email": "[email protected]"
},
{
"name": "Volker Dusch",
"email": "[email protected]"
},
{
"name": "Adam Harvey",
"email": "[email protected]",
"role": "Lead"
},
{
"name": "Bernhard Schussek",
"email": "[email protected]"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2014-02-16 08:26:31"
},
{
"name": "sebastian/version",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2014-03-07 15:35:33"
},
{
"name": "symfony/yaml",
"version": "v2.5.3",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f",
"reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "[email protected]"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2014-08-05 09:00:40"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"platform": {
"php": ">=5.3.3"
},
"platform-dev": []
}
+6 -7
View File
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit colors="true" strict="true" bootstrap="vendor/autoload.php"> <coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
<testsuites> <testsuites>
<testsuite name="phpDocumentor\Reflection\DocBlock"> <testsuite name="phpDocumentor\Reflection\DocBlock">
<directory>./tests/</directory> <directory>./tests/</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit> </phpunit>
@@ -10,11 +10,11 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection; namespace Barryvdh\Reflection;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Context; use Barryvdh\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Location; use Barryvdh\Reflection\DocBlock\Location;
/** /**
* Parses the DocBlock for any structure. * Parses the DocBlock for any structure.
@@ -439,6 +439,23 @@ class DocBlock implements \Reflector
return $tag; return $tag;
} }
/**
* Deletes a tag from the list of tags.
*
* @param Tag $tag The tag to be deleted.
*
* @return bool True if the tag was deleted.
*/
public function deleteTag(Tag $tag)
{
if (($key = array_search($tag, $this->tags)) !== false) {
unset($this->tags[$key]);
return true;
}
return false;
}
/** /**
* Builds a string representation of this object. * Builds a string representation of this object.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock; namespace Barryvdh\Reflection\DocBlock;
/** /**
* The context in which a DocBlock occurs. * The context in which a DocBlock occurs.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock; namespace Barryvdh\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock; use Barryvdh\Reflection\DocBlock;
/** /**
* Parses a Description of a DocBlock or tag. * Parses a Description of a DocBlock or tag.
@@ -109,7 +109,7 @@ class Description implements \Reflector
) )
\}/Sux', \}/Sux',
$this->contents, $this->contents,
null, -1,
PREG_SPLIT_DELIM_CAPTURE PREG_SPLIT_DELIM_CAPTURE
); );
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock; namespace Barryvdh\Reflection\DocBlock;
/** /**
* The location a DocBlock occurs within a file. * The location a DocBlock occurs within a file.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock; namespace Barryvdh\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock; use Barryvdh\Reflection\DocBlock;
/** /**
* Serializes a DocBlock instance. * Serializes a DocBlock instance.
@@ -36,6 +36,9 @@ class Serializer
/** @var int|null The max length of a line. */ /** @var int|null The max length of a line. */
protected $lineLength = null; protected $lineLength = null;
/** @var bool Separate tag groups. */
protected $separateTags = false;
/** /**
* Create a Serializer instance. * Create a Serializer instance.
* *
@@ -45,17 +48,20 @@ class Serializer
* @param bool $indentFirstLine Whether to indent the first line. * @param bool $indentFirstLine Whether to indent the first line.
* @param int|null $lineLength The max length of a line or NULL to * @param int|null $lineLength The max length of a line or NULL to
* disable line wrapping. * disable line wrapping.
* @param bool $separateTags Separate tag groups.
*/ */
public function __construct( public function __construct(
$indent = 0, $indent = 0,
$indentString = ' ', $indentString = ' ',
$indentFirstLine = true, $indentFirstLine = true,
$lineLength = null $lineLength = null,
$separateTags = false
) { ) {
$this->setIndentationString($indentString); $this->setIndentationString($indentString);
$this->setIndent($indent); $this->setIndent($indent);
$this->setIsFirstLineIndented($indentFirstLine); $this->setIsFirstLineIndented($indentFirstLine);
$this->setLineLength($lineLength); $this->setLineLength($lineLength);
$this->setSeparateTags($separateTags);
} }
/** /**
@@ -158,6 +164,29 @@ class Serializer
return $this->lineLength; return $this->lineLength;
} }
/**
* Sets whether there should be an empty line between tag groups.
*
* @param bool $separateTags The new value for this setting.
*
* @return $this This serializer object.
*/
public function setSeparateTags($separateTags)
{
$this->separateTags = (bool)$separateTags;
return $this;
}
/**
* Gets whether there should be an empty line between tag groups.
*
* @return bool Whether there should be an empty line between tag groups.
*/
public function getSeparateTags()
{
return $this->separateTags;
}
/** /**
* Generate a DocBlock comment. * Generate a DocBlock comment.
* *
@@ -180,8 +209,12 @@ class Serializer
$comment = "{$firstIndent}/**\n{$indent} * {$text}\n{$indent} *\n"; $comment = "{$firstIndent}/**\n{$indent} * {$text}\n{$indent} *\n";
$tags = array_values($docblock->getTags());
/** @var Tag $tag */ /** @var Tag $tag */
foreach ($docblock->getTags() as $tag) { foreach ($tags as $key => $tag) {
$nextTag = isset($tags[$key + 1]) ? $tags[$key + 1] : null;
$tagText = (string) $tag; $tagText = (string) $tag;
if ($this->lineLength) { if ($this->lineLength) {
$tagText = wordwrap($tagText, $wrapLength); $tagText = wordwrap($tagText, $wrapLength);
@@ -189,6 +222,10 @@ class Serializer
$tagText = str_replace("\n", "\n{$indent} * ", $tagText); $tagText = str_replace("\n", "\n{$indent} * ", $tagText);
$comment .= "{$indent} * {$tagText}\n"; $comment .= "{$indent} * {$tagText}\n";
if ($this->separateTags && $nextTag !== null && ! $tag->inSameGroup($nextTag)) {
$comment .= "{$indent} *\n";
}
} }
$comment .= $indent . ' */'; $comment .= $indent . ' */';
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock; namespace Barryvdh\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock; use Barryvdh\Reflection\DocBlock;
/** /**
* Parses a tag definition for a DocBlock. * Parses a tag definition for a DocBlock.
@@ -59,43 +59,45 @@ class Tag implements \Reflector
*/ */
private static $tagHandlerMappings = array( private static $tagHandlerMappings = array(
'author' 'author'
=> '\phpDocumentor\Reflection\DocBlock\Tag\AuthorTag', => '\Barryvdh\Reflection\DocBlock\Tag\AuthorTag',
'covers' 'covers'
=> '\phpDocumentor\Reflection\DocBlock\Tag\CoversTag', => '\Barryvdh\Reflection\DocBlock\Tag\CoversTag',
'deprecated' 'deprecated'
=> '\phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag', => '\Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag',
'example' 'example'
=> '\phpDocumentor\Reflection\DocBlock\Tag\ExampleTag', => '\Barryvdh\Reflection\DocBlock\Tag\ExampleTag',
'link' 'link'
=> '\phpDocumentor\Reflection\DocBlock\Tag\LinkTag', => '\Barryvdh\Reflection\DocBlock\Tag\LinkTag',
'method' 'method'
=> '\phpDocumentor\Reflection\DocBlock\Tag\MethodTag', => '\Barryvdh\Reflection\DocBlock\Tag\MethodTag',
'param' 'param'
=> '\phpDocumentor\Reflection\DocBlock\Tag\ParamTag', => '\Barryvdh\Reflection\DocBlock\Tag\ParamTag',
'property-read' 'property-read'
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyReadTag', => '\Barryvdh\Reflection\DocBlock\Tag\PropertyReadTag',
'property' 'property'
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyTag', => '\Barryvdh\Reflection\DocBlock\Tag\PropertyTag',
'property-write' 'property-write'
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyWriteTag', => '\Barryvdh\Reflection\DocBlock\Tag\PropertyWriteTag',
'return' 'return'
=> '\phpDocumentor\Reflection\DocBlock\Tag\ReturnTag', => '\Barryvdh\Reflection\DocBlock\Tag\ReturnTag',
'see' 'see'
=> '\phpDocumentor\Reflection\DocBlock\Tag\SeeTag', => '\Barryvdh\Reflection\DocBlock\Tag\SeeTag',
'since' 'since'
=> '\phpDocumentor\Reflection\DocBlock\Tag\SinceTag', => '\Barryvdh\Reflection\DocBlock\Tag\SinceTag',
'source' 'source'
=> '\phpDocumentor\Reflection\DocBlock\Tag\SourceTag', => '\Barryvdh\Reflection\DocBlock\Tag\SourceTag',
'throw' 'throw'
=> '\phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag', => '\Barryvdh\Reflection\DocBlock\Tag\ThrowsTag',
'throws' 'throws'
=> '\phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag', => '\Barryvdh\Reflection\DocBlock\Tag\ThrowsTag',
'uses' 'uses'
=> '\phpDocumentor\Reflection\DocBlock\Tag\UsesTag', => '\Barryvdh\Reflection\DocBlock\Tag\UsesTag',
'var' 'var'
=> '\phpDocumentor\Reflection\DocBlock\Tag\VarTag', => '\Barryvdh\Reflection\DocBlock\Tag\VarTag',
'version' 'version'
=> '\phpDocumentor\Reflection\DocBlock\Tag\VersionTag' => '\Barryvdh\Reflection\DocBlock\Tag\VersionTag',
'SuppressWarnings'
=> '\Barryvdh\Reflection\DocBlock\Tag\SuppressWarningsTag'
); );
/** /**
@@ -352,6 +354,39 @@ class Tag implements \Reflector
return $this; return $this;
} }
/**
* If the given tags should be together or apart.
*
* @param Tag $tag
*
* @return bool
*/
public function inSameGroup(Tag $tag)
{
$firstName = $this->getName();
$secondName = $tag->getName();
if ($firstName === $secondName) {
return true;
}
$groups = array(
array('deprecated', 'link', 'see', 'since'),
array('author', 'copyright', 'license'),
array('category', 'package', 'subpackage'),
array('property', 'property-read', 'property-write'),
array('param', 'return'),
);
foreach ($groups as $group) {
if (in_array($firstName, $group, true) && in_array($secondName, $group, true)) {
return true;
}
}
return false;
}
/** /**
* Builds a string representation of this object. * Builds a string representation of this object.
* *
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for an @author tag in a Docblock. * Reflection class for an @author tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @covers tag in a Docblock. * Reflection class for a @covers tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag\VersionTag; use Barryvdh\Reflection\DocBlock\Tag\VersionTag;
/** /**
* Reflection class for a @deprecated tag in a Docblock. * Reflection class for a @deprecated tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @example tag in a Docblock. * Reflection class for a @example tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @link tag in a Docblock. * Reflection class for a @link tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @method in a Docblock. * Reflection class for a @method in a Docblock.
@@ -76,7 +76,15 @@ class MethodTag extends ReturnTag
)? )?
# Return type # Return type
(?: (?:
([\w\|_\\\\]+) (
(?:[\w\|_\\\\]*\$this[\w\|_\\\\]*)
|
(?:
(?:[\w\|_\\\\]+)
# array notation
(?:\[\])*
)*
)
\s+ \s+
)? )?
# Legacy method name (not captured) # Legacy method name (not captured)
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @param tag in a Docblock. * Reflection class for a @param tag in a Docblock.
@@ -46,12 +46,37 @@ class ParamTag extends ReturnTag
public function setContent($content) public function setContent($content)
{ {
Tag::setContent($content); Tag::setContent($content);
$parts = preg_split(
'/(\s+)/Su', $parts = [];
$this->description, $rest = $this->description;
3,
PREG_SPLIT_DELIM_CAPTURE // parsing generics and closures to detect types
); for($pos = 0, $stacks = []; $pos < strlen($rest); $pos++) {
$char = $rest[$pos];
if($char === '<') {
array_unshift($stacks, $char);
}
if($char === '(') {
array_unshift($stacks, $char);
}
if($char === '>' && isset($stacks[0]) && $stacks[0] === '<') {
array_shift($stacks);
}
if($char === ')' && isset($stacks[0]) && $stacks[0] === '(') {
array_shift($stacks);
}
if(!$stacks && preg_match('/\A(\s+)(.*)/su', substr($rest, $pos), $matches)) {
$parts[0] = substr($rest, 0, $pos);
$parts[1] = $matches[1];
$rest = $matches[2];
break;
}
}
array_push($parts, ...preg_split('/(\s+)/u', $rest, 2, PREG_SPLIT_DELIM_CAPTURE));
// if the first item that is encountered is not a variable; it is a type // if the first item that is encountered is not a variable; it is a type
if (isset($parts[0]) if (isset($parts[0])
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @property-read tag in a Docblock. * Reflection class for a @property-read tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @property tag in a Docblock. * Reflection class for a @property tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @property-write tag in a Docblock. * Reflection class for a @property-write tag in a Docblock.
@@ -10,10 +10,10 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Type\Collection; use Barryvdh\Reflection\DocBlock\Type\Collection;
/** /**
* Reflection class for a @return tag in a Docblock. * Reflection class for a @return tag in a Docblock.
@@ -26,7 +26,7 @@ class ReturnTag extends Tag
{ {
/** @var string The raw type component. */ /** @var string The raw type component. */
protected $type = ''; protected $type = '';
/** @var Collection The parsed type component. */ /** @var Collection The parsed type component. */
protected $types = null; protected $types = null;
@@ -36,7 +36,7 @@ class ReturnTag extends Tag
public function getContent() public function getContent()
{ {
if (null === $this->content) { if (null === $this->content) {
$this->content = "{$this->type} {$this->description}"; $this->content = "{$this->getType()} {$this->description}";
} }
return $this->content; return $this->content;
@@ -49,7 +49,7 @@ class ReturnTag extends Tag
{ {
parent::setContent($content); parent::setContent($content);
$parts = preg_split('/\s+/Su', $this->description, 2); $parts = preg_split('/(?<!,)\s+/Su', $this->description, 2);
// any output is considered a type // any output is considered a type
$this->type = $parts[0]; $this->type = $parts[0];
@@ -81,9 +81,38 @@ class ReturnTag extends Tag
return (string) $this->getTypesCollection(); return (string) $this->getTypesCollection();
} }
/**
* Set the type section of the variable
*
* @param string $type
* @return $this
*/
public function setType($type)
{
$this->type = $type;
$this->types = null;
$this->content = null;
return $this;
}
/**
* Add a type to the type section of the variable
*
* @param string $type
* @return $this
*/
public function addType($type)
{
$this->type = $this->type . Collection::OPERATOR_OR . $type;
$this->types = null;
$this->content = null;
return $this;
}
/** /**
* Returns the type collection. * Returns the type collection.
* *
* @return void * @return void
*/ */
protected function getTypesCollection() protected function getTypesCollection()
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @see tag in a Docblock. * Reflection class for a @see tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag\VersionTag; use Barryvdh\Reflection\DocBlock\Tag\VersionTag;
/** /**
* Reflection class for a @since tag in a Docblock. * Reflection class for a @since tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @source tag in a Docblock. * Reflection class for a @source tag in a Docblock.
@@ -0,0 +1,30 @@
<?php
/**
* phpDocumentor
*
* PHP Version 5.3
*
* @author Andrew Smith <[email protected]>
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
/**
* Reflection class for a @SuppressWarnings tag in a Docblock.
*
* @author Andrew Smith <[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class SuppressWarningsTag extends Tag
{
public function __toString()
{
return "@{$this->getName()}{$this->getContent()}";
}
}
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @throws tag in a Docblock. * Reflection class for a @throws tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @uses tag in a Docblock. * Reflection class for a @uses tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @var tag in a Docblock. * Reflection class for a @var tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
/** /**
* Reflection class for a @version tag in a Docblock. * Reflection class for a @version tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Type; namespace Barryvdh\Reflection\DocBlock\Type;
use phpDocumentor\Reflection\DocBlock\Context; use Barryvdh\Reflection\DocBlock\Context;
/** /**
* Collection * Collection
@@ -106,7 +106,7 @@ class Collection extends \ArrayObject
} }
// separate the type by the OR operator // separate the type by the OR operator
$type_parts = explode(self::OPERATOR_OR, $type); $type_parts = $this->explode($type);
foreach ($type_parts as $part) { foreach ($type_parts as $part) {
$expanded_type = $this->expand($part); $expanded_type = $this->expand($part);
if ($expanded_type) { if ($expanded_type) {
@@ -114,10 +114,10 @@ class Collection extends \ArrayObject
} }
} }
} }
/** /**
* Returns a string representation of the collection. * Returns a string representation of the collection.
* *
* @return string The resolved types across the collection, separated with * @return string The resolved types across the collection, separated with
* {@link self::OPERATOR_OR}. * {@link self::OPERATOR_OR}.
*/ */
@@ -126,6 +126,40 @@ class Collection extends \ArrayObject
return implode(self::OPERATOR_OR, $this->getArrayCopy()); return implode(self::OPERATOR_OR, $this->getArrayCopy());
} }
/**
* Analyzes the given union of types and returns separated by OR operator
* single types.
*
* @param string $type The type or union of types
*
* @return array
*/
protected function explode($type)
{
$type_parts = [];
$curr_type = '';
$nest_level = 0;
foreach (str_split($type) as $char) {
if ($char === self::OPERATOR_OR && $nest_level === 0) {
$type_parts[] = $curr_type;
$curr_type = '';
} else {
if ($char === '<' || $char === '(') {
$nest_level++;
} else if ($char === '>' || $char === ')') {
$nest_level--;
}
$curr_type .= $char;
}
}
$type_parts[] = $curr_type;
return $type_parts;
}
/** /**
* Analyzes the given type and returns the FQCN variant. * Analyzes the given type and returns the FQCN variant.
* *
@@ -151,17 +185,31 @@ class Collection extends \ArrayObject
return ''; return '';
} }
if (substr($type, 0, 6) === 'array<' && substr($type, -1) === '>') {
return $type;
}
if($type[0] === '(') {
return $type;
}
if ($this->isTypeAnArray($type)) { if ($this->isTypeAnArray($type)) {
return $this->expand(substr($type, 0, -2)) . self::OPERATOR_ARRAY; return $this->expand(substr($type, 0, -2)) . self::OPERATOR_ARRAY;
} }
if ($this->isRelativeType($type) && !$this->isTypeAKeyword($type)) { if ($this->isRelativeType($type) && !$this->isTypeAKeyword($type)) {
if($this->shouldBeAbsolute($type)){
return self::OPERATOR_NAMESPACE . $type;
}
$type_parts = explode(self::OPERATOR_NAMESPACE, $type, 2); $type_parts = explode(self::OPERATOR_NAMESPACE, $type, 2);
$namespace_aliases = $this->context->getNamespaceAliases(); $namespace_aliases = $this->context->getNamespaceAliases();
// if the first segment is not an alias; prepend namespace name and // if the first segment is not an alias; prepend namespace name and
// return // return
if (!isset($namespace_aliases[$type_parts[0]])) { if (!isset($namespace_aliases[$type_parts[0]]) &&
!isset($namespace_aliases[strstr($type_parts[0], '::', true)])) {
$namespace = $this->context->getNamespace(); $namespace = $this->context->getNamespace();
if ('' !== $namespace) { if ('' !== $namespace) {
$namespace .= self::OPERATOR_NAMESPACE; $namespace .= self::OPERATOR_NAMESPACE;
@@ -169,6 +217,12 @@ class Collection extends \ArrayObject
return self::OPERATOR_NAMESPACE . $namespace . $type; return self::OPERATOR_NAMESPACE . $namespace . $type;
} }
if (strpos($type_parts[0], '::')) {
$type_parts[] = strstr($type_parts[0], '::');
$type_parts[0] = $namespace_aliases[strstr($type_parts[0], '::', true)];
return implode('', $type_parts);
}
$type_parts[0] = $namespace_aliases[$type_parts[0]]; $type_parts[0] = $namespace_aliases[$type_parts[0]];
$type = implode(self::OPERATOR_NAMESPACE, $type_parts); $type = implode(self::OPERATOR_NAMESPACE, $type_parts);
} }
@@ -218,4 +272,16 @@ class Collection extends \ArrayObject
return ($type[0] !== self::OPERATOR_NAMESPACE) return ($type[0] !== self::OPERATOR_NAMESPACE)
|| $this->isTypeAKeyword($type); || $this->isTypeAKeyword($type);
} }
/**
* Detects if the type should actually be absolute, by checking if it exists.
*
* @param string $type A relative or absolute type as defined in the
* phpDocumentor documentation.
*
* @return bool
*/
protected function shouldBeAbsolute($type){
return class_exists($type);
}
} }
@@ -10,17 +10,19 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock; namespace Barryvdh\Reflection\DocBlock;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Description * Test class for \Barryvdh\Reflection\DocBlock\Description
* *
* @author Vasil Rangelov <boen.robot@gmail.com> * @author Vasil Rangelov <boen.robot@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class DescriptionTest extends \PHPUnit_Framework_TestCase class DescriptionTest extends TestCase
{ {
public function testConstruct() public function testConstruct()
{ {
@@ -106,7 +108,7 @@ LONGDESC;
$parsedDescription = $parsedContents[1]->getParsedDescription(); $parsedDescription = $parsedContents[1]->getParsedDescription();
$this->assertCount(3, $parsedDescription); $this->assertCount(3, $parsedDescription);
$this->assertSame("inline tag with\n", $parsedDescription[0]); $this->assertSame("inline tag with", trim($parsedDescription[0]));
$this->assertInstanceOf( $this->assertInstanceOf(
__NAMESPACE__ . '\Tag\LinkTag', __NAMESPACE__ . '\Tag\LinkTag',
$parsedDescription[1] $parsedDescription[1]
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\CoversTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\CoversTag
* *
* @author Daniel O'Connor <daniel.oconnor@gmail.com> * @author Daniel O'Connor <daniel.oconnor@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class CoversTagTest extends \PHPUnit_Framework_TestCase class CoversTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\CoversTag can create * Test that the \Barryvdh\Reflection\DocBlock\Tag\CoversTag can create
* a link for the covers doc block. * a link for the covers doc block.
* *
* @param string $type * @param string $type
@@ -31,7 +33,7 @@ class CoversTagTest extends \PHPUnit_Framework_TestCase
* @param string $exContent * @param string $exContent
* @param string $exReference * @param string $exReference
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\CoversTag * @covers \Barryvdh\Reflection\DocBlock\Tag\CoversTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag
* *
* @author Vasil Rangelov <boen.robot@gmail.com> * @author Vasil Rangelov <boen.robot@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class DeprecatedTagTest extends \PHPUnit_Framework_TestCase class DeprecatedTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create * Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
* a link for the @deprecated doc block. * a link for the @deprecated doc block.
* *
* @param string $type * @param string $type
@@ -32,7 +34,7 @@ class DeprecatedTagTest extends \PHPUnit_Framework_TestCase
* @param string $exDescription * @param string $exDescription
* @param string $exVersion * @param string $exVersion
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag * @covers \Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\ExampleTag
* *
* @author Vasil Rangelov <boen.robot@gmail.com> * @author Vasil Rangelov <boen.robot@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class ExampleTagTest extends \PHPUnit_Framework_TestCase class ExampleTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\SourceTag can * Test that the \Barryvdh\Reflection\DocBlock\Tag\SourceTag can
* understand the @source DocBlock. * understand the @source DocBlock.
* *
* @param string $type * @param string $type
@@ -33,7 +35,7 @@ class ExampleTagTest extends \PHPUnit_Framework_TestCase
* @param string $exLineCount * @param string $exLineCount
* @param string $exFilepath * @param string $exFilepath
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag * @covers \Barryvdh\Reflection\DocBlock\Tag\ExampleTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\LinkTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\LinkTag
* *
* @author Ben Selby <benmatselby@gmail.com> * @author Ben Selby <benmatselby@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class LinkTagTest extends \PHPUnit_Framework_TestCase class LinkTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create * Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
* a link for the @link doc block. * a link for the @link doc block.
* *
* @param string $type * @param string $type
@@ -32,7 +34,7 @@ class LinkTagTest extends \PHPUnit_Framework_TestCase
* @param string $exDescription * @param string $exDescription
* @param string $exLink * @param string $exLink
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\LinkTag * @covers \Barryvdh\Reflection\DocBlock\Tag\LinkTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,17 +10,19 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\MethodTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\MethodTag
* *
* @author Mike van Riel <mike.vanriel@naenius.com> * @author Mike van Riel <mike.vanriel@naenius.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class MethodTagTest extends \PHPUnit_Framework_TestCase class MethodTagTest extends TestCase
{ {
/** /**
* @param string $signature The signature to test. * @param string $signature The signature to test.
@@ -34,7 +36,7 @@ class MethodTagTest extends \PHPUnit_Framework_TestCase
* @param string $description The short description mentioned in the * @param string $description The short description mentioned in the
* signature. * signature.
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\MethodTag * @covers \Barryvdh\Reflection\DocBlock\Tag\MethodTag
* @dataProvider getTestSignatures * @dataProvider getTestSignatures
* *
* @return void * @return void
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\ParamTag * Test class for \Barryvdh\Reflection\DocBlock\ParamTag
* *
* @author Mike van Riel <mike.vanriel@naenius.com> * @author Mike van Riel <mike.vanriel@naenius.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class ParamTagTest extends \PHPUnit_Framework_TestCase class ParamTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ParamTag can * Test that the \Barryvdh\Reflection\DocBlock\Tag\ParamTag can
* understand the @param DocBlock. * understand the @param DocBlock.
* *
* @param string $type * @param string $type
@@ -33,7 +35,7 @@ class ParamTagTest extends \PHPUnit_Framework_TestCase
* @param string $extractedVarName * @param string $extractedVarName
* @param string $extractedDescription * @param string $extractedDescription
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag * @covers \Barryvdh\Reflection\DocBlock\Tag\ParamTag
* @dataProvider provideDataForConstructor * @dataProvider provideDataForConstructor
* *
* @return void * @return void
@@ -112,7 +114,75 @@ class ParamTagTest extends \PHPUnit_Framework_TestCase
array('int'), array('int'),
'$bob', '$bob',
"Type on a new line" "Type on a new line"
) ),
// generic array
array(
'param',
'array<int, string> $names',
'array<int, string>',
array('array<int, string>'),
'$names',
''
),
// nested generics
array(
'param',
'array<int, array<string, mixed>> $arrays',
'array<int, array<string, mixed>>',
array('array<int, array<string, mixed>>'),
'$arrays',
''
),
// closure
array(
'param',
'(\Closure(int, string): bool) $callback',
'(\Closure(int, string): bool)',
array('(\Closure(int, string): bool)'),
'$callback',
''
),
// generic array in closure
array(
'param',
'(\Closure(array<int, string>): bool) $callback',
'(\Closure(array<int, string>): bool)',
array('(\Closure(array<int, string>): bool)'),
'$callback',
''
),
// union types in closure
array(
'param',
'(\Closure(int|string): bool)|bool $callback',
'(\Closure(int|string): bool)|bool',
array('(\Closure(int|string): bool)', 'bool'),
'$callback',
''
),
// example from Laravel Framework - Eloquent Builder)
array(
'param',
'array<array-key, array|(\Closure(\Illuminate\Database\Eloquent\Relations\Relation<*,*,*>): mixed)|string>|string $relations',
'array<array-key, array|(\Closure(\Illuminate\Database\Eloquent\Relations\Relation<*,*,*>): mixed)|string>|string',
array('array<array-key, array|(\Closure(\Illuminate\Database\Eloquent\Relations\Relation<*,*,*>): mixed)|string>', 'string'),
'$relations',
''
),
array(
'param',
'(\Closure(\Illuminate\Database\Eloquent\Relations\Relation<*,*,*>): mixed)|string|null $callback',
'(\Closure(\Illuminate\Database\Eloquent\Relations\Relation<*,*,*>): mixed)|string|null',
array('(\Closure(\Illuminate\Database\Eloquent\Relations\Relation<*,*,*>): mixed)', 'string', 'null'),
'$callback',
''
),
); );
} }
} }
@@ -1,7 +1,7 @@
<?php <?php
/** /**
* phpDocumentor Return tag test. * phpDocumentor Return tag test.
* *
* PHP version 5.3 * PHP version 5.3
* *
* @author Mike van Riel <mike.vanriel@naenius.com> * @author Mike van Riel <mike.vanriel@naenius.com>
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\ReturnTag * Test class for \Barryvdh\Reflection\DocBlock\ReturnTag
* *
* @author Mike van Riel <mike.vanriel@naenius.com> * @author Mike van Riel <mike.vanriel@naenius.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class ReturnTagTest extends \PHPUnit_Framework_TestCase class ReturnTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag can * Test that the \Barryvdh\Reflection\DocBlock\Tag\ReturnTag can
* understand the @return DocBlock. * understand the @return DocBlock.
* *
* @param string $type * @param string $type
@@ -32,7 +34,7 @@ class ReturnTagTest extends \PHPUnit_Framework_TestCase
* @param string $extractedTypes * @param string $extractedTypes
* @param string $extractedDescription * @param string $extractedDescription
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag * @covers \Barryvdh\Reflection\DocBlock\Tag\ReturnTag
* @dataProvider provideDataForConstructor * @dataProvider provideDataForConstructor
* *
* @return void * @return void
@@ -96,6 +98,27 @@ class ReturnTagTest extends \PHPUnit_Framework_TestCase
'int', 'int',
array('int'), array('int'),
"Number of Bobs" "Number of Bobs"
),
array(
'return',
'array<int, string> Types of Bobs',
'array<int, string>',
array('array<int, string>'),
'Types of Bobs'
),
array(
'return',
'array<int, string>|string Types of Bobs',
'array<int, string>|string',
array('array<int, string>', 'string'),
'Types of Bobs'
),
array(
'return',
'array<int, string|bool>|string Types of Bobs',
'array<int, string|bool>|string',
array('array<int, string|bool>', 'string'),
'Types of Bobs'
) )
); );
} }
@@ -10,17 +10,19 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SeeTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\SeeTag
* *
* @author Daniel O'Connor <daniel.oconnor@gmail.com> * @author Daniel O'Connor <daniel.oconnor@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class SeeTagTest extends \PHPUnit_Framework_TestCase class SeeTagTest extends TestCase
{ {
/** /**
* Test that the phpDocumentor_Reflection_DocBlock_Tag_See can create a link * Test that the phpDocumentor_Reflection_DocBlock_Tag_See can create a link
@@ -31,7 +33,7 @@ class SeeTagTest extends \PHPUnit_Framework_TestCase
* @param string $exContent * @param string $exContent
* @param string $exReference * @param string $exReference
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SeeTag * @covers \Barryvdh\Reflection\DocBlock\Tag\SeeTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SinceTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\SinceTag
* *
* @author Vasil Rangelov <boen.robot@gmail.com> * @author Vasil Rangelov <boen.robot@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class SinceTagTest extends \PHPUnit_Framework_TestCase class SinceTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create * Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
* a link for the @since doc block. * a link for the @since doc block.
* *
* @param string $type * @param string $type
@@ -32,7 +34,7 @@ class SinceTagTest extends \PHPUnit_Framework_TestCase
* @param string $exDescription * @param string $exDescription
* @param string $exVersion * @param string $exVersion
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SinceTag * @covers \Barryvdh\Reflection\DocBlock\Tag\SinceTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SourceTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\SourceTag
* *
* @author Vasil Rangelov <boen.robot@gmail.com> * @author Vasil Rangelov <boen.robot@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class SourceTagTest extends \PHPUnit_Framework_TestCase class SourceTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\SourceTag can * Test that the \Barryvdh\Reflection\DocBlock\Tag\SourceTag can
* understand the @source DocBlock. * understand the @source DocBlock.
* *
* @param string $type * @param string $type
@@ -32,7 +34,7 @@ class SourceTagTest extends \PHPUnit_Framework_TestCase
* @param string $exStartingLine * @param string $exStartingLine
* @param string $exLineCount * @param string $exLineCount
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SourceTag * @covers \Barryvdh\Reflection\DocBlock\Tag\SourceTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -0,0 +1,75 @@
<?php
/**
* phpDocumentor SuppressWarnings Tag Test
*
* PHP version 5.3
*
* @author Andrew Smith <[email protected]>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\SuppressWarningsTag
*
* @author Andrew Smith <[email protected]>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class SuppressWarningsTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\SuppressWarningsTag can
* understand the @SuppressWarnings doc block.
*
* @param string $type
* @param string $content
* @param string $exType
* @param string $exVariable
* @param string $exDescription
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\SuppressWarningsTag
* @dataProvider provideDataForConstuctor
*
* @return void
*/
public function testConstructorParesInputsIntoCorrectFields(
$type,
$content,
$description
) {
$tag = new SuppressWarningsTag($type, $content);
$this->assertEquals($type, $tag->getName());
$this->assertEquals($description, $tag->getDescription());
}
/**
* Data provider for testConstructorParesInputsIntoCorrectFields
*
* @return array
*/
public function provideDataForConstuctor()
{
// $type, $content, $description
return array(
array(
'SuppressWarnings',
'SuppressWarnings(PHPMD)',
'SuppressWarnings(PHPMD)',
),
array(
'SuppressWarnings',
'SuppressWarnings(PHPMD.TooManyMethods)',
'SuppressWarnings(PHPMD.TooManyMethods)',
),
);
}
}
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\ThrowsTag * Test class for \Barryvdh\Reflection\DocBlock\ThrowsTag
* *
* @author Mike van Riel <mike.vanriel@naenius.com> * @author Mike van Riel <mike.vanriel@naenius.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class ThrowsTagTest extends \PHPUnit_Framework_TestCase class ThrowsTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag can * Test that the \Barryvdh\Reflection\DocBlock\Tag\ThrowsTag can
* understand the @throws DocBlock. * understand the @throws DocBlock.
* *
* @param string $type * @param string $type
@@ -32,7 +34,7 @@ class ThrowsTagTest extends \PHPUnit_Framework_TestCase
* @param string $extractedTypes * @param string $extractedTypes
* @param string $extractedDescription * @param string $extractedDescription
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag * @covers \Barryvdh\Reflection\DocBlock\Tag\ThrowsTag
* @dataProvider provideDataForConstructor * @dataProvider provideDataForConstructor
* *
* @return void * @return void
@@ -10,20 +10,23 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\UsesTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\UsesTag
* *
* @author Daniel O'Connor <daniel.oconnor@gmail.com> * @author Daniel O'Connor <daniel.oconnor@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class UsesTagTest extends \PHPUnit_Framework_TestCase class UsesTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\UsesTag can create * Test that the \Barryvdh\Reflection\DocBlock\Tag\UsesTag can create
* a link for the @uses doc block. * a link for the @uses doc block.
* *
* @param string $type * @param string $type
@@ -31,7 +34,7 @@ class UsesTagTest extends \PHPUnit_Framework_TestCase
* @param string $exContent * @param string $exContent
* @param string $exReference * @param string $exReference
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\UsesTag * @covers \Barryvdh\Reflection\DocBlock\Tag\UsesTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,20 +10,23 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VarTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\VarTag
* *
* @author Daniel O'Connor <daniel.oconnor@gmail.com> * @author Daniel O'Connor <daniel.oconnor@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class VarTagTest extends \PHPUnit_Framework_TestCase class VarTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\VarTag can * Test that the \Barryvdh\Reflection\DocBlock\Tag\VarTag can
* understand the @var doc block. * understand the @var doc block.
* *
* @param string $type * @param string $type
@@ -32,7 +35,7 @@ class VarTagTest extends \PHPUnit_Framework_TestCase
* @param string $exVariable * @param string $exVariable
* @param string $exDescription * @param string $exDescription
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\VarTag * @covers \Barryvdh\Reflection\DocBlock\Tag\VarTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,20 +10,22 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Tag; namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VersionTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\VersionTag
* *
* @author Vasil Rangelov <boen.robot@gmail.com> * @author Vasil Rangelov <boen.robot@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class VersionTagTest extends \PHPUnit_Framework_TestCase class VersionTagTest extends TestCase
{ {
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create * Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
* a link for the @version doc block. * a link for the @version doc block.
* *
* @param string $type * @param string $type
@@ -32,7 +34,7 @@ class VersionTagTest extends \PHPUnit_Framework_TestCase
* @param string $exDescription * @param string $exDescription
* @param string $exVersion * @param string $exVersion
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag\VersionTag * @covers \Barryvdh\Reflection\DocBlock\Tag\VersionTag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -10,34 +10,35 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock; namespace Barryvdh\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock; use Barryvdh\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Context; use Barryvdh\Reflection\DocBlock\Context;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VarTag * Test class for \Barryvdh\Reflection\DocBlock\Tag\VarTag
* *
* @author Daniel O'Connor <daniel.oconnor@gmail.com> * @author Daniel O'Connor <daniel.oconnor@gmail.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class TagTest extends \PHPUnit_Framework_TestCase class TagTest extends TestCase
{ {
/** /**
* @expectedException \InvalidArgumentException *
*
* @return void * @return void
*/ */
public function testInvalidTagLine() public function testInvalidTagLine()
{ {
$this->expectException(\InvalidArgumentException::class);
Tag::createInstance('Invalid tag line'); Tag::createInstance('Invalid tag line');
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler * @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* *
* @return void * @return void
*/ */
@@ -70,13 +71,13 @@ class TagTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler * @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* *
* @return void * @return void
*/ */
public function testTagHandlerCorrectRegistration() public function testTagHandlerCorrectRegistration()
{ {
if (0 == ini_get('allow_url_include')) { if (!ini_get('allow_url_include')) {
$this->markTestSkipped('"data" URIs for includes are required.'); $this->markTestSkipped('"data" URIs for includes are required.');
} }
$currentHandler = __NAMESPACE__ . '\Tag\VarTag'; $currentHandler = __NAMESPACE__ . '\Tag\VarTag';
@@ -93,7 +94,7 @@ class TagTest extends \PHPUnit_Framework_TestCase
include 'data:text/plain;base64,'. base64_encode( include 'data:text/plain;base64,'. base64_encode(
<<<TAG_HANDLER <<<TAG_HANDLER
<?php <?php
class MyTagHandler extends \phpDocumentor\Reflection\DocBlock\Tag {} class MyTagHandler extends \Barryvdh\Reflection\DocBlock\Tag {}
TAG_HANDLER TAG_HANDLER
); );
@@ -118,8 +119,8 @@ TAG_HANDLER
/** /**
* @depends testTagHandlerCorrectRegistration * @depends testTagHandlerCorrectRegistration
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler * @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* @covers \phpDocumentor\Reflection\DocBlock\Tag::createInstance * @covers \Barryvdh\Reflection\DocBlock\Tag::createInstance
* *
* @return void * @return void
*/ */
@@ -162,8 +163,8 @@ TAG_HANDLER
/** /**
* @depends testTagHandlerCorrectRegistration * @depends testTagHandlerCorrectRegistration
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler * @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* @covers \phpDocumentor\Reflection\DocBlock\Tag::createInstance * @covers \Barryvdh\Reflection\DocBlock\Tag::createInstance
* *
* @return void * @return void
*/ */
@@ -201,7 +202,7 @@ TAG_HANDLER
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler * @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* *
* @return void * @return void
*/ */
@@ -232,7 +233,7 @@ TAG_HANDLER
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler * @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* *
* @return void * @return void
*/ */
@@ -265,14 +266,14 @@ TAG_HANDLER
} }
/** /**
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\VarTag can * Test that the \Barryvdh\Reflection\DocBlock\Tag\VarTag can
* understand the @var doc block. * understand the @var doc block.
* *
* @param string $type * @param string $type
* @param string $content * @param string $content
* @param string $exDescription * @param string $exDescription
* *
* @covers \phpDocumentor\Reflection\DocBlock\Tag * @covers \Barryvdh\Reflection\DocBlock\Tag
* @dataProvider provideDataForConstuctor * @dataProvider provideDataForConstuctor
* *
* @return void * @return void
@@ -1,7 +1,7 @@
<?php <?php
/** /**
* phpDocumentor Collection Test * phpDocumentor Collection Test
* *
* PHP version 5.3 * PHP version 5.3
* *
* @author Mike van Riel <mike.vanriel@naenius.com> * @author Mike van Riel <mike.vanriel@naenius.com>
@@ -10,26 +10,27 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock\Type; namespace Barryvdh\Reflection\DocBlock\Type;
use phpDocumentor\Reflection\DocBlock\Context; use Barryvdh\Reflection\DocBlock\Context;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for \phpDocumentor\Reflection\DocBlock\Type\Collection * Test class for \Barryvdh\Reflection\DocBlock\Type\Collection
* *
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection * @covers Barryvdh\Reflection\DocBlock\Type\Collection
* *
* @author Mike van Riel <mike.vanriel@naenius.com> * @author Mike van Riel <mike.vanriel@naenius.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class CollectionTest extends \PHPUnit_Framework_TestCase class CollectionTest extends TestCase
{ {
/** /**
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct * @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::getContext * @covers Barryvdh\Reflection\DocBlock\Type\Collection::getContext
* *
* @return void * @return void
*/ */
public function testConstruct() public function testConstruct()
@@ -41,8 +42,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct * @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
* *
* @return void * @return void
*/ */
public function testConstructWithTypes() public function testConstructWithTypes()
@@ -52,8 +53,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct * @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
* *
* @return void * @return void
*/ */
public function testConstructWithNamespace() public function testConstructWithNamespace()
@@ -69,8 +70,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct * @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
* *
* @return void * @return void
*/ */
public function testConstructWithNamespaceAliases() public function testConstructWithNamespaceAliases()
@@ -88,8 +89,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
* @param array $expected * @param array $expected
* *
* @dataProvider provideTypesToExpand * @dataProvider provideTypesToExpand
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add * @covers Barryvdh\Reflection\DocBlock\Type\Collection::add
* *
* @return void * @return void
*/ */
public function testAdd($fixture, $expected) public function testAdd($fixture, $expected)
@@ -108,8 +109,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
* @param array $expected * @param array $expected
* *
* @dataProvider provideTypesToExpandWithoutNamespace * @dataProvider provideTypesToExpandWithoutNamespace
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add * @covers Barryvdh\Reflection\DocBlock\Type\Collection::add
* *
* @return void * @return void
*/ */
public function testAddWithoutNamespace($fixture, $expected) public function testAddWithoutNamespace($fixture, $expected)
@@ -124,13 +125,33 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add * @param string $fixture
* @expectedException InvalidArgumentException * @param array $expected
* *
* @dataProvider provideTypesToExpandWithPropertyOrMethod
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::add
*
* @return void
*/
public function testAddMethodsAndProperties($fixture, $expected)
{
$collection = new Collection(
array(),
new Context(null, array('LinkDescriptor' => '\phpDocumentor\LinkDescriptor'))
);
$collection->add($fixture);
$this->assertSame($expected, $collection->getArrayCopy());
}
/**
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::add
*
* @return void * @return void
*/ */
public function testAddWithInvalidArgument() public function testAddWithInvalidArgument()
{ {
$this->expectException(\InvalidArgumentException::class);
$collection = new Collection(); $collection = new Collection();
$collection->add(array()); $collection->add(array());
} }
@@ -177,6 +198,30 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
'DocBlock[]|int[]', 'DocBlock[]|int[]',
array($namespace.'DocBlock[]', 'int[]') array($namespace.'DocBlock[]', 'int[]')
), ),
array(
'array<int, string>',
array('array<int, string>')
),
array(
'array<int, string>|string',
array('array<int, string>', 'string')
),
array(
'array<int, float|bool>|string',
array('array<int, float|bool>', 'string')
),
array(
'array<int, string|array<int, bool>>|array<int, float>|string',
array('array<int, string|array<int, bool>>', 'array<int, float>', 'string')
),
array(
'LinkDescriptor::setLink()',
array($namespace.'LinkDescriptor::setLink()')
),
array(
'Alias\LinkDescriptor::setLink()',
array('\My\Space\Aliasing\LinkDescriptor::setLink()')
),
); );
} }
@@ -192,4 +237,34 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
{ {
return $this->provideTypesToExpand($method, '\\'); return $this->provideTypesToExpand($method, '\\');
} }
/**
* Returns the method and property types and their expected values to test
* the retrieval of types.
*
* @param string $method Name of the method consuming this data provider.
*
* @return string[]
*/
public function provideTypesToExpandWithPropertyOrMethod($method)
{
return array(
array(
'LinkDescriptor::setLink()',
array('\phpDocumentor\LinkDescriptor::setLink()')
),
array(
'phpDocumentor\LinkDescriptor::setLink()',
array('\phpDocumentor\LinkDescriptor::setLink()')
),
array(
'LinkDescriptor::$link',
array('\phpDocumentor\LinkDescriptor::$link')
),
array(
'phpDocumentor\LinkDescriptor::$link',
array('\phpDocumentor\LinkDescriptor::$link')
),
);
}
} }
@@ -10,24 +10,25 @@
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection; namespace Barryvdh\Reflection;
use phpDocumentor\Reflection\DocBlock\Context; use Barryvdh\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Location; use Barryvdh\Reflection\DocBlock\Location;
use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag; use Barryvdh\Reflection\DocBlock\Tag\ReturnTag;
use PHPUnit\Framework\TestCase;
/** /**
* Test class for phpDocumentor\Reflection\DocBlock * Test class for Barryvdh\Reflection\DocBlock
* *
* @author Mike van Riel <mike.vanriel@naenius.com> * @author Mike van Riel <mike.vanriel@naenius.com>
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT * @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
class DocBlockTest extends \PHPUnit_Framework_TestCase class DocBlockTest extends TestCase
{ {
/** /**
* @covers \phpDocumentor\Reflection\DocBlock * @covers \Barryvdh\Reflection\DocBlock
* *
* @return void * @return void
*/ */
@@ -70,7 +71,7 @@ DOCBLOCK;
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock::splitDocBlock * @covers \Barryvdh\Reflection\DocBlock::splitDocBlock
* *
* @return void * @return void
*/ */
@@ -92,7 +93,7 @@ DOCBLOCK;
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock::isTemplateStart * @covers \Barryvdh\Reflection\DocBlock::isTemplateStart
*/ */
public function testIfStartOfTemplateIsDiscovered() public function testIfStartOfTemplateIsDiscovered()
{ {
@@ -113,7 +114,7 @@ DOCBLOCK;
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock::isTemplateEnd * @covers \Barryvdh\Reflection\DocBlock::isTemplateEnd
*/ */
public function testIfEndOfTemplateIsDiscovered() public function testIfEndOfTemplateIsDiscovered()
{ {
@@ -127,7 +128,7 @@ DOCBLOCK;
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock::cleanInput * @covers \Barryvdh\Reflection\DocBlock::cleanInput
* *
* @return void * @return void
*/ */
@@ -144,7 +145,7 @@ DOCBLOCK;
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock::__construct * @covers \Barryvdh\Reflection\DocBlock::__construct
* *
* @return void * @return void
*/ */
@@ -152,7 +153,7 @@ DOCBLOCK;
{ {
$object = new DocBlock(new \ReflectionClass($this)); $object = new DocBlock(new \ReflectionClass($this));
$this->assertEquals( $this->assertEquals(
'Test class for phpDocumentor\Reflection\DocBlock', 'Test class for Barryvdh\Reflection\DocBlock',
$object->getShortDescription() $object->getShortDescription()
); );
$this->assertEquals('', $object->getLongDescription()->getContents()); $this->assertEquals('', $object->getLongDescription()->getContents());
@@ -165,12 +166,12 @@ DOCBLOCK;
} }
/** /**
* @expectedException \InvalidArgumentException *
*
* @return void * @return void
*/ */
public function testExceptionOnInvalidObject() public function testExceptionOnInvalidObject()
{ {
$this->expectException(\InvalidArgumentException::class);
new DocBlock($this); new DocBlock($this);
} }
@@ -196,21 +197,22 @@ DOCBLOCK;
} }
/** /**
* @covers \phpDocumentor\Reflection\DocBlock::parseTags * @covers \Barryvdh\Reflection\DocBlock::parseTags
* @expectedException \LogicException * @expectedException \LogicException
* *
* @return void * @return void
*/ */
public function testInvalidTagBlock() public function testInvalidTagBlock()
{ {
if (0 == ini_get('allow_url_include')) { if (!ini_get('allow_url_include')) {
$this->markTestSkipped('"data" URIs for includes are required.'); $this->markTestSkipped('"data" URIs for includes are required.');
return;
} }
include 'data:text/plain;base64,'. base64_encode( include 'data:text/plain;base64,'. base64_encode(
<<<DOCBLOCK_EXTENSION <<<DOCBLOCK_EXTENSION
<?php <?php
class MyReflectionDocBlock extends \phpDocumentor\Reflection\DocBlock { class MyReflectionDocBlock extends \Barryvdh\Reflection\DocBlock {
protected function splitDocBlock(\$comment) { protected function splitDocBlock(\$comment) {
return array('', '', 'Invalid tag block'); return array('', '', 'Invalid tag block');
} }
@@ -262,7 +264,7 @@ DOCBLOCK;
/** /**
* @depends testConstructFromReflector * @depends testConstructFromReflector
* @covers \phpDocumentor\Reflection\DocBlock::getTagsByName * @covers \Barryvdh\Reflection\DocBlock::getTagsByName
* *
* @return void * @return void
*/ */
@@ -275,7 +277,7 @@ DOCBLOCK;
/** /**
* @depends testConstructWithTagsOnly * @depends testConstructWithTagsOnly
* @covers \phpDocumentor\Reflection\DocBlock::parseTags * @covers \Barryvdh\Reflection\DocBlock::parseTags
* *
* @return void * @return void
*/ */
@@ -293,7 +295,7 @@ DOCBLOCK;
/** /**
* @depends testConstructWithTagsOnly * @depends testConstructWithTagsOnly
* @covers \phpDocumentor\Reflection\DocBlock::parseTags * @covers \Barryvdh\Reflection\DocBlock::parseTags
* *
* @return void * @return void
*/ */
@@ -316,7 +318,7 @@ DOCBLOCK;
/** /**
* @depends testConstructWithTagsOnly * @depends testConstructWithTagsOnly
* @covers \phpDocumentor\Reflection\DocBlock::getTagsByName * @covers \Barryvdh\Reflection\DocBlock::getTagsByName
* *
* @return void * @return void
*/ */