Fix BC break vs. 1.0.0

This commit is contained in:
Ondrej Mirtes 2021-09-16 22:46:02 +02:00
parent d26926e2ac
commit dbc093d7af
No known key found for this signature in database
GPG Key ID: CF1A108D0E7AE720
3 changed files with 10 additions and 27 deletions

View File

@ -25,7 +25,7 @@ class ParamTagValueNode implements PhpDocTagValueNode
/** @var string (may be empty) */ /** @var string (may be empty) */
public $description; public $description;
public function __construct(TypeNode $type, bool $isReference, bool $isVariadic, string $parameterName, string $description) public function __construct(TypeNode $type, bool $isVariadic, string $parameterName, string $description, bool $isReference = false)
{ {
$this->type = $type; $this->type = $type;
$this->isReference = $isReference; $this->isReference = $isReference;

View File

@ -224,7 +224,7 @@ class PhpDocParser
$isVariadic = $tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC); $isVariadic = $tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC);
$parameterName = $this->parseRequiredVariableName($tokens); $parameterName = $this->parseRequiredVariableName($tokens);
$description = $this->parseOptionalDescription($tokens); $description = $this->parseOptionalDescription($tokens);
return new Ast\PhpDoc\ParamTagValueNode($type, $isReference, $isVariadic, $parameterName, $description); return new Ast\PhpDoc\ParamTagValueNode($type, $isVariadic, $parameterName, $description, $isReference);
} }

View File

@ -99,7 +99,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
false, false,
false,
'$foo', '$foo',
'' ''
) )
@ -116,7 +115,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
false, false,
false,
'$foo', '$foo',
'optional description' 'optional description'
) )
@ -132,7 +130,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
'@param', '@param',
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
false,
true, true,
'$foo', '$foo',
'' ''
@ -149,7 +146,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
'@param', '@param',
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
false,
true, true,
'$foo', '$foo',
'optional description' 'optional description'
@ -166,10 +162,10 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
'@param', '@param',
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
true,
false, false,
'$foo', '$foo',
'' '',
true
) )
), ),
]), ]),
@ -183,10 +179,10 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
'@param', '@param',
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
true,
false, false,
'$foo', '$foo',
'optional description' 'optional description',
true
) )
), ),
]), ]),
@ -201,9 +197,9 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
true, true,
true,
'$foo', '$foo',
'' '',
true
) )
), ),
]), ]),
@ -218,9 +214,9 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
true, true,
true,
'$foo', '$foo',
'optional description' 'optional description',
true
) )
), ),
]), ]),
@ -235,7 +231,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
new ParamTagValueNode( new ParamTagValueNode(
new ConstTypeNode(new ConstFetchNode('self', '*')), new ConstTypeNode(new ConstFetchNode('self', '*')),
false, false,
false,
'$foo', '$foo',
'optional description' 'optional description'
) )
@ -1945,7 +1940,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
false, false,
false,
'$foo', '$foo',
'1st multi world description' '1st multi world description'
) )
@ -1955,7 +1949,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Bar'), new IdentifierTypeNode('Bar'),
false, false,
false,
'$bar', '$bar',
'2nd multi world description' '2nd multi world description'
) )
@ -1975,7 +1968,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
false, false,
false,
'$foo', '$foo',
'1st multi world description '1st multi world description
some text in the middle' some text in the middle'
@ -1986,7 +1978,6 @@ some text in the middle'
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Bar'), new IdentifierTypeNode('Bar'),
false, false,
false,
'$bar', '$bar',
'2nd multi world description' '2nd multi world description'
) )
@ -2017,7 +2008,6 @@ some text in the middle'
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Foo'), new IdentifierTypeNode('Foo'),
false, false,
false,
'$foo', '$foo',
'1st multi world description with empty lines' '1st multi world description with empty lines'
) )
@ -2032,7 +2022,6 @@ some text in the middle'
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Bar'), new IdentifierTypeNode('Bar'),
false, false,
false,
'$bar', '$bar',
'2nd multi world description with empty lines' '2nd multi world description with empty lines'
) )
@ -2066,7 +2055,6 @@ some text in the middle'
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('int'), new IdentifierTypeNode('int'),
false, false,
false,
'$foo', '$foo',
'@param string $bar' '@param string $bar'
) )
@ -2982,7 +2970,6 @@ some text in the middle'
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('class-string'), new IdentifierTypeNode('class-string'),
false, false,
false,
'$test', '$test',
'' ''
) )
@ -2999,7 +2986,6 @@ some text in the middle'
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('class-string'), new IdentifierTypeNode('class-string'),
false, false,
false,
'$test', '$test',
'some description' 'some description'
) )
@ -3293,7 +3279,6 @@ time are not reliable as field settings might be missing.'),
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('\Drupal\Core\Field\FieldStorageDefinitionInterface'), new IdentifierTypeNode('\Drupal\Core\Field\FieldStorageDefinitionInterface'),
false, false,
false,
'$field_definition', '$field_definition',
'' ''
) )
@ -3371,7 +3356,6 @@ time are not reliable as field settings might be missing.'),
new ParamTagValueNode( new ParamTagValueNode(
new IdentifierTypeNode('Request'), new IdentifierTypeNode('Request'),
false, false,
false,
'$request', '$request',
'- The request object' '- The request object'
) )
@ -3592,7 +3576,6 @@ Finder::findFiles('*.php')
new ParamTagValueNode( new ParamTagValueNode(
new ConstTypeNode(new ConstFetchNode('DateTimeImmutable', 'ATOM')), new ConstTypeNode(new ConstFetchNode('DateTimeImmutable', 'ATOM')),
false, false,
false,
'$a', '$a',
'' ''
), ),