Compare commits

..
3 Commits
Author SHA1 Message Date
Barry vd. Heuvel 93f9140080 Revert description 2013-05-28 13:32:15 +02:00
Barry vd. Heuvel 824afa2c40 Revert setTypes, getContent and getRawType
So it is just the original, but with setType added.
2013-05-28 13:31:00 +02:00
Barry vd. Heuvel 09f91760eb Add getRawType, setType and setTypes
Also changed getContent to use getType()
2013-05-27 18:04:27 +02:00
53 changed files with 825 additions and 1042 deletions
-10
View File
@@ -1,10 +0,0 @@
# 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
@@ -1,43 +0,0 @@
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 -2
View File
@@ -1,3 +1,2 @@
.idea
composer.lock
vendor
vendor
+23
View File
@@ -0,0 +1,23 @@
language: php
php:
- 5.3.3
- 5.3
- 5.4
script:
- vendor/phpunit/phpunit/composer/bin/phpunit
before_script:
- sudo apt-get -qq update > /dev/null
- phpenv rehash > /dev/null
- composer selfupdate --quiet
- composer install --dev
- vendor/phpunit/phpunit/composer/bin/phpunit
- composer update --dev
notifications:
irc: "irc.freenode.org#phpdocumentor"
email:
- [email protected]
- [email protected]
- [email protected]
-21
View File
@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2010 Mike van Riel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+5 -13
View File
@@ -1,26 +1,18 @@
{
"name": "barryvdh/reflection-docblock",
"name": "phpdocumentor/reflection-docblock",
"type": "library",
"license": "MIT",
"authors": [
{"name": "Mike van Riel", "email": "[email protected]"}
],
"require": {
"php": ">=5.3.3"
"php": ">=5.3.3",
"dflydev/markdown": "1.0.*"
},
"autoload": {
"psr-0": {"Barryvdh": ["src/"]}
"psr-0": {"phpDocumentor": ["src/"]}
},
"require-dev": {
"phpunit/phpunit": "^8.5.14|^9"
},
"suggest": {
"dflydev/markdown": "~1.0",
"erusev/parsedown": "~1.0"
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
"phpunit/phpunit": "3.7.*@stable"
}
}
Generated
+475
View File
@@ -0,0 +1,475 @@
{
"hash": "c6115c20a4a284f6ca14e676e788b4d3",
"packages": [
{
"name": "dflydev/markdown",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dflydev/dflydev-markdown.git",
"reference": "v1.0.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/dflydev/dflydev-markdown/zipball/v1.0.2",
"reference": "v1.0.2",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"time": "2012-01-15 19:36:37",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"dflydev\\markdown": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"New BSD License"
],
"authors": [
{
"name": "Dragonfly Development Inc.",
"email": "[email protected]",
"homepage": "http://dflydev.com"
},
{
"name": "Beau Simensen",
"email": "[email protected]",
"homepage": "http://beausimensen.com"
},
{
"name": "Michel Fortin",
"homepage": "http://michelf.com"
},
{
"name": "John Gruber",
"homepage": "http://daringfireball.net"
}
],
"description": "PHP Markdown & Extra",
"homepage": "http://github.com/dflydev/dflydev-markdown",
"keywords": [
"markdown"
]
}
],
"packages-dev": [
{
"name": "phpunit/php-code-coverage",
"version": "1.2.7",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "1.2.7"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-code-coverage/archive/1.2.7.zip",
"reference": "1.2.7",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": ">=1.3.0@stable",
"phpunit/php-token-stream": ">=1.1.3@stable",
"phpunit/php-text-template": ">=1.1.1@stable"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.0.5"
},
"time": "2012-12-02 14:54:55",
"type": "library",
"installation-source": "dist",
"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": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"testing",
"coverage",
"xunit"
]
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.3",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "1.3.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-file-iterator/zipball/1.3.3",
"reference": "1.3.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-11 04:44:38",
"type": "library",
"installation-source": "dist",
"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": "http://www.phpunit.de/",
"keywords": [
"filesystem",
"iterator"
]
},
{
"name": "phpunit/php-text-template",
"version": "1.1.4",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-text-template.git",
"reference": "1.1.4"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-text-template/zipball/1.1.4",
"reference": "1.1.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-31 11:15:28",
"type": "library",
"installation-source": "dist",
"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"
]
},
{
"name": "phpunit/php-timer",
"version": "1.0.4",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-timer.git",
"reference": "1.0.4"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-timer/zipball/1.0.4",
"reference": "1.0.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-10-11 04:45:58",
"type": "library",
"installation-source": "dist",
"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": "http://www.phpunit.de/",
"keywords": [
"timer"
]
},
{
"name": "phpunit/php-token-stream",
"version": "1.1.5",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-token-stream.git",
"reference": "1.1.5"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-token-stream/zipball/1.1.5",
"reference": "1.1.5",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"time": "2012-10-11 04:47:14",
"type": "library",
"installation-source": "dist",
"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": "http://www.phpunit.de/",
"keywords": [
"tokenizer"
]
},
{
"name": "phpunit/phpunit",
"version": "3.7.10",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/phpunit.git",
"reference": "3.7.10"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/phpunit/archive/3.7.10.zip",
"reference": "3.7.10",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": ">=1.3.1",
"phpunit/php-text-template": ">=1.1.1",
"phpunit/php-code-coverage": ">=1.2.1",
"phpunit/php-timer": ">=1.0.2",
"phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0",
"symfony/yaml": ">=2.1.0",
"ext-dom": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*"
},
"suggest": {
"phpunit/php-invoker": ">=1.1.0",
"ext-json": "*",
"ext-simplexml": "*",
"ext-tokenizer": "*"
},
"time": "2012-12-02 14:56:55",
"bin": [
"composer/bin/phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.7.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"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": [
"testing",
"phpunit",
"xunit"
]
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "1.2.2",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "1.2.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects/archive/1.2.2.zip",
"reference": "1.2.2",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-text-template": ">=1.1.1@stable"
},
"suggest": {
"ext-soap": "*"
},
"time": "2012-11-05 10:39:13",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"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"
]
},
{
"name": "symfony/yaml",
"version": "v2.1.4",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml",
"reference": "v2.1.4"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Yaml/archive/v2.1.4.zip",
"reference": "v2.1.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-11-08 09:51:48",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com"
}
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": {
"phpunit/phpunit": 0
}
}
+7 -6
View File
@@ -1,13 +1,14 @@
<?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">
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
<phpunit colors="true" strict="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="phpDocumentor\Reflection\DocBlock">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit>
@@ -1,30 +0,0 @@
<?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,11 +10,11 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection;
namespace phpDocumentor\Reflection;
use Barryvdh\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\Location;
use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Location;
/**
* Parses the DocBlock for any structure.
@@ -46,12 +46,6 @@ class DocBlock implements \Reflector
/** @var Location Information about the location of this DocBlock. */
protected $location = null;
/** @var bool Is this DocBlock (the start of) a template? */
protected $isTemplateStart = false;
/** @var bool Does this DocBlock signify the end of a DocBlock template? */
protected $isTemplateEnd = false;
/**
* Parses the given docblock and populates the member fields.
*
@@ -87,9 +81,7 @@ class DocBlock implements \Reflector
$docblock = $this->cleanInput($docblock);
list($templateMarker, $short, $long, $tags) = $this->splitDocBlock($docblock);
$this->isTemplateStart = $templateMarker === '#@+';
$this->isTemplateEnd = $templateMarker === '#@-';
list($short, $long, $tags) = $this->splitDocBlock($docblock);
$this->short_description = $short;
$this->long_description = new DocBlock\Description($long, $this);
$this->parseTags($tags);
@@ -127,86 +119,74 @@ class DocBlock implements \Reflector
}
/**
* Splits the DocBlock into a template marker, summary, description and block of tags.
* Splits the DocBlock into a short description, long description and
* block of tags.
*
* @param string $comment Comment to split into the sub-parts.
*
* @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split.
* @author Mike van Riel <me@mikevanriel.com> for extending the regex with template marker support.
* @author RichardJ Special thanks to RichardJ for the regex responsible
* for the split.
*
* @return string[] containing the template marker (if any), summary, description and a string containing the tags.
* @return string[] containing the short-, long description and an element
* containing the tags.
*/
protected function splitDocBlock($comment)
{
// Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This
// method does not split tags so we return this verbatim as the fourth result (tags). This saves us the
// performance impact of running a regular expression
if (strpos($comment, '@') === 0) {
return array('', '', '', $comment);
$matches = array('', '', $comment);
} else {
// clears all extra horizontal whitespace from the line endings
// to prevent parsing issues
$comment = preg_replace('/\h*$/Sum', '', $comment);
/*
* Splits the docblock into a short description, long description and
* tags section
* - The short description is started from the first character until
* a dot is encountered followed by a newline OR
* two consecutive newlines (horizontal whitespace is taken into
* account to consider spacing errors)
* - The long description, any character until a new line is
* encountered followed by an @ and word characters (a tag).
* This is optional.
* - Tags; the remaining characters
*
* Big thanks to RichardJ for contributing this Regular Expression
*/
preg_match(
'/
\A (
[^\n.]+
(?:
(?! \. \n | \n{2} ) # disallow the first seperator here
[\n.] (?! [ \t]* @\pL ) # disallow second seperator
[^\n.]+
)*
\.?
)
(?:
\s* # first seperator (actually newlines but it\'s all whitespace)
(?! @\pL ) # disallow the rest, to make sure this one doesn\'t match,
#if it doesn\'t exist
(
[^\n]+
(?: \n+
(?! [ \t]* @\pL ) # disallow second seperator (@param)
[^\n]+
)*
)
)?
(\s+ [\s\S]*)? # everything that follows
/ux',
$comment,
$matches
);
array_shift($matches);
}
// clears all extra horizontal whitespace from the line endings to prevent parsing issues
$comment = preg_replace('/\h*$/Sum', '', $comment);
/*
* Splits the docblock into a template marker, short description, long description and tags section
*
* - The template marker is empty, #@+ or #@- if the DocBlock starts with either of those (a newline may
* occur after it and will be stripped).
* - The short description is started from the first character until a dot is encountered followed by a
* newline OR two consecutive newlines (horizontal whitespace is taken into account to consider spacing
* errors). This is optional.
* - The long description, any character until a new line is encountered followed by an @ and word
* characters (a tag). This is optional.
* - Tags; the remaining characters
*
* Big thanks to RichardJ for contributing this Regular Expression
*/
preg_match(
'/
\A
# 1. Extract the template marker
(?:(\#\@\+|\#\@\-)\n?)?
# 2. Extract the summary
(?:
(?! @\pL ) # The summary may not start with an @
(
[^\n.]+
(?:
(?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines
[\n.] (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line
[^\n.]+ # Include anything else
)*
\.?
)?
)
# 3. Extract the description
(?:
\s* # Some form of whitespace _must_ precede a description because a summary must be there
(?! @\pL ) # The description may not start with an @
(
[^\n]+
(?: \n+
(?! [ \t]* @\pL ) # End description when an @ is found as first character on a new line
[^\n]+ # Include anything else
)*
)
)?
# 4. Extract the tags (anything that follows)
(\s+ [\s\S]*)? # everything that follows
/ux',
$comment,
$matches
);
array_shift($matches);
while (count($matches) < 4) {
while (count($matches) < 3) {
$matches[] = '';
}
return $matches;
}
@@ -229,16 +209,20 @@ class DocBlock implements \Reflector
);
}
foreach (explode("\n", $tags) as $tag_line) {
if (trim($tag_line) === '') {
continue;
}
if (isset($tag_line[0]) && ($tag_line[0] === '@')) {
$result[] = $tag_line;
} else {
$result[count($result) - 1] .= "\n" . $tag_line;
$result[count($result) - 1] .= PHP_EOL . $tag_line;
}
}
// create proper Tag objects
foreach ($result as $key => $tag_line) {
$result[$key] = Tag::createInstance(trim($tag_line), $this);
$result[$key] = Tag::createInstance($tag_line, $this);
}
}
@@ -277,7 +261,7 @@ class DocBlock implements \Reflector
*/
public function setText($comment)
{
list(,$short, $long) = $this->splitDocBlock($comment);
list($short, $long) = $this->splitDocBlock($comment);
$this->short_description = $short;
$this->long_description = new DocBlock\Description($long, $this);
return $this;
@@ -302,44 +286,6 @@ class DocBlock implements \Reflector
return $this->long_description;
}
/**
* Returns whether this DocBlock is the start of a Template section.
*
* A Docblock may serve as template for a series of subsequent DocBlocks. This is indicated by a special marker
* (`#@+`) that is appended directly after the opening `/**` of a DocBlock.
*
* An example of such an opening is:
*
* ```
* /**#@+
* * My DocBlock
* * /
* ```
*
* The description and tags (not the summary!) are copied onto all subsequent DocBlocks and also applied to all
* elements that follow until another DocBlock is found that contains the closing marker (`#@-`).
*
* @see self::isTemplateEnd() for the check whether a closing marker was provided.
*
* @return boolean
*/
public function isTemplateStart()
{
return $this->isTemplateStart;
}
/**
* Returns whether this DocBlock is the end of a Template section.
*
* @see self::isTemplateStart() for a more complete description of the Docblock Template functionality.
*
* @return boolean
*/
public function isTemplateEnd()
{
return $this->isTemplateEnd;
}
/**
* Returns the current context.
*
@@ -439,23 +385,6 @@ class DocBlock implements \Reflector
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.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock;
namespace phpDocumentor\Reflection\DocBlock;
/**
* The context in which a DocBlock occurs.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock;
namespace phpDocumentor\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock;
/**
* Parses a Description of a DocBlock or tag.
@@ -55,15 +55,15 @@ class Description implements \Reflector
/**
* Sets the text of this description.
*
*
* @param string $content The new text of this description.
*
*
* @return $this
*/
public function setContent($content)
{
$this->contents = trim($content);
$this->parsedContents = null;
return $this;
}
@@ -109,7 +109,7 @@ class Description implements \Reflector
)
\}/Sux',
$this->contents,
-1,
null,
PREG_SPLIT_DELIM_CAPTURE
);
@@ -140,7 +140,7 @@ class Description implements \Reflector
*
* @todo this should become a more intelligent piece of code where the
* configuration contains a setting what format long descriptions are.
*
*
* @codeCoverageIgnore Will be removed soon, in favor of adapters at
* PhpDocumentor itself that will process text in various formats.
*
@@ -161,10 +161,7 @@ class Description implements \Reflector
);
}
if (class_exists('Parsedown')) {
$markdown = \Parsedown::instance();
$result = $markdown->parse($result);
} elseif (class_exists('dflydev\markdown\MarkdownExtraParser')) {
if (class_exists('dflydev\markdown\MarkdownExtraParser')) {
$markdown = new \dflydev\markdown\MarkdownExtraParser();
$result = $markdown->transformMarkdown($result);
}
@@ -174,7 +171,7 @@ class Description implements \Reflector
/**
* Gets the docblock this tag belongs to.
*
*
* @return DocBlock The docblock this description belongs to.
*/
public function getDocBlock()
@@ -184,10 +181,10 @@ class Description implements \Reflector
/**
* Sets the docblock this tag belongs to.
*
*
* @param DocBlock $docblock The new docblock this description belongs to.
* Setting NULL removes any association.
*
*
* @return $this
*/
public function setDocBlock(DocBlock $docblock = null)
@@ -212,12 +209,14 @@ class Description implements \Reflector
}
/**
* Returns the long description as a string.
* Returns the exported information (we should use the export static method
* BUT this throws an exception at this point).
*
* @return string
* @codeCoverageIgnore Not yet implemented
*/
public function __toString()
{
return $this->getContents();
return 'Not yet implemented';
}
}
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock;
namespace phpDocumentor\Reflection\DocBlock;
/**
* The location a DocBlock occurs within a file.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock;
namespace phpDocumentor\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock;
/**
* Serializes a DocBlock instance.
@@ -36,9 +36,6 @@ 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.
*
@@ -48,20 +45,17 @@ 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,
$separateTags = false
$lineLength = null
) {
$this->setIndentationString($indentString);
$this->setIndent($indent);
$this->setIsFirstLineIndented($indentFirstLine);
$this->setLineLength($lineLength);
$this->setSeparateTags($separateTags);
}
/**
@@ -164,29 +158,6 @@ 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.
*
@@ -209,23 +180,15 @@ class Serializer
$comment = "{$firstIndent}/**\n{$indent} * {$text}\n{$indent} *\n";
$tags = array_values($docblock->getTags());
/** @var Tag $tag */
foreach ($tags as $key => $tag) {
$nextTag = isset($tags[$key + 1]) ? $tags[$key + 1] : null;
$tagText = (string) $tag;
foreach ($docblock->getTags() as $tag) {
$tagText = "@{$tag->getName()} {$tag->getContent()}";
if ($this->lineLength) {
$tagText = wordwrap($tagText, $wrapLength);
}
$tagText = str_replace("\n", "\n{$indent} * ", $tagText);
$comment .= "{$indent} * {$tagText}\n";
if ($this->separateTags && $nextTag !== null && ! $tag->inSameGroup($nextTag)) {
$comment .= "{$indent} *\n";
}
}
$comment .= $indent . ' */';
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock;
namespace phpDocumentor\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock;
/**
* Parses a tag definition for a DocBlock.
@@ -59,45 +59,43 @@ class Tag implements \Reflector
*/
private static $tagHandlerMappings = array(
'author'
=> '\Barryvdh\Reflection\DocBlock\Tag\AuthorTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\AuthorTag',
'covers'
=> '\Barryvdh\Reflection\DocBlock\Tag\CoversTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\CoversTag',
'deprecated'
=> '\Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag',
'example'
=> '\Barryvdh\Reflection\DocBlock\Tag\ExampleTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\ExampleTag',
'link'
=> '\Barryvdh\Reflection\DocBlock\Tag\LinkTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\LinkTag',
'method'
=> '\Barryvdh\Reflection\DocBlock\Tag\MethodTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\MethodTag',
'param'
=> '\Barryvdh\Reflection\DocBlock\Tag\ParamTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\ParamTag',
'property-read'
=> '\Barryvdh\Reflection\DocBlock\Tag\PropertyReadTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyReadTag',
'property'
=> '\Barryvdh\Reflection\DocBlock\Tag\PropertyTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyTag',
'property-write'
=> '\Barryvdh\Reflection\DocBlock\Tag\PropertyWriteTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\PropertyWriteTag',
'return'
=> '\Barryvdh\Reflection\DocBlock\Tag\ReturnTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\ReturnTag',
'see'
=> '\Barryvdh\Reflection\DocBlock\Tag\SeeTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\SeeTag',
'since'
=> '\Barryvdh\Reflection\DocBlock\Tag\SinceTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\SinceTag',
'source'
=> '\Barryvdh\Reflection\DocBlock\Tag\SourceTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\SourceTag',
'throw'
=> '\Barryvdh\Reflection\DocBlock\Tag\ThrowsTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag',
'throws'
=> '\Barryvdh\Reflection\DocBlock\Tag\ThrowsTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag',
'uses'
=> '\Barryvdh\Reflection\DocBlock\Tag\UsesTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\UsesTag',
'var'
=> '\Barryvdh\Reflection\DocBlock\Tag\VarTag',
=> '\phpDocumentor\Reflection\DocBlock\Tag\VarTag',
'version'
=> '\Barryvdh\Reflection\DocBlock\Tag\VersionTag',
'SuppressWarnings'
=> '\Barryvdh\Reflection\DocBlock\Tag\SuppressWarningsTag'
=> '\phpDocumentor\Reflection\DocBlock\Tag\VersionTag'
);
/**
@@ -354,39 +352,6 @@ 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.
*
@@ -401,12 +366,14 @@ class Tag implements \Reflector
}
/**
* Returns the tag as a serialized string
* Returns the exported information (we should use the export static method
* BUT this throws an exception at this point).
*
* @return string
* @codeCoverageIgnore Not yet implemented
*/
public function __toString()
{
return "@{$this->getName()} {$this->getContent()}";
return 'Not yet implemented';
}
}
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for an @author tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @covers tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag\VersionTag;
use phpDocumentor\Reflection\DocBlock\Tag\VersionTag;
/**
* Reflection class for a @deprecated tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @example tag in a Docblock.
@@ -56,7 +56,7 @@ class ExampleTag extends SourceTag
$filePath = '"' . $this->filePath . '"';
}
$this->content = $filePath . ' ' . parent::getContent();
$this->content = $filePath . ' ' . $this->getContent();
}
return $this->content;
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @link tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @method in a Docblock.
@@ -76,17 +76,7 @@ class MethodTag extends ReturnTag
)?
# Return type
(?:
(
(?:[\w\|_\\\\]*\$this[\w\|_\\\\]*)
|
(?:
(?:[\w\|_\\\\]+(?:<[\s\S]*>)?)
# array notation
(?:\[\])*
)*
|
(?:\([\s\S]*\))?
)
([\w\|_\\\\]+)
\s+
)?
# Legacy method name (not captured)
@@ -124,6 +114,9 @@ class MethodTag extends ReturnTag
}
}
$this->parsedDescription = null;
} else {
echo date('c') . ' ERR (3): @method contained invalid contents: '
. $this->content . PHP_EOL;
}
return $this;
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @param tag in a Docblock.
@@ -23,12 +23,11 @@ use Barryvdh\Reflection\DocBlock\Tag;
*/
class ParamTag extends ReturnTag
{
/** @var string */
/**
* @var string
*/
protected $variableName = '';
/** @var bool determines whether this is a variadic argument */
protected $isVariadic = false;
/**
* {@inheritdoc}
*/
@@ -46,37 +45,12 @@ class ParamTag extends ReturnTag
public function setContent($content)
{
Tag::setContent($content);
$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));
$parts = preg_split(
'/(\s+)/Su',
$this->description,
3,
PREG_SPLIT_DELIM_CAPTURE
);
// if the first item that is encountered is not a variable; it is a type
if (isset($parts[0])
@@ -87,18 +61,13 @@ class ParamTag extends ReturnTag
array_shift($parts);
}
// if the next item starts with a $ or ...$ it must be the variable name
// if the next item starts with a $ it must be the variable name
if (isset($parts[0])
&& (strlen($parts[0]) > 0)
&& ($parts[0][0] == '$' || substr($parts[0], 0, 4) === '...$')
&& ($parts[0][0] == '$')
) {
$this->variableName = array_shift($parts);
array_shift($parts);
if (substr($this->variableName, 0, 3) === '...') {
$this->isVariadic = true;
$this->variableName = substr($this->variableName, 3);
}
}
$this->setDescription(implode('', $parts));
@@ -131,14 +100,4 @@ class ParamTag extends ReturnTag
$this->content = null;
return $this;
}
/**
* Returns whether this tag is variadic.
*
* @return boolean
*/
public function isVariadic()
{
return $this->isVariadic;
}
}
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @property-read tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @property tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @property-write tag in a Docblock.
@@ -10,10 +10,10 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Type\Collection;
use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Type\Collection;
/**
* Reflection class for a @return tag in a Docblock.
@@ -26,7 +26,7 @@ class ReturnTag extends Tag
{
/** @var string The raw type component. */
protected $type = '';
/** @var Collection The parsed type component. */
protected $types = null;
@@ -36,7 +36,7 @@ class ReturnTag extends Tag
public function getContent()
{
if (null === $this->content) {
$this->content = "{$this->getType()} {$this->description}";
$this->content = "{$this->type} {$this->description}";
}
return $this->content;
@@ -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];
@@ -95,25 +95,10 @@ class ReturnTag extends Tag
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.
*
* @return void
*
* @return Collection
*/
protected function getTypesCollection()
{
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @see tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag\VersionTag;
use phpDocumentor\Reflection\DocBlock\Tag\VersionTag;
/**
* Reflection class for a @since tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @source tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @throws tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @uses tag in a Docblock.
@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @var tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
namespace phpDocumentor\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tag;
/**
* Reflection class for a @version tag in a Docblock.
@@ -10,9 +10,9 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Type;
namespace phpDocumentor\Reflection\DocBlock\Type;
use Barryvdh\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Context;
/**
* Collection
@@ -106,7 +106,7 @@ class Collection extends \ArrayObject
}
// separate the type by the OR operator
$type_parts = $this->explode($type);
$type_parts = explode(self::OPERATOR_OR, $type);
foreach ($type_parts as $part) {
$expanded_type = $this->expand($part);
if ($expanded_type) {
@@ -114,10 +114,10 @@ class Collection extends \ArrayObject
}
}
}
/**
* Returns a string representation of the collection.
*
*
* @return string The resolved types across the collection, separated with
* {@link self::OPERATOR_OR}.
*/
@@ -126,40 +126,6 @@ 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.
*
@@ -185,31 +151,17 @@ 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;
}
if ($this->isRelativeType($type) && !$this->isTypeAKeyword($type)) {
if($this->shouldBeAbsolute($type)){
return self::OPERATOR_NAMESPACE . $type;
}
$type_parts = explode(self::OPERATOR_NAMESPACE, $type, 2);
$namespace_aliases = $this->context->getNamespaceAliases();
// if the first segment is not an alias; prepend namespace name and
// return
if (!isset($namespace_aliases[$type_parts[0]]) &&
!isset($namespace_aliases[strstr($type_parts[0], '::', true)])) {
if (!isset($namespace_aliases[$type_parts[0]])) {
$namespace = $this->context->getNamespace();
if ('' !== $namespace) {
$namespace .= self::OPERATOR_NAMESPACE;
@@ -217,12 +169,6 @@ class Collection extends \ArrayObject
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 = implode(self::OPERATOR_NAMESPACE, $type_parts);
}
@@ -272,16 +218,4 @@ class Collection extends \ArrayObject
return ($type[0] !== self::OPERATOR_NAMESPACE)
|| $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);
}
}
@@ -1,75 +0,0 @@
<?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,19 +10,17 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Description
* Test class for \phpDocumentor\Reflection\DocBlock\Description
*
* @author Vasil Rangelov <boen.robot@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 DescriptionTest extends TestCase
class DescriptionTest extends \PHPUnit_Framework_TestCase
{
public function testConstruct()
{
@@ -108,7 +106,7 @@ LONGDESC;
$parsedDescription = $parsedContents[1]->getParsedDescription();
$this->assertCount(3, $parsedDescription);
$this->assertSame("inline tag with", trim($parsedDescription[0]));
$this->assertSame("inline tag with\n", $parsedDescription[0]);
$this->assertInstanceOf(
__NAMESPACE__ . '\Tag\LinkTag',
$parsedDescription[1]
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\CoversTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\CoversTag
*
* @author Daniel O'Connor <daniel.oconnor@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 CoversTagTest extends TestCase
class CoversTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\CoversTag can create
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\CoversTag can create
* a link for the covers doc block.
*
* @param string $type
@@ -33,7 +31,7 @@ class CoversTagTest extends TestCase
* @param string $exContent
* @param string $exReference
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\CoversTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\CoversTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag
*
* @author Vasil Rangelov <boen.robot@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 DeprecatedTagTest extends TestCase
class DeprecatedTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
* a link for the @deprecated doc block.
*
* @param string $type
@@ -34,7 +32,7 @@ class DeprecatedTagTest extends TestCase
* @param string $exDescription
* @param string $exVersion
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\ExampleTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag
*
* @author Vasil Rangelov <boen.robot@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 ExampleTagTest extends TestCase
class ExampleTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\SourceTag can
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\SourceTag can
* understand the @source DocBlock.
*
* @param string $type
@@ -35,7 +33,7 @@ class ExampleTagTest extends TestCase
* @param string $exLineCount
* @param string $exFilepath
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\ExampleTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\LinkTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\LinkTag
*
* @author Ben Selby <benmatselby@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 LinkTagTest extends TestCase
class LinkTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
* a link for the @link doc block.
*
* @param string $type
@@ -34,7 +32,7 @@ class LinkTagTest extends TestCase
* @param string $exDescription
* @param string $exLink
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\LinkTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\LinkTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,19 +10,17 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\MethodTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\MethodTag
*
* @author Mike van Riel <mike.vanriel@naenius.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 MethodTagTest extends TestCase
class MethodTagTest extends \PHPUnit_Framework_TestCase
{
/**
* @param string $signature The signature to test.
@@ -36,7 +34,7 @@ class MethodTagTest extends TestCase
* @param string $description The short description mentioned in the
* signature.
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\MethodTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\MethodTag
* @dataProvider getTestSignatures
*
* @return void
@@ -74,11 +72,10 @@ class MethodTagTest extends TestCase
public function getTestSignatures()
{
return array(
// TODO: Verify this case
// array(
// 'foo',
// false, 'foo', '', false, 0, ''
// ),
array(
'foo',
false, 'foo', '', false, 0, ''
),
array(
'foo()',
true, 'foo', 'void', false, 0, ''
@@ -142,25 +139,7 @@ class MethodTagTest extends 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, ''
),
)
);
}
}
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\ParamTag
* Test class for \phpDocumentor\Reflection\DocBlock\ParamTag
*
* @author Mike van Riel <mike.vanriel@naenius.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 ParamTagTest extends TestCase
class ParamTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\ParamTag can
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ParamTag can
* understand the @param DocBlock.
*
* @param string $type
@@ -35,7 +33,7 @@ class ParamTagTest extends TestCase
* @param string $extractedVarName
* @param string $extractedDescription
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\ParamTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag
* @dataProvider provideDataForConstructor
*
* @return void
@@ -114,75 +112,7 @@ class ParamTagTest extends 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',
''
),
)
);
}
}
@@ -1,7 +1,7 @@
<?php
/**
* phpDocumentor Return tag test.
*
*
* PHP version 5.3
*
* @author Mike van Riel <mike.vanriel@naenius.com>
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\ReturnTag
* Test class for \phpDocumentor\Reflection\DocBlock\ReturnTag
*
* @author Mike van Riel <mike.vanriel@naenius.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 ReturnTagTest extends TestCase
class ReturnTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\ReturnTag can
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag can
* understand the @return DocBlock.
*
* @param string $type
@@ -34,7 +32,7 @@ class ReturnTagTest extends TestCase
* @param string $extractedTypes
* @param string $extractedDescription
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\ReturnTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag
* @dataProvider provideDataForConstructor
*
* @return void
@@ -98,27 +96,6 @@ class ReturnTagTest extends 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'
)
);
}
@@ -10,19 +10,17 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\SeeTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SeeTag
*
* @author Daniel O'Connor <daniel.oconnor@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 SeeTagTest extends TestCase
class SeeTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the phpDocumentor_Reflection_DocBlock_Tag_See can create a link
@@ -33,7 +31,7 @@ class SeeTagTest extends TestCase
* @param string $exContent
* @param string $exReference
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\SeeTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SeeTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\SinceTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SinceTag
*
* @author Vasil Rangelov <boen.robot@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 SinceTagTest extends TestCase
class SinceTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
* a link for the @since doc block.
*
* @param string $type
@@ -34,7 +32,7 @@ class SinceTagTest extends TestCase
* @param string $exDescription
* @param string $exVersion
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\SinceTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SinceTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\SourceTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SourceTag
*
* @author Vasil Rangelov <boen.robot@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 SourceTagTest extends TestCase
class SourceTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\SourceTag can
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\SourceTag can
* understand the @source DocBlock.
*
* @param string $type
@@ -34,7 +32,7 @@ class SourceTagTest extends TestCase
* @param string $exStartingLine
* @param string $exLineCount
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\SourceTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SourceTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\ThrowsTag
* Test class for \phpDocumentor\Reflection\DocBlock\ThrowsTag
*
* @author Mike van Riel <mike.vanriel@naenius.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 ThrowsTagTest extends TestCase
class ThrowsTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\ThrowsTag can
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag can
* understand the @throws DocBlock.
*
* @param string $type
@@ -34,7 +32,7 @@ class ThrowsTagTest extends TestCase
* @param string $extractedTypes
* @param string $extractedDescription
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\ThrowsTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag
* @dataProvider provideDataForConstructor
*
* @return void
@@ -10,23 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\UsesTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\UsesTag
*
* @author Daniel O'Connor <daniel.oconnor@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 UsesTagTest extends TestCase
class UsesTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\UsesTag can create
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\UsesTag can create
* a link for the @uses doc block.
*
* @param string $type
@@ -34,7 +31,7 @@ class UsesTagTest extends TestCase
* @param string $exContent
* @param string $exReference
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\UsesTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\UsesTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,23 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\VarTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VarTag
*
* @author Daniel O'Connor <daniel.oconnor@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 VarTagTest extends TestCase
class VarTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\VarTag can
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\VarTag can
* understand the @var doc block.
*
* @param string $type
@@ -35,7 +32,7 @@ class VarTagTest extends TestCase
* @param string $exVariable
* @param string $exDescription
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\VarTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\VarTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,22 +10,20 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Tag;
use PHPUnit\Framework\TestCase;
namespace phpDocumentor\Reflection\DocBlock\Tag;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\VersionTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VersionTag
*
* @author Vasil Rangelov <boen.robot@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 VersionTagTest extends TestCase
class VersionTagTest extends \PHPUnit_Framework_TestCase
{
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\LinkTag can create
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
* a link for the @version doc block.
*
* @param string $type
@@ -34,7 +32,7 @@ class VersionTagTest extends TestCase
* @param string $exDescription
* @param string $exVersion
*
* @covers \Barryvdh\Reflection\DocBlock\Tag\VersionTag
* @covers \phpDocumentor\Reflection\DocBlock\Tag\VersionTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -10,35 +10,34 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock;
namespace phpDocumentor\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Context;
use PHPUnit\Framework\TestCase;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Context;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Tag\VarTag
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VarTag
*
* @author Daniel O'Connor <daniel.oconnor@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 TagTest extends TestCase
class TagTest extends \PHPUnit_Framework_TestCase
{
/**
*
* @expectedException \InvalidArgumentException
*
* @return void
*/
public function testInvalidTagLine()
{
$this->expectException(\InvalidArgumentException::class);
Tag::createInstance('Invalid tag line');
}
/**
* @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
*
* @return void
*/
@@ -71,13 +70,13 @@ class TagTest extends TestCase
}
/**
* @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
*
* @return void
*/
public function testTagHandlerCorrectRegistration()
{
if (!ini_get('allow_url_include')) {
if (0 == ini_get('allow_url_include')) {
$this->markTestSkipped('"data" URIs for includes are required.');
}
$currentHandler = __NAMESPACE__ . '\Tag\VarTag';
@@ -94,7 +93,7 @@ class TagTest extends TestCase
include 'data:text/plain;base64,'. base64_encode(
<<<TAG_HANDLER
<?php
class MyTagHandler extends \Barryvdh\Reflection\DocBlock\Tag {}
class MyTagHandler extends \phpDocumentor\Reflection\DocBlock\Tag {}
TAG_HANDLER
);
@@ -119,8 +118,8 @@ TAG_HANDLER
/**
* @depends testTagHandlerCorrectRegistration
* @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* @covers \Barryvdh\Reflection\DocBlock\Tag::createInstance
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
* @covers \phpDocumentor\Reflection\DocBlock\Tag::createInstance
*
* @return void
*/
@@ -163,8 +162,8 @@ TAG_HANDLER
/**
* @depends testTagHandlerCorrectRegistration
* @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* @covers \Barryvdh\Reflection\DocBlock\Tag::createInstance
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
* @covers \phpDocumentor\Reflection\DocBlock\Tag::createInstance
*
* @return void
*/
@@ -202,7 +201,7 @@ TAG_HANDLER
}
/**
* @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
*
* @return void
*/
@@ -233,7 +232,7 @@ TAG_HANDLER
}
/**
* @covers \Barryvdh\Reflection\DocBlock\Tag::registerTagHandler
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
*
* @return void
*/
@@ -266,14 +265,14 @@ TAG_HANDLER
}
/**
* Test that the \Barryvdh\Reflection\DocBlock\Tag\VarTag can
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\VarTag can
* understand the @var doc block.
*
* @param string $type
* @param string $content
* @param string $exDescription
*
* @covers \Barryvdh\Reflection\DocBlock\Tag
* @covers \phpDocumentor\Reflection\DocBlock\Tag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -1,7 +1,7 @@
<?php
/**
* phpDocumentor Collection Test
*
*
* PHP version 5.3
*
* @author Mike van Riel <mike.vanriel@naenius.com>
@@ -10,27 +10,26 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection\DocBlock\Type;
namespace phpDocumentor\Reflection\DocBlock\Type;
use Barryvdh\Reflection\DocBlock\Context;
use PHPUnit\Framework\TestCase;
use phpDocumentor\Reflection\DocBlock\Context;
/**
* Test class for \Barryvdh\Reflection\DocBlock\Type\Collection
*
* @covers Barryvdh\Reflection\DocBlock\Type\Collection
* Test class for \phpDocumentor\Reflection\DocBlock\Type\Collection
*
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection
*
* @author Mike van Riel <mike.vanriel@naenius.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 CollectionTest extends TestCase
class CollectionTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::getContext
*
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::getContext
*
* @return void
*/
public function testConstruct()
@@ -42,8 +41,8 @@ class CollectionTest extends TestCase
}
/**
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
*
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
*
* @return void
*/
public function testConstructWithTypes()
@@ -53,8 +52,8 @@ class CollectionTest extends TestCase
}
/**
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
*
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
*
* @return void
*/
public function testConstructWithNamespace()
@@ -70,8 +69,8 @@ class CollectionTest extends TestCase
}
/**
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::__construct
*
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
*
* @return void
*/
public function testConstructWithNamespaceAliases()
@@ -89,8 +88,8 @@ class CollectionTest extends TestCase
* @param array $expected
*
* @dataProvider provideTypesToExpand
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::add
*
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
*
* @return void
*/
public function testAdd($fixture, $expected)
@@ -109,8 +108,8 @@ class CollectionTest extends TestCase
* @param array $expected
*
* @dataProvider provideTypesToExpandWithoutNamespace
* @covers Barryvdh\Reflection\DocBlock\Type\Collection::add
*
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
*
* @return void
*/
public function testAddWithoutNamespace($fixture, $expected)
@@ -125,33 +124,13 @@ class CollectionTest extends TestCase
}
/**
* @param string $fixture
* @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
*
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
* @expectedException InvalidArgumentException
*
* @return void
*/
public function testAddWithInvalidArgument()
{
$this->expectException(\InvalidArgumentException::class);
$collection = new Collection();
$collection->add(array());
}
@@ -198,30 +177,6 @@ class CollectionTest extends 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()')
),
array(
'Alias\LinkDescriptor::setLink()',
array('\My\Space\Aliasing\LinkDescriptor::setLink()')
),
);
}
@@ -237,34 +192,4 @@ class CollectionTest extends TestCase
{
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,25 +10,23 @@
* @link http://phpdoc.org
*/
namespace Barryvdh\Reflection;
namespace phpDocumentor\Reflection;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\Location;
use Barryvdh\Reflection\DocBlock\Tag\ReturnTag;
use PHPUnit\Framework\TestCase;
use phpDocumentor\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Location;
/**
* Test class for Barryvdh\Reflection\DocBlock
* Test class for phpDocumentor\Reflection\DocBlock
*
* @author Mike van Riel <mike.vanriel@naenius.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 DocBlockTest extends TestCase
class DocBlockTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers \Barryvdh\Reflection\DocBlock
* @covers \phpDocumentor\Reflection\DocBlock
*
* @return void
*/
@@ -71,8 +69,8 @@ DOCBLOCK;
}
/**
* @covers \Barryvdh\Reflection\DocBlock::splitDocBlock
*
* @covers \phpDocumentor\Reflection\DocBlock::splitDocBlock
*
* @return void
*/
public function testConstructWithTagsOnly()
@@ -93,42 +91,7 @@ DOCBLOCK;
}
/**
* @covers \Barryvdh\Reflection\DocBlock::isTemplateStart
*/
public function testIfStartOfTemplateIsDiscovered()
{
$fixture = <<<DOCBLOCK
/**#@+
* @see \MyClass
* @return void
*/
DOCBLOCK;
$object = new DocBlock($fixture);
$this->assertEquals('', $object->getShortDescription());
$this->assertEquals('', $object->getLongDescription()->getContents());
$this->assertCount(2, $object->getTags());
$this->assertTrue($object->hasTag('see'));
$this->assertTrue($object->hasTag('return'));
$this->assertFalse($object->hasTag('category'));
$this->assertTrue($object->isTemplateStart());
}
/**
* @covers \Barryvdh\Reflection\DocBlock::isTemplateEnd
*/
public function testIfEndOfTemplateIsDiscovered()
{
$fixture = <<<DOCBLOCK
/**#@-*/
DOCBLOCK;
$object = new DocBlock($fixture);
$this->assertEquals('', $object->getShortDescription());
$this->assertEquals('', $object->getLongDescription()->getContents());
$this->assertTrue($object->isTemplateEnd());
}
/**
* @covers \Barryvdh\Reflection\DocBlock::cleanInput
* @covers \phpDocumentor\Reflection\DocBlock::cleanInput
*
* @return void
*/
@@ -145,7 +108,7 @@ DOCBLOCK;
}
/**
* @covers \Barryvdh\Reflection\DocBlock::__construct
* @covers \phpDocumentor\Reflection\DocBlock::__construct
*
* @return void
*/
@@ -153,7 +116,7 @@ DOCBLOCK;
{
$object = new DocBlock(new \ReflectionClass($this));
$this->assertEquals(
'Test class for Barryvdh\Reflection\DocBlock',
'Test class for phpDocumentor\Reflection\DocBlock',
$object->getShortDescription()
);
$this->assertEquals('', $object->getLongDescription()->getContents());
@@ -166,12 +129,12 @@ DOCBLOCK;
}
/**
*
* @expectedException \InvalidArgumentException
*
* @return void
*/
public function testExceptionOnInvalidObject()
{
$this->expectException(\InvalidArgumentException::class);
new DocBlock($this);
}
@@ -197,22 +160,21 @@ DOCBLOCK;
}
/**
* @covers \Barryvdh\Reflection\DocBlock::parseTags
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
* @expectedException \LogicException
*
* @return void
*/
public function testInvalidTagBlock()
{
if (!ini_get('allow_url_include')) {
if (0 == ini_get('allow_url_include')) {
$this->markTestSkipped('"data" URIs for includes are required.');
return;
}
include 'data:text/plain;base64,'. base64_encode(
<<<DOCBLOCK_EXTENSION
<?php
class MyReflectionDocBlock extends \Barryvdh\Reflection\DocBlock {
class MyReflectionDocBlock extends \phpDocumentor\Reflection\DocBlock {
protected function splitDocBlock(\$comment) {
return array('', '', 'Invalid tag block');
}
@@ -264,7 +226,7 @@ DOCBLOCK;
/**
* @depends testConstructFromReflector
* @covers \Barryvdh\Reflection\DocBlock::getTagsByName
* @covers \phpDocumentor\Reflection\DocBlock::getTagsByName
*
* @return void
*/
@@ -277,7 +239,7 @@ DOCBLOCK;
/**
* @depends testConstructWithTagsOnly
* @covers \Barryvdh\Reflection\DocBlock::parseTags
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
*
* @return void
*/
@@ -295,7 +257,7 @@ DOCBLOCK;
/**
* @depends testConstructWithTagsOnly
* @covers \Barryvdh\Reflection\DocBlock::parseTags
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
*
* @return void
*/
@@ -310,15 +272,12 @@ DOCBLOCK;
*/
DOCBLOCK;
$object = new DocBlock($fixture);
$this->assertCount(1, $tags = $object->getTags());
/** @var ReturnTag $tag */
$tag = reset($tags);
$this->assertEquals("Content on\n multiple lines.\n\n One more, after the break.", $tag->getDescription());
$this->assertCount(1, $object->getTags());
}
/**
* @depends testConstructWithTagsOnly
* @covers \Barryvdh\Reflection\DocBlock::getTagsByName
* @covers \phpDocumentor\Reflection\DocBlock::getTagsByName
*
* @return void
*/