mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 18:13:13 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
377c88f549 |
+7
-6
@@ -1,13 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
|
||||||
<coverage>
|
<phpunit colors="true" strict="true" bootstrap="vendor/autoload.php">
|
||||||
<include>
|
|
||||||
<directory suffix=".php">./src/</directory>
|
|
||||||
</include>
|
|
||||||
</coverage>
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="phpDocumentor\Reflection\DocBlock">
|
<testsuite name="phpDocumentor\Reflection\DocBlock">
|
||||||
<directory>./tests/</directory>
|
<directory>./tests/</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
<filter>
|
||||||
|
<whitelist>
|
||||||
|
<directory suffix=".php">./src/</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class Description implements \Reflector
|
|||||||
)
|
)
|
||||||
\}/Sux',
|
\}/Sux',
|
||||||
$this->contents,
|
$this->contents,
|
||||||
-1,
|
null,
|
||||||
PREG_SPLIT_DELIM_CAPTURE
|
PREG_SPLIT_DELIM_CAPTURE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -95,9 +95,7 @@ class Tag implements \Reflector
|
|||||||
'var'
|
'var'
|
||||||
=> '\Barryvdh\Reflection\DocBlock\Tag\VarTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\VarTag',
|
||||||
'version'
|
'version'
|
||||||
=> '\Barryvdh\Reflection\DocBlock\Tag\VersionTag',
|
=> '\Barryvdh\Reflection\DocBlock\Tag\VersionTag'
|
||||||
'SuppressWarnings'
|
|
||||||
=> '\Barryvdh\Reflection\DocBlock\Tag\SuppressWarningsTag'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -53,14 +53,6 @@ class ParamTag extends ReturnTag
|
|||||||
PREG_SPLIT_DELIM_CAPTURE
|
PREG_SPLIT_DELIM_CAPTURE
|
||||||
);
|
);
|
||||||
|
|
||||||
// detect generic type
|
|
||||||
if (isset($parts[0]) && isset($parts[2]) && strpos($parts[0], '<') !== false && strpos($parts[2], '>') !== false) {
|
|
||||||
$parts[0] .= ' ' . $parts[2];
|
|
||||||
unset($parts[1]);
|
|
||||||
unset($parts[2]);
|
|
||||||
$parts = array_values($parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the first item that is encountered is not a variable; it is a type
|
// if the first item that is encountered is not a variable; it is a type
|
||||||
if (isset($parts[0])
|
if (isset($parts[0])
|
||||||
&& (strlen($parts[0]) > 0)
|
&& (strlen($parts[0]) > 0)
|
||||||
|
|||||||
@@ -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()}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -210,7 +210,11 @@ class Collection extends \ArrayObject
|
|||||||
if ('' !== $namespace) {
|
if ('' !== $namespace) {
|
||||||
$namespace .= self::OPERATOR_NAMESPACE;
|
$namespace .= self::OPERATOR_NAMESPACE;
|
||||||
}
|
}
|
||||||
return self::OPERATOR_NAMESPACE . $namespace . $type;
|
$with_name_space = self::OPERATOR_NAMESPACE . $namespace . $type;
|
||||||
|
if($this->shouldBeAbsolute($with_name_space)){
|
||||||
|
return $with_name_space;
|
||||||
|
}
|
||||||
|
return $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($type_parts[0], '::')) {
|
if (strpos($type_parts[0], '::')) {
|
||||||
|
|||||||
@@ -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)',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user