mirror of
https://github.com/danog/phpdoc-parser.git
synced 2024-11-26 12:04:52 +01:00
Update dependency slevomat/coding-standard to v7
This commit is contained in:
parent
1ab10d8c71
commit
d5a6692b8a
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,5 +2,5 @@
|
||||
/tools
|
||||
/tests/tmp
|
||||
/vendor
|
||||
composer.lock
|
||||
/composer.lock
|
||||
.phpunit.result.cache
|
||||
|
@ -5,7 +5,7 @@
|
||||
"require-dev": {
|
||||
"consistence-community/coding-standard": "^3.11",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
|
||||
"slevomat/coding-standard": "^6.4.1"
|
||||
"slevomat/coding-standard": "^7.0.0"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
|
93
build-cs/composer.lock
generated
93
build-cs/composer.lock
generated
@ -4,35 +4,35 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "b33744523e2d619e22ae3fd7c30f4283",
|
||||
"content-hash": "e864762ae0c59b5c172d16fa0bea7f70",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "consistence-community/coding-standard",
|
||||
"version": "3.11.0",
|
||||
"version": "3.11.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/consistence-community/coding-standard.git",
|
||||
"reference": "20f5c3673013be606a62ba0b6624f5c0e43bb64e"
|
||||
"reference": "4632fead8c9ee8f50044fcbce9f66c797b34c0df"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/consistence-community/coding-standard/zipball/20f5c3673013be606a62ba0b6624f5c0e43bb64e",
|
||||
"reference": "20f5c3673013be606a62ba0b6624f5c0e43bb64e",
|
||||
"url": "https://api.github.com/repos/consistence-community/coding-standard/zipball/4632fead8c9ee8f50044fcbce9f66c797b34c0df",
|
||||
"reference": "4632fead8c9ee8f50044fcbce9f66c797b34c0df",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.4",
|
||||
"slevomat/coding-standard": "~6.4",
|
||||
"squizlabs/php_codesniffer": "~3.5.8"
|
||||
"slevomat/coding-standard": "~7.0",
|
||||
"squizlabs/php_codesniffer": "~3.6.0"
|
||||
},
|
||||
"replace": {
|
||||
"consistence/coding-standard": "3.10.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phing/phing": "2.16.4",
|
||||
"php-parallel-lint/php-parallel-lint": "1.2.0",
|
||||
"phpunit/phpunit": "9.5.2"
|
||||
"php-parallel-lint/php-parallel-lint": "1.3.0",
|
||||
"phpunit/phpunit": "9.5.4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@ -69,9 +69,10 @@
|
||||
"standard"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/consistence-community/coding-standard/tree/3.11.0"
|
||||
"issues": "https://github.com/consistence-community/coding-standard/issues",
|
||||
"source": "https://github.com/consistence-community/coding-standard/tree/3.11.1"
|
||||
},
|
||||
"time": "2021-02-28T08:38:12+00:00"
|
||||
"time": "2021-05-03T18:13:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
||||
@ -150,37 +151,33 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "0.4.9",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531"
|
||||
"reference": "dbc093d7af60eff5cd575d2ed761b15ed40bd08e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/98a088b17966bdf6ee25c8a4b634df313d8aa531",
|
||||
"reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/dbc093d7af60eff5cd575d2ed761b15ed40bd08e",
|
||||
"reference": "dbc093d7af60eff5cd575d2ed761b15ed40bd08e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"consistence/coding-standard": "^3.5",
|
||||
"ergebnis/composer-normalize": "^2.0.2",
|
||||
"jakub-onderka/php-parallel-lint": "^0.9.2",
|
||||
"phing/phing": "^2.16.0",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^0.12.26",
|
||||
"phpstan/phpstan-strict-rules": "^0.12",
|
||||
"phpunit/phpunit": "^6.3",
|
||||
"slevomat/coding-standard": "^4.7.2",
|
||||
"symfony/process": "^4.0"
|
||||
"phpstan/phpstan": "^1.0",
|
||||
"phpstan/phpstan-strict-rules": "^1.0",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"symfony/process": "^5.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.4-dev"
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -197,43 +194,43 @@
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/master"
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.2.0"
|
||||
},
|
||||
"time": "2020-08-03T20:32:43+00:00"
|
||||
"time": "2021-09-16T20:46:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "slevomat/coding-standard",
|
||||
"version": "6.4.1",
|
||||
"version": "7.0.18",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/slevomat/coding-standard.git",
|
||||
"reference": "696dcca217d0c9da2c40d02731526c1e25b65346"
|
||||
"reference": "b81ac84f41a4797dc25c8ede1b0718e2a74be0fc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/696dcca217d0c9da2c40d02731526c1e25b65346",
|
||||
"reference": "696dcca217d0c9da2c40d02731526c1e25b65346",
|
||||
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/b81ac84f41a4797dc25c8ede1b0718e2a74be0fc",
|
||||
"reference": "b81ac84f41a4797dc25c8ede1b0718e2a74be0fc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
|
||||
"php": "^7.1 || ^8.0",
|
||||
"phpstan/phpdoc-parser": "0.4.5 - 0.4.9",
|
||||
"squizlabs/php_codesniffer": "^3.5.6"
|
||||
"phpstan/phpdoc-parser": "^1.0.0",
|
||||
"squizlabs/php_codesniffer": "^3.6.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phing/phing": "2.16.3",
|
||||
"php-parallel-lint/php-parallel-lint": "1.2.0",
|
||||
"phpstan/phpstan": "0.12.48",
|
||||
"phpstan/phpstan-deprecation-rules": "0.12.5",
|
||||
"phpstan/phpstan-phpunit": "0.12.16",
|
||||
"phpstan/phpstan-strict-rules": "0.12.5",
|
||||
"phpunit/phpunit": "7.5.20|8.5.5|9.4.0"
|
||||
"phing/phing": "2.17.0",
|
||||
"php-parallel-lint/php-parallel-lint": "1.3.1",
|
||||
"phpstan/phpstan": "1.2.0",
|
||||
"phpstan/phpstan-deprecation-rules": "1.0.0",
|
||||
"phpstan/phpstan-phpunit": "1.0.0",
|
||||
"phpstan/phpstan-strict-rules": "1.1.0",
|
||||
"phpunit/phpunit": "7.5.20|8.5.21|9.5.10"
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.x-dev"
|
||||
"dev-master": "7.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -248,7 +245,7 @@
|
||||
"description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
|
||||
"support": {
|
||||
"issues": "https://github.com/slevomat/coding-standard/issues",
|
||||
"source": "https://github.com/slevomat/coding-standard/tree/6.4.1"
|
||||
"source": "https://github.com/slevomat/coding-standard/tree/7.0.18"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -260,20 +257,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-05T12:39:37+00:00"
|
||||
"time": "2021-12-07T17:19:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.5.8",
|
||||
"version": "3.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
|
||||
"reference": "5e4e71592f69da17871dba6e80dd51bce74a351a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
|
||||
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a",
|
||||
"reference": "5e4e71592f69da17871dba6e80dd51bce74a351a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -316,7 +313,7 @@
|
||||
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
|
||||
},
|
||||
"time": "2020-10-23T02:01:07+00:00"
|
||||
"time": "2021-12-12T21:44:58+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
74
phpcs.xml
74
phpcs.xml
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="PHPStan PHPDoc Parser">
|
||||
<ruleset name="PHPStan deprecation rules">
|
||||
<config name="php_version" value="70100"/>
|
||||
<arg name="colors"/>
|
||||
<arg name="extensions" value="php"/>
|
||||
@ -9,47 +9,71 @@
|
||||
<arg value="sp"/>
|
||||
<file>src</file>
|
||||
<file>tests</file>
|
||||
|
||||
<rule ref="build-cs/vendor/consistence-community/coding-standard/Consistence/ruleset.xml">
|
||||
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat"/>
|
||||
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameAfterKeyword"/>
|
||||
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable"/>
|
||||
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
|
||||
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
|
||||
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions"/>
|
||||
<exclude name="Consistence.Exceptions.ExceptionDeclaration"/>
|
||||
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
|
||||
<exclude name="Squiz.Commenting.FunctionComment.ParamNameNoMatch"/>
|
||||
<exclude name="Squiz.Commenting.FunctionComment"/>
|
||||
<exclude name="Squiz.PHP.Heredoc.NotAllowed"/>
|
||||
<exclude name="Squiz.WhiteSpace.FunctionSpacing.Before"/>
|
||||
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
|
||||
<properties>
|
||||
<property name="caseSensitive" value="false"/>
|
||||
<property name="psr12Compatible" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
|
||||
<properties>
|
||||
<property name="newlinesCountBetweenOpenTagAndDeclare" value="0"/>
|
||||
<property name="declareOnFirstLine" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessAnnotation">
|
||||
<severity>10</severity>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification"/>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.UselessAnnotation">
|
||||
<severity>10</severity>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint"/>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation">
|
||||
<severity>10</severity>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure.UnusedInheritedVariable"/>
|
||||
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException"/>
|
||||
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable"/>
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
|
||||
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit">
|
||||
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit.UselessElseIf"/>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
|
||||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator"/>
|
||||
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
|
||||
<properties>
|
||||
<property name="rootNamespaces" type="array" value="src=>PHPStan\PhpDocParser,tests/PHPStan=>PHPStan\PhpDocParser"/>
|
||||
<property name="rootNamespaces" type="array">
|
||||
<element key="src" value="PHPStan\PhpDocParser"/>
|
||||
<element key="tests/PHPStan" value="PHPStan\PhpDocParser"/>
|
||||
</property>
|
||||
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
|
||||
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
|
||||
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
|
||||
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
|
||||
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
|
||||
@ -58,11 +82,31 @@
|
||||
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
|
||||
<!--<rule ref="SlevomatCodingStandard.Functions.UnusedParameter"/>-->
|
||||
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
|
||||
<properties>
|
||||
<property name="searchAnnotations" value="true"/>
|
||||
<property name="namespacesRequiredToUse" value=""/>
|
||||
<property name="allowPartialUses" value="true"/>
|
||||
<property name="allowFallbackGlobalFunctions" value="false"/>
|
||||
<property name="allowFallbackGlobalConstants" value="false"/>
|
||||
<property name="allowFullyQualifiedExceptions" value="false"/>
|
||||
<property name="allowFullyQualifiedNameForCollidingClasses" value="true"/>
|
||||
<property name="allowFullyQualifiedNameForCollidingFunctions" value="true"/>
|
||||
<property name="allowFullyQualifiedNameForCollidingConstants" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing"/>
|
||||
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
|
||||
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
|
||||
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
|
||||
<properties>
|
||||
<property name="spacing" value="1" />
|
||||
<property name="spacingBeforeFirst" value="1"/>
|
||||
<property name="spacingAfterLast" value="1"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
|
||||
<rule ref="Consistence.NamingConventions.ValidVariableName.NotCamelCaps"/>
|
||||
<exclude-pattern>tests/*/data</exclude-pattern>
|
||||
<exclude-pattern>tests/*/traits</exclude-pattern>
|
||||
<exclude-pattern>tests/notAutoloaded</exclude-pattern>
|
||||
<exclude-pattern>src/Reflection/SignatureMap/functionMap.php</exclude-pattern>
|
||||
</ruleset>
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class ConstExprArrayNode implements ConstExprNode
|
||||
{
|
||||
|
@ -8,7 +8,6 @@ interface Node
|
||||
public function __toString(): string;
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setAttribute(string $key, $value): void;
|
||||
@ -16,7 +15,6 @@ interface Node
|
||||
public function hasAttribute(string $key): bool;
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute(string $key);
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
trait NodeAttributes
|
||||
{
|
||||
|
||||
@ -9,7 +11,6 @@ trait NodeAttributes
|
||||
private $attributes = [];
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setAttribute(string $key, $value): void
|
||||
@ -23,7 +24,6 @@ trait NodeAttributes
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute(string $key)
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function trim;
|
||||
|
||||
class DeprecatedTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use function trim;
|
||||
|
||||
class ExtendsTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use function trim;
|
||||
|
||||
class ImplementsTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Parser\ParserException;
|
||||
|
||||
class InvalidTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
@ -12,10 +13,10 @@ class InvalidTagValueNode implements PhpDocTagValueNode
|
||||
/** @var string (may be empty) */
|
||||
public $value;
|
||||
|
||||
/** @var \PHPStan\PhpDocParser\Parser\ParserException */
|
||||
/** @var ParserException */
|
||||
public $exception;
|
||||
|
||||
public function __construct(string $value, \PHPStan\PhpDocParser\Parser\ParserException $exception)
|
||||
public function __construct(string $value, ParserException $exception)
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->exception = $exception;
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function implode;
|
||||
|
||||
class MethodTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class MixinTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class ParamTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,10 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function array_column;
|
||||
use function array_filter;
|
||||
use function array_map;
|
||||
use function implode;
|
||||
|
||||
class PhpDocNode implements Node
|
||||
{
|
||||
@ -34,7 +38,6 @@ class PhpDocNode implements Node
|
||||
|
||||
|
||||
/**
|
||||
* @param string $tagName
|
||||
* @return PhpDocTagNode[]
|
||||
*/
|
||||
public function getTagsByName(string $tagName): array
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function trim;
|
||||
|
||||
class PhpDocTagNode implements PhpDocChildNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class PropertyTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class ReturnTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class TemplateTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class ThrowsTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use function trim;
|
||||
|
||||
class TypeAliasImportTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class TypeAliasTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use function trim;
|
||||
|
||||
class UsesTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class VarTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprIntegerNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode;
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function sprintf;
|
||||
|
||||
class ArrayShapeItemNode implements TypeNode
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class ArrayShapeNode implements TypeNode
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class CallableTypeNode implements TypeNode
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class GenericTypeNode implements TypeNode
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class IntersectionTypeNode implements TypeNode
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class UnionTypeNode implements TypeNode
|
||||
{
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
namespace PHPStan\PhpDocParser\Lexer;
|
||||
|
||||
use function array_keys;
|
||||
use function assert;
|
||||
use function count;
|
||||
use function implode;
|
||||
use function preg_match_all;
|
||||
use const PREG_SET_ORDER;
|
||||
|
||||
/**
|
||||
* Implementation based on Nette Tokenizer (New BSD License; https://github.com/nette/tokenizer)
|
||||
*/
|
||||
|
@ -2,8 +2,11 @@
|
||||
|
||||
namespace PHPStan\PhpDocParser\Parser;
|
||||
|
||||
use LogicException;
|
||||
use PHPStan\PhpDocParser\Ast;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use function strtolower;
|
||||
use function trim;
|
||||
|
||||
class ConstExprParser
|
||||
{
|
||||
@ -95,7 +98,7 @@ class ConstExprParser
|
||||
return $this->parseArray($tokens, Lexer::TOKEN_CLOSE_SQUARE_BRACKET);
|
||||
}
|
||||
|
||||
throw new \LogicException($tokens->currentTokenValue());
|
||||
throw new LogicException($tokens->currentTokenValue());
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,9 +2,15 @@
|
||||
|
||||
namespace PHPStan\PhpDocParser\Parser;
|
||||
|
||||
use Exception;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use function assert;
|
||||
use function json_encode;
|
||||
use function sprintf;
|
||||
use const JSON_UNESCAPED_SLASHES;
|
||||
use const JSON_UNESCAPED_UNICODE;
|
||||
|
||||
class ParserException extends \Exception
|
||||
class ParserException extends Exception
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
|
@ -5,6 +5,10 @@ namespace PHPStan\PhpDocParser\Parser;
|
||||
use PHPStan\PhpDocParser\Ast;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPStan\ShouldNotHappenException;
|
||||
use function array_values;
|
||||
use function count;
|
||||
use function trim;
|
||||
|
||||
class PhpDocParser
|
||||
{
|
||||
@ -43,7 +47,7 @@ class PhpDocParser
|
||||
|
||||
try {
|
||||
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PHPDOC);
|
||||
} catch (\PHPStan\PhpDocParser\Parser\ParserException $e) {
|
||||
} catch (ParserException $e) {
|
||||
$name = '';
|
||||
if (count($children) > 0) {
|
||||
$lastChild = $children[count($children) - 1];
|
||||
@ -208,7 +212,7 @@ class PhpDocParser
|
||||
|
||||
$tokens->dropSavePoint();
|
||||
|
||||
} catch (\PHPStan\PhpDocParser\Parser\ParserException $e) {
|
||||
} catch (ParserException $e) {
|
||||
$tokens->rollback();
|
||||
$tagValue = new Ast\PhpDoc\InvalidTagValueNode($this->parseOptionalDescription($tokens), $e);
|
||||
}
|
||||
@ -374,7 +378,7 @@ class PhpDocParser
|
||||
return new Ast\PhpDoc\UsesTagValueNode($type, $description);
|
||||
}
|
||||
|
||||
throw new \PHPStan\ShouldNotHappenException();
|
||||
throw new ShouldNotHappenException();
|
||||
}
|
||||
|
||||
private function parseTypeAliasTagValue(TokenIterator $tokens): Ast\PhpDoc\TypeAliasTagValueNode
|
||||
@ -396,7 +400,7 @@ class PhpDocParser
|
||||
$tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER);
|
||||
|
||||
if (!$tokens->tryConsumeTokenValue('from')) {
|
||||
throw new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
throw new ParserException(
|
||||
$tokens->currentTokenValue(),
|
||||
$tokens->currentTokenType(),
|
||||
$tokens->currentTokenOffset(),
|
||||
|
@ -3,6 +3,11 @@
|
||||
namespace PHPStan\PhpDocParser\Parser;
|
||||
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use function array_pop;
|
||||
use function assert;
|
||||
use function count;
|
||||
use function in_array;
|
||||
use function strlen;
|
||||
|
||||
class TokenIterator
|
||||
{
|
||||
@ -71,8 +76,7 @@ class TokenIterator
|
||||
|
||||
|
||||
/**
|
||||
* @param int $tokenType
|
||||
* @throws \PHPStan\PhpDocParser\Parser\ParserException
|
||||
* @throws ParserException
|
||||
*/
|
||||
public function consumeTokenType(int $tokenType): void
|
||||
{
|
||||
@ -185,12 +189,11 @@ class TokenIterator
|
||||
|
||||
|
||||
/**
|
||||
* @param int $expectedTokenType
|
||||
* @throws \PHPStan\PhpDocParser\Parser\ParserException
|
||||
* @throws ParserException
|
||||
*/
|
||||
private function throwError(int $expectedTokenType): void
|
||||
{
|
||||
throw new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
throw new ParserException(
|
||||
$this->currentTokenValue(),
|
||||
$this->currentTokenType(),
|
||||
$this->currentTokenOffset(),
|
||||
|
@ -2,8 +2,11 @@
|
||||
|
||||
namespace PHPStan\PhpDocParser\Parser;
|
||||
|
||||
use LogicException;
|
||||
use PHPStan\PhpDocParser\Ast;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use function strpos;
|
||||
use function trim;
|
||||
|
||||
class TypeParser
|
||||
{
|
||||
@ -104,7 +107,7 @@ class TypeParser
|
||||
$tokens->dropSavePoint(); // because of ConstFetchNode
|
||||
}
|
||||
|
||||
$exception = new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
$exception = new ParserException(
|
||||
$tokens->currentTokenValue(),
|
||||
$tokens->currentTokenType(),
|
||||
$tokens->currentTokenOffset(),
|
||||
@ -122,7 +125,7 @@ class TypeParser
|
||||
}
|
||||
|
||||
return new Ast\Type\ConstTypeNode($constExpr);
|
||||
} catch (\LogicException $e) {
|
||||
} catch (LogicException $e) {
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
@ -312,7 +315,7 @@ class TypeParser
|
||||
$type = $this->parseCallable($tokens, $identifier);
|
||||
$tokens->dropSavePoint();
|
||||
|
||||
} catch (\PHPStan\PhpDocParser\Parser\ParserException $e) {
|
||||
} catch (ParserException $e) {
|
||||
$tokens->rollback();
|
||||
$type = $identifier;
|
||||
}
|
||||
@ -333,7 +336,7 @@ class TypeParser
|
||||
$type = new Ast\Type\ArrayTypeNode($type);
|
||||
}
|
||||
|
||||
} catch (\PHPStan\PhpDocParser\Parser\ParserException $e) {
|
||||
} catch (ParserException $e) {
|
||||
$tokens->rollback();
|
||||
}
|
||||
|
||||
@ -383,7 +386,7 @@ class TypeParser
|
||||
$tokens->dropSavePoint();
|
||||
|
||||
return new Ast\Type\ArrayShapeItemNode($key, $optional, $value);
|
||||
} catch (\PHPStan\PhpDocParser\Parser\ParserException $e) {
|
||||
} catch (ParserException $e) {
|
||||
$tokens->rollback();
|
||||
$value = $this->parse($tokens);
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use Iterator;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@ -17,7 +18,7 @@ final class NodePrintTest extends TestCase
|
||||
}
|
||||
|
||||
|
||||
public function providePhpDocData(): \Iterator
|
||||
public function providePhpDocData(): Iterator
|
||||
{
|
||||
yield [
|
||||
new PhpDocNode([
|
||||
|
@ -14,8 +14,9 @@ use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprTrueNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ConstExprParserTest extends \PHPUnit\Framework\TestCase
|
||||
class ConstExprParserTest extends TestCase
|
||||
{
|
||||
|
||||
/** @var Lexer */
|
||||
@ -41,9 +42,6 @@ class ConstExprParserTest extends \PHPUnit\Framework\TestCase
|
||||
* @dataProvider provideStringNodeParseData
|
||||
* @dataProvider provideArrayNodeParseData
|
||||
* @dataProvider provideFetchNodeParseData
|
||||
* @param string $input
|
||||
* @param ConstExprNode $expectedExpr
|
||||
* @param int $nextTokenType
|
||||
*/
|
||||
public function testParse(string $input, ConstExprNode $expectedExpr, int $nextTokenType = Lexer::TOKEN_END): void
|
||||
{
|
||||
|
@ -4,9 +4,16 @@ namespace PHPStan\PhpDocParser\Parser;
|
||||
|
||||
use Iterator;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Process\Process;
|
||||
use function file_get_contents;
|
||||
use function glob;
|
||||
use function is_dir;
|
||||
use function mkdir;
|
||||
use function sprintf;
|
||||
use function unlink;
|
||||
|
||||
class FuzzyTest extends \PHPUnit\Framework\TestCase
|
||||
class FuzzyTest extends TestCase
|
||||
{
|
||||
|
||||
/** @var Lexer */
|
||||
@ -28,7 +35,6 @@ class FuzzyTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider provideTypeParserData
|
||||
* @param string $input
|
||||
*/
|
||||
public function testTypeParser(string $input): void
|
||||
{
|
||||
@ -49,7 +55,6 @@ class FuzzyTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider provideConstExprParserData
|
||||
* @param string $input
|
||||
*/
|
||||
public function testConstExprParser(string $input): void
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace PHPStan\PhpDocParser\Parser;
|
||||
|
||||
use Iterator;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprArrayNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprIntegerNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode;
|
||||
@ -35,8 +36,10 @@ use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use const PHP_EOL;
|
||||
|
||||
class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
class PhpDocParserTest extends TestCase
|
||||
{
|
||||
|
||||
/** @var Lexer */
|
||||
@ -72,10 +75,6 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
* @dataProvider provideTypeAliasImportTagsData
|
||||
* @dataProvider provideRealWorldExampleData
|
||||
* @dataProvider provideDescriptionWithOrWithoutHtml
|
||||
* @param string $label
|
||||
* @param string $input
|
||||
* @param PhpDocNode $expectedPhpDocNode
|
||||
* @param int $nextTokenType
|
||||
*/
|
||||
public function testParse(string $label, string $input, PhpDocNode $expectedPhpDocNode, int $nextTokenType = Lexer::TOKEN_END): void
|
||||
{
|
||||
@ -88,7 +87,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
|
||||
public function provideParamTagsData(): \Iterator
|
||||
public function provideParamTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK without description',
|
||||
@ -246,7 +245,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@param',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
11,
|
||||
@ -265,7 +264,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@param',
|
||||
new InvalidTagValueNode(
|
||||
'#desc',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'#desc',
|
||||
Lexer::TOKEN_OTHER,
|
||||
11,
|
||||
@ -284,7 +283,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@param',
|
||||
new InvalidTagValueNode(
|
||||
'(Foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
16,
|
||||
@ -303,7 +302,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@param',
|
||||
new InvalidTagValueNode(
|
||||
'(Foo $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
16,
|
||||
@ -322,7 +321,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@param',
|
||||
new InvalidTagValueNode(
|
||||
'Foo<Bar $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
19,
|
||||
@ -341,7 +340,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@param',
|
||||
new InvalidTagValueNode(
|
||||
'Foo| $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
16,
|
||||
@ -360,7 +359,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@param',
|
||||
new InvalidTagValueNode(
|
||||
'Foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
15,
|
||||
@ -379,7 +378,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@param',
|
||||
new InvalidTagValueNode(
|
||||
'Foo optional description',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'optional',
|
||||
Lexer::TOKEN_IDENTIFIER,
|
||||
15,
|
||||
@ -392,7 +391,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
|
||||
public function provideVarTagsData(): \Iterator
|
||||
public function provideVarTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK without description and variable name',
|
||||
@ -614,7 +613,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@var',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
9,
|
||||
@ -633,7 +632,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@var',
|
||||
new InvalidTagValueNode(
|
||||
'#desc',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'#desc',
|
||||
Lexer::TOKEN_OTHER,
|
||||
9,
|
||||
@ -652,7 +651,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@var',
|
||||
new InvalidTagValueNode(
|
||||
'(Foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
14,
|
||||
@ -671,7 +670,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@var',
|
||||
new InvalidTagValueNode(
|
||||
'(Foo $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
14,
|
||||
@ -690,7 +689,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@var',
|
||||
new InvalidTagValueNode(
|
||||
'Foo<Bar $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
17,
|
||||
@ -709,7 +708,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@var',
|
||||
new InvalidTagValueNode(
|
||||
'Foo| $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
14,
|
||||
@ -728,7 +727,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@psalm-type',
|
||||
new InvalidTagValueNode(
|
||||
'Unexpected token "{", expected \'*/\' at offset 44',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'{',
|
||||
Lexer::TOKEN_OPEN_CURLY_BRACKET,
|
||||
44,
|
||||
@ -741,7 +740,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
|
||||
public function providePropertyTagsData(): \Iterator
|
||||
public function providePropertyTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK without description',
|
||||
@ -781,7 +780,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@property',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
14,
|
||||
@ -800,7 +799,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@property',
|
||||
new InvalidTagValueNode(
|
||||
'#desc',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'#desc',
|
||||
Lexer::TOKEN_OTHER,
|
||||
14,
|
||||
@ -819,7 +818,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@property',
|
||||
new InvalidTagValueNode(
|
||||
'(Foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
19,
|
||||
@ -838,7 +837,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@property',
|
||||
new InvalidTagValueNode(
|
||||
'(Foo $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
19,
|
||||
@ -857,7 +856,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@property',
|
||||
new InvalidTagValueNode(
|
||||
'Foo<Bar $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
22,
|
||||
@ -876,7 +875,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@property',
|
||||
new InvalidTagValueNode(
|
||||
'Foo| $foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
19,
|
||||
@ -895,7 +894,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@property',
|
||||
new InvalidTagValueNode(
|
||||
'Foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
18,
|
||||
@ -914,7 +913,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@property',
|
||||
new InvalidTagValueNode(
|
||||
'Foo optional description',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'optional',
|
||||
Lexer::TOKEN_IDENTIFIER,
|
||||
18,
|
||||
@ -927,7 +926,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
|
||||
public function provideReturnTagsData(): \Iterator
|
||||
public function provideReturnTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK without description',
|
||||
@ -979,7 +978,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@return',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
12,
|
||||
@ -998,7 +997,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@return',
|
||||
new InvalidTagValueNode(
|
||||
'[int, string]',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'[',
|
||||
Lexer::TOKEN_OPEN_SQUARE_BRACKET,
|
||||
12,
|
||||
@ -1017,7 +1016,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@return',
|
||||
new InvalidTagValueNode(
|
||||
'Foo | #desc',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'#desc',
|
||||
Lexer::TOKEN_OTHER,
|
||||
18,
|
||||
@ -1036,7 +1035,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@return',
|
||||
new InvalidTagValueNode(
|
||||
'A & B | C',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'|',
|
||||
Lexer::TOKEN_UNION,
|
||||
18,
|
||||
@ -1055,7 +1054,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@return',
|
||||
new InvalidTagValueNode(
|
||||
'A | B & C',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'&',
|
||||
Lexer::TOKEN_INTERSECTION,
|
||||
18,
|
||||
@ -1074,7 +1073,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@return',
|
||||
new InvalidTagValueNode(
|
||||
'A | B < 123',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
24,
|
||||
@ -1123,7 +1122,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
|
||||
public function provideThrowsTagsData(): \Iterator
|
||||
public function provideThrowsTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK without description',
|
||||
@ -1175,7 +1174,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@throws',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
12,
|
||||
@ -1194,7 +1193,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@throws',
|
||||
new InvalidTagValueNode(
|
||||
'Foo | #desc',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'#desc',
|
||||
Lexer::TOKEN_OTHER,
|
||||
18,
|
||||
@ -1206,7 +1205,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function provideMixinTagsData(): \Iterator
|
||||
public function provideMixinTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK without description',
|
||||
@ -1258,7 +1257,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@mixin',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
11,
|
||||
@ -1277,7 +1276,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@mixin',
|
||||
new InvalidTagValueNode(
|
||||
'Foo | #desc',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'#desc',
|
||||
Lexer::TOKEN_OTHER,
|
||||
17,
|
||||
@ -1305,7 +1304,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function provideDeprecatedTagsData(): \Iterator
|
||||
public function provideDeprecatedTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK with no description',
|
||||
@ -1411,7 +1410,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function provideMethodTagsData(): \Iterator
|
||||
public function provideMethodTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK non-static, without return type',
|
||||
@ -1737,7 +1736,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@method',
|
||||
new InvalidTagValueNode(
|
||||
'a b',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
16,
|
||||
@ -1756,7 +1755,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@method',
|
||||
new InvalidTagValueNode(
|
||||
'static a b',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
23,
|
||||
@ -1775,7 +1774,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
'@method',
|
||||
new InvalidTagValueNode(
|
||||
'a b(x)',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
')',
|
||||
Lexer::TOKEN_CLOSE_PARENTHESES,
|
||||
17,
|
||||
@ -1788,7 +1787,7 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
|
||||
public function provideSingleLinePhpDocData(): \Iterator
|
||||
public function provideSingleLinePhpDocData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'empty',
|
||||
@ -2651,7 +2650,7 @@ some text in the middle'
|
||||
];
|
||||
}
|
||||
|
||||
public function provideTemplateTagsData(): \Iterator
|
||||
public function provideTemplateTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK without bound and description',
|
||||
@ -2751,7 +2750,7 @@ some text in the middle'
|
||||
'@template',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
14,
|
||||
@ -2770,7 +2769,7 @@ some text in the middle'
|
||||
'@template',
|
||||
new InvalidTagValueNode(
|
||||
'#desc',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'#desc',
|
||||
Lexer::TOKEN_OTHER,
|
||||
14,
|
||||
@ -2797,7 +2796,7 @@ some text in the middle'
|
||||
];
|
||||
}
|
||||
|
||||
public function provideExtendsTagsData(): \Iterator
|
||||
public function provideExtendsTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK with one argument',
|
||||
@ -2903,7 +2902,7 @@ some text in the middle'
|
||||
'@extends',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
13,
|
||||
@ -2922,7 +2921,7 @@ some text in the middle'
|
||||
'@extends',
|
||||
new InvalidTagValueNode(
|
||||
'Foo',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
17,
|
||||
@ -2994,7 +2993,7 @@ some text in the middle'
|
||||
];
|
||||
}
|
||||
|
||||
public function provideTypeAliasTagsData(): \Iterator
|
||||
public function provideTypeAliasTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK',
|
||||
@ -3038,7 +3037,7 @@ some text in the middle'
|
||||
'@phpstan-type',
|
||||
new InvalidTagValueNode(
|
||||
'TypeAlias',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
28,
|
||||
@ -3057,7 +3056,7 @@ some text in the middle'
|
||||
'@phpstan-type',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
18,
|
||||
@ -3069,7 +3068,7 @@ some text in the middle'
|
||||
];
|
||||
}
|
||||
|
||||
public function provideTypeAliasImportTagsData(): \Iterator
|
||||
public function provideTypeAliasImportTagsData(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK',
|
||||
@ -3109,7 +3108,7 @@ some text in the middle'
|
||||
'@phpstan-import-type',
|
||||
new InvalidTagValueNode(
|
||||
'TypeAlias from 42',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'42',
|
||||
Lexer::TOKEN_INTEGER,
|
||||
40,
|
||||
@ -3128,7 +3127,7 @@ some text in the middle'
|
||||
'@phpstan-import-type',
|
||||
new InvalidTagValueNode(
|
||||
'Unexpected token "[", expected \'*/\' at offset 52',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'[',
|
||||
Lexer::TOKEN_OPEN_SQUARE_BRACKET,
|
||||
52,
|
||||
@ -3147,7 +3146,7 @@ some text in the middle'
|
||||
'@phpstan-import-type',
|
||||
new InvalidTagValueNode(
|
||||
'TypeAlias',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
35,
|
||||
@ -3166,7 +3165,7 @@ some text in the middle'
|
||||
'@phpstan-import-type',
|
||||
new InvalidTagValueNode(
|
||||
'TypeAlias as DifferentAlias',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'as',
|
||||
Lexer::TOKEN_IDENTIFIER,
|
||||
35,
|
||||
@ -3185,7 +3184,7 @@ some text in the middle'
|
||||
'@phpstan-import-type',
|
||||
new InvalidTagValueNode(
|
||||
'',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'*/',
|
||||
Lexer::TOKEN_CLOSE_PHPDOC,
|
||||
25,
|
||||
@ -3197,7 +3196,7 @@ some text in the middle'
|
||||
];
|
||||
}
|
||||
|
||||
public function providerDebug(): \Iterator
|
||||
public function providerDebug(): Iterator
|
||||
{
|
||||
$sample = '/**
|
||||
* Returns the schema for the field.
|
||||
@ -3223,7 +3222,7 @@ time are not reliable as field settings might be missing.'),
|
||||
];
|
||||
}
|
||||
|
||||
public function provideRealWorldExampleData(): \Iterator
|
||||
public function provideRealWorldExampleData(): Iterator
|
||||
{
|
||||
$sample = "/**
|
||||
* Returns the schema for the field.
|
||||
@ -3416,7 +3415,7 @@ Finder::findFiles('*.php')
|
||||
'malformed const fetch',
|
||||
'/** @param Foo::** $a */',
|
||||
new PhpDocNode([
|
||||
new PhpDocTagNode('@param', new InvalidTagValueNode('Foo::** $a', new \PHPStan\PhpDocParser\Parser\ParserException('*', Lexer::TOKEN_WILDCARD, 17, Lexer::TOKEN_VARIABLE))),
|
||||
new PhpDocTagNode('@param', new InvalidTagValueNode('Foo::** $a', new ParserException('*', Lexer::TOKEN_WILDCARD, 17, Lexer::TOKEN_VARIABLE))),
|
||||
]),
|
||||
];
|
||||
|
||||
@ -3495,7 +3494,7 @@ Finder::findFiles('*.php')
|
||||
];
|
||||
}
|
||||
|
||||
public function provideDescriptionWithOrWithoutHtml(): \Iterator
|
||||
public function provideDescriptionWithOrWithoutHtml(): Iterator
|
||||
{
|
||||
yield [
|
||||
'Description with HTML tags in @return tag (close tags together)',
|
||||
@ -3585,7 +3584,7 @@ Finder::findFiles('*.php')
|
||||
'$foo string[]',
|
||||
new InvalidTagValueNode(
|
||||
'$foo string[]',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
0,
|
||||
@ -3596,7 +3595,7 @@ Finder::findFiles('*.php')
|
||||
];
|
||||
}
|
||||
|
||||
public function provideTagsWithNumbers(): \Iterator
|
||||
public function provideTagsWithNumbers(): Iterator
|
||||
{
|
||||
yield [
|
||||
'OK without description and tag with number in it',
|
||||
@ -3612,10 +3611,7 @@ Finder::findFiles('*.php')
|
||||
|
||||
/**
|
||||
* @dataProvider dataParseTagValue
|
||||
* @param string $tag
|
||||
* @param string $phpDoc
|
||||
* @param PhpDocNode $expectedPhpDocNode
|
||||
* @param int $nextTokenType
|
||||
*/
|
||||
public function testParseTagValue(string $tag, string $phpDoc, Node $expectedPhpDocNode, int $nextTokenType = Lexer::TOKEN_END): void
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace PHPStan\PhpDocParser\Parser;
|
||||
|
||||
use Exception;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprFloatNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprIntegerNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode;
|
||||
@ -20,8 +21,11 @@ use PHPStan\PhpDocParser\Ast\Type\ThisTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use function get_class;
|
||||
use const PHP_EOL;
|
||||
|
||||
class TypeParserTest extends \PHPUnit\Framework\TestCase
|
||||
class TypeParserTest extends TestCase
|
||||
{
|
||||
|
||||
/** @var Lexer */
|
||||
@ -40,13 +44,11 @@ class TypeParserTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider provideParseData
|
||||
* @param string $input
|
||||
* @param TypeNode|\Exception $expectedResult
|
||||
* @param int $nextTokenType
|
||||
* @param TypeNode|Exception $expectedResult
|
||||
*/
|
||||
public function testParse(string $input, $expectedResult, int $nextTokenType = Lexer::TOKEN_END): void
|
||||
{
|
||||
if ($expectedResult instanceof \Exception) {
|
||||
if ($expectedResult instanceof Exception) {
|
||||
$this->expectException(get_class($expectedResult));
|
||||
$this->expectExceptionMessage($expectedResult->getMessage());
|
||||
}
|
||||
@ -436,7 +438,7 @@ class TypeParserTest extends \PHPUnit\Framework\TestCase
|
||||
],
|
||||
[
|
||||
'array{',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'',
|
||||
Lexer::TOKEN_END,
|
||||
6,
|
||||
@ -445,7 +447,7 @@ class TypeParserTest extends \PHPUnit\Framework\TestCase
|
||||
],
|
||||
[
|
||||
'array{a => int}',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
new ParserException(
|
||||
'=>',
|
||||
Lexer::TOKEN_OTHER,
|
||||
8,
|
||||
|
Loading…
Reference in New Issue
Block a user