Merge pull request #291 from jrfnl/feature/cs-update

CS update after upstream changes
This commit is contained in:
Jaap van Otterdijk
2021-08-08 21:14:39 +02:00
committed by GitHub
72 changed files with 587 additions and 533 deletions
+12 -5
View File
@@ -1,22 +1,29 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<ruleset name="phpDocumentor"> <ruleset name="ReflectionDocBlock">
<description>The coding standard for phpDocumentor.</description> <description>The coding standard for this library.</description>
<file>src</file> <file>src</file>
<file>tests/unit</file> <file>tests/unit</file>
<exclude-pattern>*/tests/unit/Types/ContextFactoryTest.php</exclude-pattern> <exclude-pattern>*/tests/unit/Types/ContextFactoryTest\.php</exclude-pattern>
<exclude-pattern>*/tests/unit/Assets/*</exclude-pattern> <exclude-pattern>*/tests/unit/Assets/*</exclude-pattern>
<arg value="p"/> <arg value="p"/>
<!-- Set the minimum PHP version for PHPCompatibility.
This should be kept in sync with the requirements in the composer.json file. -->
<config name="testVersion" value="7.2-"/>
<rule ref="phpDocumentor"> <rule ref="phpDocumentor">
<exclude name="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException" /> <exclude name="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException" />
<!-- Property type declarations are a PHP 7.4 feature. -->
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
</rule> </rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"> <rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix">
<exclude-pattern>*/src/*/Abstract*.php</exclude-pattern> <exclude-pattern>*/src/*/Abstract*\.php</exclude-pattern>
</rule> </rule>
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedMethod"> <rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedMethod">
<exclude-pattern>*/src/DocBlock/Tags/InvalidTag.php</exclude-pattern> <exclude-pattern>*/src/DocBlock/Tags/InvalidTag\.php</exclude-pattern>
</rule> </rule>
</ruleset> </ruleset>
+1
View File
@@ -15,6 +15,7 @@ namespace phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter;
use function vsprintf; use function vsprintf;
/** /**
+2
View File
@@ -15,6 +15,7 @@ namespace phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use function count; use function count;
use function explode; use function explode;
use function implode; use function implode;
@@ -25,6 +26,7 @@ use function strlen;
use function strpos; use function strpos;
use function substr; use function substr;
use function trim; use function trim;
use const PREG_SPLIT_DELIM_CAPTURE; use const PREG_SPLIT_DELIM_CAPTURE;
/** /**
+2
View File
@@ -14,6 +14,7 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\DocBlock; namespace phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Tags\Example; use phpDocumentor\Reflection\DocBlock\Tags\Example;
use function array_slice; use function array_slice;
use function file; use function file;
use function getcwd; use function getcwd;
@@ -22,6 +23,7 @@ use function is_readable;
use function rtrim; use function rtrim;
use function sprintf; use function sprintf;
use function trim; use function trim;
use const DIRECTORY_SEPARATOR; use const DIRECTORY_SEPARATOR;
/** /**
+1
View File
@@ -16,6 +16,7 @@ namespace phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter;
use function sprintf; use function sprintf;
use function str_repeat; use function str_repeat;
use function str_replace; use function str_replace;
+1
View File
@@ -39,6 +39,7 @@ use ReflectionMethod;
use ReflectionNamedType; use ReflectionNamedType;
use ReflectionParameter; use ReflectionParameter;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_merge; use function array_merge;
use function array_slice; use function array_slice;
use function call_user_func_array; use function call_user_func_array;
+2
View File
@@ -14,9 +14,11 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\DocBlock\Tags; namespace phpDocumentor\Reflection\DocBlock\Tags;
use InvalidArgumentException; use InvalidArgumentException;
use function filter_var; use function filter_var;
use function preg_match; use function preg_match;
use function trim; use function trim;
use const FILTER_VALIDATE_EMAIL; use const FILTER_VALIDATE_EMAIL;
/** /**
+1
View File
@@ -20,6 +20,7 @@ use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_key_exists; use function array_key_exists;
use function explode; use function explode;
+1
View File
@@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function preg_match; use function preg_match;
/** /**
+1
View File
@@ -15,6 +15,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tag;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_key_exists; use function array_key_exists;
use function preg_match; use function preg_match;
use function rawurlencode; use function rawurlencode;
@@ -15,6 +15,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter;
use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
use function max; use function max;
use function str_repeat; use function str_repeat;
use function strlen; use function strlen;
@@ -15,6 +15,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter;
use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
use function trim; use function trim;
class PassthroughFormatter implements Formatter class PassthroughFormatter implements Formatter
+1
View File
@@ -19,6 +19,7 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function preg_match; use function preg_match;
/** /**
+1
View File
@@ -11,6 +11,7 @@ use ReflectionClass;
use ReflectionException; use ReflectionException;
use ReflectionFunction; use ReflectionFunction;
use Throwable; use Throwable;
use function array_map; use function array_map;
use function get_class; use function get_class;
use function get_resource_type; use function get_resource_type;
+5 -2
View File
@@ -22,6 +22,7 @@ use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\Mixed_;
use phpDocumentor\Reflection\Types\Void_; use phpDocumentor\Reflection\Types\Void_;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_keys; use function array_keys;
use function explode; use function explode;
use function implode; use function implode;
@@ -100,7 +101,8 @@ final class Method extends BaseTag implements Factory\StaticMethod
// 5. then a word with underscores, followed by ( and any character // 5. then a word with underscores, followed by ( and any character
// until a ) and whitespace : as method name with signature // until a ) and whitespace : as method name with signature
// 6. any remaining text : as description // 6. any remaining text : as description
if (!preg_match( if (
!preg_match(
'/^ '/^
# Static keyword # Static keyword
# Declares a static method ONLY if type is also present # Declares a static method ONLY if type is also present
@@ -133,7 +135,8 @@ final class Method extends BaseTag implements Factory\StaticMethod
$/sux', $/sux',
$body, $body,
$matches $matches
)) { )
) {
return null; return null;
} }
+2
View File
@@ -20,11 +20,13 @@ use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_shift; use function array_shift;
use function array_unshift; use function array_unshift;
use function implode; use function implode;
use function strpos; use function strpos;
use function substr; use function substr;
use const PREG_SPLIT_DELIM_CAPTURE; use const PREG_SPLIT_DELIM_CAPTURE;
/** /**
+2
View File
@@ -20,11 +20,13 @@ use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_shift; use function array_shift;
use function array_unshift; use function array_unshift;
use function implode; use function implode;
use function strpos; use function strpos;
use function substr; use function substr;
use const PREG_SPLIT_DELIM_CAPTURE; use const PREG_SPLIT_DELIM_CAPTURE;
/** /**
+2
View File
@@ -20,11 +20,13 @@ use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_shift; use function array_shift;
use function array_unshift; use function array_unshift;
use function implode; use function implode;
use function strpos; use function strpos;
use function substr; use function substr;
use const PREG_SPLIT_DELIM_CAPTURE; use const PREG_SPLIT_DELIM_CAPTURE;
/** /**
+2
View File
@@ -20,11 +20,13 @@ use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_shift; use function array_shift;
use function array_unshift; use function array_unshift;
use function implode; use function implode;
use function strpos; use function strpos;
use function substr; use function substr;
use const PREG_SPLIT_DELIM_CAPTURE; use const PREG_SPLIT_DELIM_CAPTURE;
/** /**
+1
View File
@@ -23,6 +23,7 @@ use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_key_exists; use function array_key_exists;
use function explode; use function explode;
use function preg_match; use function preg_match;
+1
View File
@@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function preg_match; use function preg_match;
/** /**
+1
View File
@@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function preg_match; use function preg_match;
/** /**
+1
View File
@@ -14,6 +14,7 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\DocBlock\Tags; namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\Type;
use function in_array; use function in_array;
use function strlen; use function strlen;
use function substr; use function substr;
+1
View File
@@ -20,6 +20,7 @@ use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_key_exists; use function array_key_exists;
use function explode; use function explode;
+2
View File
@@ -20,11 +20,13 @@ use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_shift; use function array_shift;
use function array_unshift; use function array_unshift;
use function implode; use function implode;
use function strpos; use function strpos;
use function substr; use function substr;
use const PREG_SPLIT_DELIM_CAPTURE; use const PREG_SPLIT_DELIM_CAPTURE;
/** /**
+1
View File
@@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function preg_match; use function preg_match;
/** /**
+1
View File
@@ -20,6 +20,7 @@ use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\TagFactory; use phpDocumentor\Reflection\DocBlock\TagFactory;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function array_shift; use function array_shift;
use function count; use function count;
use function explode; use function explode;
+6
View File
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\Exception; namespace phpDocumentor\Reflection\Exception;
use InvalidArgumentException; use InvalidArgumentException;
use const PREG_BACKTRACK_LIMIT_ERROR; use const PREG_BACKTRACK_LIMIT_ERROR;
use const PREG_BAD_UTF8_ERROR; use const PREG_BAD_UTF8_ERROR;
use const PREG_BAD_UTF8_OFFSET_ERROR; use const PREG_BAD_UTF8_OFFSET_ERROR;
@@ -20,14 +21,19 @@ final class PcreException extends InvalidArgumentException
switch ($errorCode) { switch ($errorCode) {
case PREG_BACKTRACK_LIMIT_ERROR: case PREG_BACKTRACK_LIMIT_ERROR:
return new self('Backtrack limit error'); return new self('Backtrack limit error');
case PREG_RECURSION_LIMIT_ERROR: case PREG_RECURSION_LIMIT_ERROR:
return new self('Recursion limit error'); return new self('Recursion limit error');
case PREG_BAD_UTF8_ERROR: case PREG_BAD_UTF8_ERROR:
return new self('Bad UTF8 error'); return new self('Bad UTF8 error');
case PREG_BAD_UTF8_OFFSET_ERROR: case PREG_BAD_UTF8_OFFSET_ERROR:
return new self('Bad UTF8 offset error'); return new self('Bad UTF8 offset error');
case PREG_JIT_STACKLIMIT_ERROR: case PREG_JIT_STACKLIMIT_ERROR:
return new self('Jit stacklimit error'); return new self('Jit stacklimit error');
case PREG_NO_ERROR: case PREG_NO_ERROR:
case PREG_INTERNAL_ERROR: case PREG_INTERNAL_ERROR:
default: default:
+1
View File
@@ -14,6 +14,7 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection; namespace phpDocumentor\Reflection;
use phpDocumentor\Reflection\Exception\PcreException; use phpDocumentor\Reflection\Exception\PcreException;
use function preg_last_error; use function preg_last_error;
use function preg_split as php_preg_split; use function preg_split as php_preg_split;
@@ -8,6 +8,7 @@ use Exception;
use InvalidArgumentException; use InvalidArgumentException;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Throwable; use Throwable;
use function fopen; use function fopen;
use function serialize; use function serialize;
use function unserialize; use function unserialize;
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\Exception; namespace phpDocumentor\Reflection\Exception;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use const PREG_BACKTRACK_LIMIT_ERROR; use const PREG_BACKTRACK_LIMIT_ERROR;
use const PREG_BAD_UTF8_ERROR; use const PREG_BAD_UTF8_ERROR;
use const PREG_BAD_UTF8_OFFSET_ERROR; use const PREG_BAD_UTF8_OFFSET_ERROR;
+2
View File
@@ -6,7 +6,9 @@ namespace phpDocumentor\Reflection;
use phpDocumentor\Reflection\Exception\PcreException; use phpDocumentor\Reflection\Exception\PcreException;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use function set_error_handler; use function set_error_handler;
use const E_WARNING; use const E_WARNING;
final class PregSplitTest extends TestCase final class PregSplitTest extends TestCase