2017-11-18 21:58:26 +01:00
|
|
|
<?php declare(strict_types = 1);
|
|
|
|
|
|
|
|
namespace PHPStan\PhpDocParser\Parser;
|
|
|
|
|
|
|
|
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprArrayNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
|
|
|
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
|
|
|
use PHPStan\PhpDocParser\Lexer\Lexer;
|
|
|
|
|
|
|
|
class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
/** @var Lexer */
|
|
|
|
private $lexer;
|
|
|
|
|
|
|
|
/** @var PhpDocParser() */
|
|
|
|
private $phpDocParser;
|
|
|
|
|
|
|
|
protected function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
$this->lexer = new Lexer();
|
|
|
|
$this->phpDocParser = new PhpDocParser(new TypeParser(), new ConstExprParser());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider provideParseData
|
|
|
|
* @param string $input
|
|
|
|
* @param PhpDocNode $expectedPhpDocNode
|
|
|
|
* @param int $nextTokenType
|
|
|
|
*/
|
|
|
|
public function testParse(string $input, PhpDocNode $expectedPhpDocNode, int $nextTokenType = Lexer::TOKEN_END)
|
|
|
|
{
|
|
|
|
$tokens = new TokenIterator($this->lexer->tokenize($input));
|
|
|
|
$actualPhpDocNode = $this->phpDocParser->parse($tokens);
|
|
|
|
|
|
|
|
$this->assertEquals($expectedPhpDocNode, $actualPhpDocNode);
|
|
|
|
$this->assertSame((string) $expectedPhpDocNode, (string) $actualPhpDocNode);
|
|
|
|
$this->assertSame($nextTokenType, $tokens->currentTokenType());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function provideParseData(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[
|
|
|
|
'/** nothing */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' nothing '),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/**nothing*/',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode('nothing'),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @foo lorem */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@foo',
|
2017-11-22 11:43:57 +01:00
|
|
|
new GenericTagValueNode('lorem')
|
2017-11-18 21:58:26 +01:00
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @foo lorem ipsum */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@foo',
|
2017-11-22 11:43:57 +01:00
|
|
|
new GenericTagValueNode('lorem ipsum')
|
2017-11-18 21:58:26 +01:00
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @param Foo $foo */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@param',
|
|
|
|
new ParamTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
2017-11-19 18:07:18 +01:00
|
|
|
false,
|
2017-11-18 21:58:26 +01:00
|
|
|
'$foo',
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
2017-11-19 15:48:51 +01:00
|
|
|
[
|
|
|
|
'/** @param Foo optional description */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@param',
|
|
|
|
new InvalidTagValueNode(
|
2017-11-22 11:43:57 +01:00
|
|
|
'Foo optional description',
|
2017-11-19 15:48:51 +01:00
|
|
|
new \PHPStan\PhpDocParser\Parser\ParserException(
|
|
|
|
'optional',
|
|
|
|
Lexer::TOKEN_IDENTIFIER,
|
|
|
|
15,
|
|
|
|
Lexer::TOKEN_VARIABLE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-19 15:48:51 +01:00
|
|
|
]),
|
|
|
|
],
|
2017-11-18 21:58:26 +01:00
|
|
|
[
|
|
|
|
'/** @param Foo $foo optional description */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@param',
|
|
|
|
new ParamTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
2017-11-19 18:07:18 +01:00
|
|
|
false,
|
|
|
|
'$foo',
|
2017-11-22 11:43:57 +01:00
|
|
|
'optional description'
|
2017-11-19 18:07:18 +01:00
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-19 18:07:18 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @param Foo ...$foo optional description */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@param',
|
|
|
|
new ParamTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
|
|
|
true,
|
2017-11-18 21:58:26 +01:00
|
|
|
'$foo',
|
2017-11-22 11:43:57 +01:00
|
|
|
'optional description'
|
2017-11-18 21:58:26 +01:00
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @return Foo */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@return',
|
|
|
|
new ReturnTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @return Foo optional description */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@return',
|
|
|
|
new ReturnTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
2017-11-22 11:43:57 +01:00
|
|
|
'optional description'
|
2017-11-18 21:58:26 +01:00
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @return array [int] */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@return',
|
|
|
|
new ReturnTagValueNode(
|
|
|
|
new IdentifierTypeNode('array'),
|
2017-11-22 11:43:57 +01:00
|
|
|
'[int]'
|
2017-11-18 21:58:26 +01:00
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @return [int, string] */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@return',
|
|
|
|
new InvalidTagValueNode(
|
2017-11-22 11:43:57 +01:00
|
|
|
'[int, string]',
|
2017-11-18 21:58:26 +01:00
|
|
|
new \PHPStan\PhpDocParser\Parser\ParserException(
|
|
|
|
'[',
|
|
|
|
Lexer::TOKEN_OPEN_SQUARE_BRACKET,
|
|
|
|
12,
|
|
|
|
Lexer::TOKEN_IDENTIFIER
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @return A & B | C */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@return',
|
|
|
|
new InvalidTagValueNode(
|
2017-11-22 11:43:57 +01:00
|
|
|
'A & B | C',
|
2017-11-18 21:58:26 +01:00
|
|
|
new \PHPStan\PhpDocParser\Parser\ParserException(
|
|
|
|
'|',
|
|
|
|
Lexer::TOKEN_UNION,
|
|
|
|
18,
|
|
|
|
Lexer::TOKEN_OTHER
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @return A | B & C */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@return',
|
|
|
|
new InvalidTagValueNode(
|
2017-11-22 11:43:57 +01:00
|
|
|
'A | B & C',
|
2017-11-18 21:58:26 +01:00
|
|
|
new \PHPStan\PhpDocParser\Parser\ParserException(
|
|
|
|
'&',
|
|
|
|
Lexer::TOKEN_INTERSECTION,
|
|
|
|
18,
|
|
|
|
Lexer::TOKEN_OTHER
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @return A | B < 123 */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@return',
|
|
|
|
new InvalidTagValueNode(
|
2017-11-22 11:43:57 +01:00
|
|
|
'A | B < 123',
|
2017-11-18 21:58:26 +01:00
|
|
|
new \PHPStan\PhpDocParser\Parser\ParserException(
|
|
|
|
'123',
|
|
|
|
Lexer::TOKEN_INTEGER,
|
|
|
|
20,
|
|
|
|
Lexer::TOKEN_IDENTIFIER
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @var callable[] function (Configurator $sender, DI\Compiler $compiler); Occurs after the compiler is created */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@var',
|
|
|
|
new VarTagValueNode(
|
|
|
|
new ArrayTypeNode(
|
|
|
|
new IdentifierTypeNode('callable')
|
|
|
|
),
|
|
|
|
'',
|
2017-11-22 11:43:57 +01:00
|
|
|
'function (Configurator $sender, DI\Compiler $compiler); Occurs after the compiler is created'
|
2017-11-18 21:58:26 +01:00
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @var Foo @inject */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@var',
|
|
|
|
new VarTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
|
|
|
'',
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
2017-11-18 21:58:26 +01:00
|
|
|
new PhpDocTagNode(
|
|
|
|
'@inject',
|
|
|
|
new GenericTagValueNode('')
|
|
|
|
),
|
2017-11-22 11:43:57 +01:00
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @var \\\\Foo $foo */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@var',
|
|
|
|
new InvalidTagValueNode(
|
|
|
|
'\\\\Foo $foo',
|
|
|
|
new \PHPStan\PhpDocParser\Parser\ParserException(
|
|
|
|
'\\\\Foo',
|
|
|
|
Lexer::TOKEN_OTHER,
|
|
|
|
9,
|
|
|
|
Lexer::TOKEN_IDENTIFIER
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @varFoo $foo */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@varFoo',
|
|
|
|
new GenericTagValueNode(
|
|
|
|
'$foo'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/** @var Foo$foo */',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@var',
|
|
|
|
new VarTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
|
|
|
'$foo',
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode(' '),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/**@var(Foo)$foo#desc*/',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode(''),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@var',
|
|
|
|
new VarTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
|
|
|
'$foo',
|
|
|
|
'#desc'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode(''),
|
2017-11-18 21:58:26 +01:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/**
|
|
|
|
* @param Foo $foo 1st multi world description
|
|
|
|
* @param Bar $bar 2nd multi world description
|
|
|
|
*/',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@param',
|
|
|
|
new ParamTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
2017-11-19 18:07:18 +01:00
|
|
|
false,
|
2017-11-18 21:58:26 +01:00
|
|
|
'$foo',
|
|
|
|
'1st multi world description'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@param',
|
|
|
|
new ParamTagValueNode(
|
|
|
|
new IdentifierTypeNode('Bar'),
|
2017-11-19 18:07:18 +01:00
|
|
|
false,
|
2017-11-18 21:58:26 +01:00
|
|
|
'$bar',
|
|
|
|
'2nd multi world description'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n "),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/**
|
|
|
|
* @param Foo $foo 1st multi world description
|
|
|
|
* some text in the middle
|
|
|
|
* @param Bar $bar 2nd multi world description
|
|
|
|
*/',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@param',
|
|
|
|
new ParamTagValueNode(
|
|
|
|
new IdentifierTypeNode('Foo'),
|
2017-11-19 18:07:18 +01:00
|
|
|
false,
|
2017-11-18 21:58:26 +01:00
|
|
|
'$foo',
|
|
|
|
'1st multi world description'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * some text in the middle\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@param',
|
|
|
|
new ParamTagValueNode(
|
|
|
|
new IdentifierTypeNode('Bar'),
|
2017-11-19 18:07:18 +01:00
|
|
|
false,
|
2017-11-18 21:58:26 +01:00
|
|
|
'$bar',
|
|
|
|
'2nd multi world description'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n "),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'/**
|
|
|
|
* @method int getInteger(int $a, int $b)
|
|
|
|
* @method void doSomething(int $a, $b)
|
|
|
|
* @method self|Bar getFooOrBar()
|
|
|
|
* @method methodWithNoReturnType()
|
|
|
|
* @method static int getIntegerStatically(int $a, int $b)
|
|
|
|
* @method static void doSomethingStatically(int $a, $b)
|
|
|
|
* @method static self|Bar getFooOrBarStatically()
|
|
|
|
* @method static methodWithNoReturnTypeStatically()
|
|
|
|
* @method int getIntegerWithDescription(int $a, int $b) Get an integer with a description.
|
|
|
|
* @method void doSomethingWithDescription(int $a, $b) Do something with a description.
|
|
|
|
* @method self|Bar getFooOrBarWithDescription() Get a Foo or a Bar with a description.
|
|
|
|
* @method methodWithNoReturnTypeWithDescription() Do something with a description but what, who knows!
|
|
|
|
* @method static int getIntegerStaticallyWithDescription(int $a, int $b) Get an integer with a description statically.
|
|
|
|
* @method static void doSomethingStaticallyWithDescription(int $a, $b) Do something with a description statically.
|
|
|
|
* @method static self|Bar getFooOrBarStaticallyWithDescription() Get a Foo or a Bar with a description statically.
|
|
|
|
* @method static methodWithNoReturnTypeStaticallyWithDescription() Do something with a description statically, but what, who knows!
|
|
|
|
* @method static bool aStaticMethodThatHasAUniqueReturnTypeInThisClass()
|
|
|
|
* @method static string aStaticMethodThatHasAUniqueReturnTypeInThisClassWithDescription() A Description.
|
|
|
|
* @method int getIntegerNoParams
|
|
|
|
* @method void doSomethingNoParams
|
|
|
|
* @method self|Bar getFooOrBarNoParams
|
|
|
|
* @method methodWithNoReturnTypeNoParams
|
|
|
|
* @method static int getIntegerStaticallyNoParams
|
|
|
|
* @method static void doSomethingStaticallyNoParams
|
|
|
|
* @method static self|Bar getFooOrBarStaticallyNoParams
|
|
|
|
* @method static methodWithNoReturnTypeStaticallyNoParams
|
|
|
|
* @method int getIntegerWithDescriptionNoParams Get an integer with a description.
|
|
|
|
* @method void doSomethingWithDescriptionNoParams Do something with a description.
|
|
|
|
* @method self|Bar getFooOrBarWithDescriptionNoParams Get a Foo or a Bar with a description.
|
|
|
|
* @method static int getIntegerStaticallyWithDescriptionNoParams Get an integer with a description statically.
|
|
|
|
* @method static void doSomethingStaticallyWithDescriptionNoParams Do something with a description statically.
|
|
|
|
* @method static self|Bar getFooOrBarStaticallyWithDescriptionNoParams Get a Foo or a Bar with a description statically.
|
|
|
|
* @method static bool|string aStaticMethodThatHasAUniqueReturnTypeInThisClassNoParams
|
|
|
|
* @method static string|float aStaticMethodThatHasAUniqueReturnTypeInThisClassWithDescriptionNoParams A Description.
|
|
|
|
* @method \Aws\Result publish(array $args)
|
|
|
|
* @method Image rotate(float & ... $angle = array(), $backgroundColor)
|
|
|
|
* @method Foo overridenMethod()
|
|
|
|
*/',
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
'getInteger',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$a',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$b',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('void'),
|
|
|
|
'doSomething',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$a',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
null,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$b',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('self'),
|
|
|
|
new IdentifierTypeNode('Bar'),
|
|
|
|
]),
|
|
|
|
'getFooOrBar',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
null,
|
|
|
|
'methodWithNoReturnType',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
'getIntegerStatically',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$a',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$b',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('void'),
|
|
|
|
'doSomethingStatically',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$a',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
null,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$b',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('self'),
|
|
|
|
new IdentifierTypeNode('Bar'),
|
|
|
|
]),
|
|
|
|
'getFooOrBarStatically',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
null,
|
|
|
|
'methodWithNoReturnTypeStatically',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
'getIntegerWithDescription',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$a',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$b',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
'Get an integer with a description.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('void'),
|
|
|
|
'doSomethingWithDescription',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$a',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
null,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$b',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
'Do something with a description.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('self'),
|
|
|
|
new IdentifierTypeNode('Bar'),
|
|
|
|
]),
|
|
|
|
'getFooOrBarWithDescription',
|
|
|
|
[],
|
|
|
|
'Get a Foo or a Bar with a description.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
null,
|
|
|
|
'methodWithNoReturnTypeWithDescription',
|
|
|
|
[],
|
|
|
|
'Do something with a description but what, who knows!'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
'getIntegerStaticallyWithDescription',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$a',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$b',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
'Get an integer with a description statically.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('void'),
|
|
|
|
'doSomethingStaticallyWithDescription',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$a',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
null,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$b',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
'Do something with a description statically.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('self'),
|
|
|
|
new IdentifierTypeNode('Bar'),
|
|
|
|
]),
|
|
|
|
'getFooOrBarStaticallyWithDescription',
|
|
|
|
[],
|
|
|
|
'Get a Foo or a Bar with a description statically.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
null,
|
|
|
|
'methodWithNoReturnTypeStaticallyWithDescription',
|
|
|
|
[],
|
|
|
|
'Do something with a description statically, but what, who knows!'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('bool'),
|
|
|
|
'aStaticMethodThatHasAUniqueReturnTypeInThisClass',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('string'),
|
|
|
|
'aStaticMethodThatHasAUniqueReturnTypeInThisClassWithDescription',
|
|
|
|
[],
|
|
|
|
'A Description.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
'getIntegerNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('void'),
|
|
|
|
'doSomethingNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('self'),
|
|
|
|
new IdentifierTypeNode('Bar'),
|
|
|
|
]),
|
|
|
|
'getFooOrBarNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
null,
|
|
|
|
'methodWithNoReturnTypeNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
'getIntegerStaticallyNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('void'),
|
|
|
|
'doSomethingStaticallyNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('self'),
|
|
|
|
new IdentifierTypeNode('Bar'),
|
|
|
|
]),
|
|
|
|
'getFooOrBarStaticallyNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
null,
|
|
|
|
'methodWithNoReturnTypeStaticallyNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
'getIntegerWithDescriptionNoParams',
|
|
|
|
[],
|
|
|
|
'Get an integer with a description.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('void'),
|
|
|
|
'doSomethingWithDescriptionNoParams',
|
|
|
|
[],
|
|
|
|
'Do something with a description.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('self'),
|
|
|
|
new IdentifierTypeNode('Bar'),
|
|
|
|
]),
|
|
|
|
'getFooOrBarWithDescriptionNoParams',
|
|
|
|
[],
|
|
|
|
'Get a Foo or a Bar with a description.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('int'),
|
|
|
|
'getIntegerStaticallyWithDescriptionNoParams',
|
|
|
|
[],
|
|
|
|
'Get an integer with a description statically.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new IdentifierTypeNode('void'),
|
|
|
|
'doSomethingStaticallyWithDescriptionNoParams',
|
|
|
|
[],
|
|
|
|
'Do something with a description statically.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('self'),
|
|
|
|
new IdentifierTypeNode('Bar'),
|
|
|
|
]),
|
|
|
|
'getFooOrBarStaticallyWithDescriptionNoParams',
|
|
|
|
[],
|
|
|
|
'Get a Foo or a Bar with a description statically.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('bool'),
|
|
|
|
new IdentifierTypeNode('string'),
|
|
|
|
]),
|
|
|
|
'aStaticMethodThatHasAUniqueReturnTypeInThisClassNoParams',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
true,
|
|
|
|
new UnionTypeNode([
|
|
|
|
new IdentifierTypeNode('string'),
|
|
|
|
new IdentifierTypeNode('float'),
|
|
|
|
]),
|
|
|
|
'aStaticMethodThatHasAUniqueReturnTypeInThisClassWithDescriptionNoParams',
|
|
|
|
[],
|
|
|
|
'A Description.'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('\\Aws\\Result'),
|
|
|
|
'publish',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('array'),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$args',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('Image'),
|
|
|
|
'rotate',
|
|
|
|
[
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
new IdentifierTypeNode('float'),
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
'$angle',
|
|
|
|
new ConstExprArrayNode([])
|
|
|
|
),
|
|
|
|
new MethodTagValueParameterNode(
|
|
|
|
null,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'$backgroundColor',
|
|
|
|
null
|
|
|
|
),
|
|
|
|
],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n * "),
|
|
|
|
new PhpDocTagNode(
|
|
|
|
'@method',
|
|
|
|
new MethodTagValueNode(
|
|
|
|
false,
|
|
|
|
new IdentifierTypeNode('Foo'),
|
|
|
|
'overridenMethod',
|
|
|
|
[],
|
|
|
|
''
|
|
|
|
)
|
|
|
|
),
|
|
|
|
new PhpDocTextNode("\n "),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|