Compare commits

..
31 Commits
Author SHA1 Message Date
Barry vd. Heuvel c6fad15f7c Merge pull request #18 from KentarouTakeda/fix-generics-and-closures-return-type
Fixed incorrect parsing of return types for generics and closures
2024-10-23 13:41:03 +02:00
武田 憲太郎 836d531676 Fixed incorrect parsing of return types for generics and closures 2024-10-20 09:02:42 +09:00
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
34 changed files with 529 additions and 959 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
composer.lock
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]
+1 -1
View File
@@ -12,7 +12,7 @@
"psr-0": {"Barryvdh": ["src/"]}
},
"require-dev": {
"phpunit/phpunit": "~4.0,<4.5"
"phpunit/phpunit": "^8.5.14|^9"
},
"suggest": {
"dflydev/markdown": "~1.0",
Generated
-864
View File
@@ -1,864 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "deff4b2e029043b60cdbe896c5b18d6d",
"content-hash": "7b23fd3607c50c95f9d65e81785cf289",
"packages": [],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"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/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-06-14 21:17:01"
},
{
"name": "phpunit/php-code-coverage",
"version": "2.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3",
"sebastian/environment": "^1.3.2",
"sebastian/version": "~1.0"
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.2.1",
"ext-xmlwriter": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2.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": "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": "2015-10-06 15:47:00"
},
{
"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.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"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": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2015-06-21 13:50:34"
},
{
"name": "phpunit/php-timer",
"version": "1.0.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4|~5"
},
"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": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2016-05-12 18:03:57"
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2015-09-15 10:49:45"
},
{
"name": "phpunit/phpunit",
"version": "4.4.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "2e8580deebb7d1ac92ac878595e6bffe01069c2a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2e8580deebb7d1ac92ac878595e6bffe01069c2a",
"reference": "2e8580deebb7d1ac92ac878595e6bffe01069c2a",
"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.2",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0.2",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.0",
"sebastian/diff": "~1.1",
"sebastian/environment": "~1.1",
"sebastian/exporter": "~1.1",
"sebastian/global-state": "~1.0",
"sebastian/recursion-context": "~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.4.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": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2015-01-27 16:06:15"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2",
"sebastian/exporter": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.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": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2015-10-02 06:51:40"
},
{
"name": "sebastian/comparator",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.2",
"sebastian/exporter": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "[email protected]"
},
{
"name": "Volker Dusch",
"email": "[email protected]"
},
{
"name": "Bernhard Schussek",
"email": "[email protected]"
},
{
"name": "Sebastian Bergmann",
"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": "2015-07-26 15:48:44"
},
{
"name": "sebastian/diff",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "[email protected]"
},
{
"name": "Sebastian Bergmann",
"email": "[email protected]"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2015-12-08 07:14:41"
},
{
"name": "sebastian/environment",
"version": "1.3.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2016-05-17 03:18:57"
},
{
"name": "sebastian/exporter",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "7ae5513327cb536431847bcc0c10edba2701064e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
"reference": "7ae5513327cb536431847bcc0c10edba2701064e",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "[email protected]"
},
{
"name": "Volker Dusch",
"email": "[email protected]"
},
{
"name": "Bernhard Schussek",
"email": "[email protected]"
},
{
"name": "Sebastian Bergmann",
"email": "[email protected]"
},
{
"name": "Adam Harvey",
"email": "[email protected]"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2015-06-21 07:55:53"
},
{
"name": "sebastian/global-state",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-10-12 03:26:01"
},
{
"name": "sebastian/recursion-context",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "913401df809e99e4f47b27cdd781f4a258d58791"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
"reference": "913401df809e99e4f47b27cdd781f4a258d58791",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"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": "Jeff Welch",
"email": "[email protected]"
},
{
"name": "Sebastian Bergmann",
"email": "[email protected]"
},
{
"name": "Adam Harvey",
"email": "[email protected]"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2015-11-11 19:50:13"
},
{
"name": "sebastian/version",
"version": "1.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
"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": "2015-06-21 13:59:46"
},
{
"name": "symfony/yaml",
"version": "v2.8.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/815fabf3f48c7d1df345a69d1ad1a88f59757b34",
"reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2016-06-06 11:11:27"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.3"
},
"platform-dev": []
}
+6 -7
View File
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit colors="true" strict="true" bootstrap="vendor/autoload.php">
<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">
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="phpDocumentor\Reflection\DocBlock">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit>
@@ -109,7 +109,7 @@ class Description implements \Reflector
)
\}/Sux',
$this->contents,
null,
-1,
PREG_SPLIT_DELIM_CAPTURE
);
@@ -36,6 +36,9 @@ class Serializer
/** @var int|null The max length of a line. */
protected $lineLength = null;
/** @var bool Separate tag groups. */
protected $separateTags = false;
/**
* Create a Serializer instance.
*
@@ -45,17 +48,20 @@ class Serializer
* @param bool $indentFirstLine Whether to indent the first line.
* @param int|null $lineLength The max length of a line or NULL to
* disable line wrapping.
* @param bool $separateTags Separate tag groups.
*/
public function __construct(
$indent = 0,
$indentString = ' ',
$indentFirstLine = true,
$lineLength = null
$lineLength = null,
$separateTags = false
) {
$this->setIndentationString($indentString);
$this->setIndent($indent);
$this->setIsFirstLineIndented($indentFirstLine);
$this->setLineLength($lineLength);
$this->setSeparateTags($separateTags);
}
/**
@@ -158,6 +164,29 @@ class Serializer
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.
*
@@ -180,8 +209,12 @@ class Serializer
$comment = "{$firstIndent}/**\n{$indent} * {$text}\n{$indent} *\n";
$tags = array_values($docblock->getTags());
/** @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;
if ($this->lineLength) {
$tagText = wordwrap($tagText, $wrapLength);
@@ -189,6 +222,10 @@ class Serializer
$tagText = str_replace("\n", "\n{$indent} * ", $tagText);
$comment .= "{$indent} * {$tagText}\n";
if ($this->separateTags && $nextTag !== null && ! $tag->inSameGroup($nextTag)) {
$comment .= "{$indent} *\n";
}
}
$comment .= $indent . ' */';
+36 -1
View File
@@ -95,7 +95,9 @@ class Tag implements \Reflector
'var'
=> '\Barryvdh\Reflection\DocBlock\Tag\VarTag',
'version'
=> '\Barryvdh\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;
}
/**
* 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.
*
@@ -76,7 +76,17 @@ class MethodTag extends ReturnTag
)?
# Return type
(?:
([\w\|_\\\\]+)
(
(?:[\w\|_\\\\]*\$this[\w\|_\\\\]*)
|
(?:
(?:[\w\|_\\\\]+(?:<[\s\S]*>)?)
# array notation
(?:\[\])*
)*
|
(?:\([\s\S]*\))?
)
\s+
)?
# Legacy method name (not captured)
@@ -46,12 +46,37 @@ class ParamTag extends ReturnTag
public function setContent($content)
{
Tag::setContent($content);
$parts = preg_split(
'/(\s+)/Su',
$this->description,
3,
PREG_SPLIT_DELIM_CAPTURE
);
$parts = [];
$rest = $this->description;
// 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 (isset($parts[0])
@@ -49,7 +49,7 @@ class ReturnTag extends Tag
{
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
$this->type = $parts[0];
@@ -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()}";
}
}
@@ -106,7 +106,7 @@ class Collection extends \ArrayObject
}
// separate the type by the OR operator
$type_parts = explode(self::OPERATOR_OR, $type);
$type_parts = $this->explode($type);
foreach ($type_parts as $part) {
$expanded_type = $this->expand($part);
if ($expanded_type) {
@@ -126,6 +126,40 @@ class Collection extends \ArrayObject
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.
*
@@ -151,6 +185,14 @@ class Collection extends \ArrayObject
return '';
}
if (substr($type, 0, 6) === 'array<' && substr($type, -1) === '>') {
return $type;
}
if($type[0] === '(') {
return $type;
}
if ($this->isTypeAnArray($type)) {
return $this->expand(substr($type, 0, -2)) . self::OPERATOR_ARRAY;
}
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Description
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class DescriptionTest extends \PHPUnit_Framework_TestCase
class DescriptionTest extends TestCase
{
public function testConstruct()
{
@@ -106,7 +108,7 @@ LONGDESC;
$parsedDescription = $parsedContents[1]->getParsedDescription();
$this->assertCount(3, $parsedDescription);
$this->assertSame("inline tag with\n", $parsedDescription[0]);
$this->assertSame("inline tag with", trim($parsedDescription[0]));
$this->assertInstanceOf(
__NAMESPACE__ . '\Tag\LinkTag',
$parsedDescription[1]
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\CoversTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class CoversTagTest extends \PHPUnit_Framework_TestCase
class CoversTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\CoversTag can create
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class DeprecatedTagTest extends \PHPUnit_Framework_TestCase
class DeprecatedTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\ExampleTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class ExampleTagTest extends \PHPUnit_Framework_TestCase
class ExampleTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\SourceTag can
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\LinkTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class LinkTagTest extends \PHPUnit_Framework_TestCase
class LinkTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\MethodTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class MethodTagTest extends \PHPUnit_Framework_TestCase
class MethodTagTest extends TestCase
{
/**
* @param string $signature The signature to test.
@@ -140,7 +142,25 @@ class MethodTagTest extends \PHPUnit_Framework_TestCase
array(
'static static foo()',
true, 'foo', 'static', true, 0, ''
)
),
// generic array
array(
'array<int, string> foo()',
true, 'foo', 'array<int, string>', false, 0, ''
),
// nested generics
array(
'array<int, array<string, mixed>> foo()',
true, 'foo', 'array<int, array<string, mixed>>', false, 0, ''
),
// closure
array(
'(\Closure(int, string): bool) foo()',
true, 'foo', '(\Closure(int, string): bool)', false, 0, ''
),
);
}
}
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\ParamTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class ParamTagTest extends \PHPUnit_Framework_TestCase
class ParamTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\ParamTag can
@@ -112,7 +114,75 @@ class ParamTagTest extends \PHPUnit_Framework_TestCase
array('int'),
'$bob',
"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',
''
),
);
}
}
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\ReturnTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class ReturnTagTest extends \PHPUnit_Framework_TestCase
class ReturnTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\ReturnTag can
@@ -96,6 +98,27 @@ class ReturnTagTest extends \PHPUnit_Framework_TestCase
'int',
array('int'),
"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'
)
);
}
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\SeeTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @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
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\SinceTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class SinceTagTest extends \PHPUnit_Framework_TestCase
class SinceTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\SourceTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class SourceTagTest extends \PHPUnit_Framework_TestCase
class SourceTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\SourceTag can
@@ -0,0 +1,75 @@
<?php
/**
* phpDocumentor SuppressWarnings Tag Test
*
* PHP version 5.3
*
* @author Andrew Smith <espadav8@gmail.com>
* @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 <espadav8@gmail.com>
* @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)',
),
);
}
}
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\ThrowsTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class ThrowsTagTest extends \PHPUnit_Framework_TestCase
class ThrowsTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\ThrowsTag can
@@ -12,6 +12,9 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\UsesTag
*
@@ -20,7 +23,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class UsesTagTest extends \PHPUnit_Framework_TestCase
class UsesTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\UsesTag can create
@@ -12,6 +12,9 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\VarTag
*
@@ -20,7 +23,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class VarTagTest extends \PHPUnit_Framework_TestCase
class VarTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\VarTag can
@@ -12,6 +12,8 @@
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\VersionTag
*
@@ -20,7 +22,7 @@ namespace Barryvdh\Reflection\DocBlock\Tag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class VersionTagTest extends \PHPUnit_Framework_TestCase
class VersionTagTest extends TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
@@ -14,6 +14,7 @@ namespace Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Context;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\VarTag
@@ -23,16 +24,16 @@ use Barryvdh\Reflection\DocBlock\Context;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class TagTest extends \PHPUnit_Framework_TestCase
class TagTest extends TestCase
{
/**
* @expectedException \InvalidArgumentException
*
* @return void
*/
public function testInvalidTagLine()
{
$this->expectException(\InvalidArgumentException::class);
Tag::createInstance('Invalid tag line');
}
@@ -76,7 +77,7 @@ class TagTest extends \PHPUnit_Framework_TestCase
*/
public function testTagHandlerCorrectRegistration()
{
if (0 == ini_get('allow_url_include')) {
if (!ini_get('allow_url_include')) {
$this->markTestSkipped('"data" URIs for includes are required.');
}
$currentHandler = __NAMESPACE__ . '\Tag\VarTag';
@@ -13,6 +13,7 @@
namespace Barryvdh\Reflection\DocBlock\Type;
use Barryvdh\Reflection\DocBlock\Context;
use PHPUnit\Framework\TestCase;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Type\Collection
@@ -24,7 +25,7 @@ use Barryvdh\Reflection\DocBlock\Context;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class CollectionTest extends \PHPUnit_Framework_TestCase
class CollectionTest extends TestCase
{
/**
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
@@ -145,12 +146,12 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
/**
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::add
* @expectedException InvalidArgumentException
*
* @return void
*/
public function testAddWithInvalidArgument()
{
$this->expectException(\InvalidArgumentException::class);
$collection = new Collection();
$collection->add(array());
}
@@ -197,6 +198,22 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
'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()')
+5 -3
View File
@@ -15,6 +15,7 @@ namespace Barryvdh\Reflection;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\Location;
use Barryvdh\Reflection\DocBlock\Tag\ReturnTag;
use PHPUnit\Framework\TestCase;
/**
* Test class for Barryvdh\Reflection\DocBlock
@@ -24,7 +25,7 @@ use Barryvdh\Reflection\DocBlock\Tag\ReturnTag;
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
class DocBlockTest extends \PHPUnit_Framework_TestCase
class DocBlockTest extends TestCase
{
/**
* @covers \Barryvdh\Reflection\DocBlock
@@ -165,12 +166,12 @@ DOCBLOCK;
}
/**
* @expectedException \InvalidArgumentException
*
* @return void
*/
public function testExceptionOnInvalidObject()
{
$this->expectException(\InvalidArgumentException::class);
new DocBlock($this);
}
@@ -203,8 +204,9 @@ DOCBLOCK;
*/
public function testInvalidTagBlock()
{
if (0 == ini_get('allow_url_include')) {
if (!ini_get('allow_url_include')) {
$this->markTestSkipped('"data" URIs for includes are required.');
return;
}
include 'data:text/plain;base64,'. base64_encode(