mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Fix code style and bump to php 7.4
This commit is contained in:
+7
-7
@@ -20,25 +20,25 @@ use Webmozart\Assert\Assert;
|
||||
final class DocBlock
|
||||
{
|
||||
/** @var string The opening line for this docblock. */
|
||||
private $summary;
|
||||
private string $summary;
|
||||
|
||||
/** @var DocBlock\Description The actual description for this docblock. */
|
||||
private $description;
|
||||
private DocBlock\Description $description;
|
||||
|
||||
/** @var Tag[] An array containing all the tags in this docblock; except inline. */
|
||||
private $tags = [];
|
||||
private array $tags = [];
|
||||
|
||||
/** @var Types\Context|null Information about the context of this DocBlock. */
|
||||
private $context;
|
||||
private ?Types\Context $context = null;
|
||||
|
||||
/** @var Location|null Information about the location of this DocBlock. */
|
||||
private $location;
|
||||
private ?Location $location = null;
|
||||
|
||||
/** @var bool Is this DocBlock (the start of) a template? */
|
||||
private $isTemplateStart;
|
||||
private bool $isTemplateStart;
|
||||
|
||||
/** @var bool Does this DocBlock signify the end of a DocBlock template? */
|
||||
private $isTemplateEnd;
|
||||
private bool $isTemplateEnd;
|
||||
|
||||
/**
|
||||
* @param DocBlock\Tag[] $tags
|
||||
|
||||
@@ -52,11 +52,10 @@ use function vsprintf;
|
||||
*/
|
||||
class Description
|
||||
{
|
||||
/** @var string */
|
||||
private $bodyTemplate;
|
||||
private string $bodyTemplate;
|
||||
|
||||
/** @var Tag[] */
|
||||
private $tags;
|
||||
private array $tags;
|
||||
|
||||
/**
|
||||
* Initializes a Description with its body (template) and a listing of the tags used in the body template.
|
||||
|
||||
@@ -48,8 +48,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
|
||||
*/
|
||||
class DescriptionFactory
|
||||
{
|
||||
/** @var Factory */
|
||||
private $tagFactory;
|
||||
private Factory $tagFactory;
|
||||
|
||||
/**
|
||||
* Initializes this factory with the means to construct (inline) tags.
|
||||
|
||||
@@ -31,11 +31,10 @@ use const DIRECTORY_SEPARATOR;
|
||||
*/
|
||||
class ExampleFinder
|
||||
{
|
||||
/** @var string */
|
||||
private $sourceDirectory = '';
|
||||
private string $sourceDirectory = '';
|
||||
|
||||
/** @var string[] */
|
||||
private $exampleDirectories = [];
|
||||
private array $exampleDirectories = [];
|
||||
|
||||
/**
|
||||
* Attempts to find the example contents for the given descriptor.
|
||||
|
||||
@@ -29,21 +29,20 @@ use function wordwrap;
|
||||
class Serializer
|
||||
{
|
||||
/** @var string The string to indent the comment with. */
|
||||
protected $indentString = ' ';
|
||||
protected string $indentString = ' ';
|
||||
|
||||
/** @var int The number of times the indent string is repeated. */
|
||||
protected $indent = 0;
|
||||
protected int $indent = 0;
|
||||
|
||||
/** @var bool Whether to indent the first line with the given indent amount and string. */
|
||||
protected $isFirstLineIndented = true;
|
||||
protected bool $isFirstLineIndented = true;
|
||||
|
||||
/** @var int|null The max length of a line. */
|
||||
protected $lineLength;
|
||||
protected ?int $lineLength = null;
|
||||
|
||||
/** @var Formatter A custom tag formatter. */
|
||||
protected $tagFormatter;
|
||||
/** @var string */
|
||||
private $lineEnding;
|
||||
protected Formatter $tagFormatter;
|
||||
private string $lineEnding;
|
||||
|
||||
/**
|
||||
* Create a Serializer instance.
|
||||
|
||||
@@ -79,7 +79,7 @@ final class StandardTagFactory implements TagFactory
|
||||
* @var array<class-string<Tag>|Factory> An array with a tag as a key, and an
|
||||
* FQCN to a class that handles it as an array value.
|
||||
*/
|
||||
private $tagHandlerMappings = [
|
||||
private array $tagHandlerMappings = [
|
||||
'author' => Author::class,
|
||||
'covers' => Covers::class,
|
||||
'deprecated' => Deprecated::class,
|
||||
@@ -105,22 +105,21 @@ final class StandardTagFactory implements TagFactory
|
||||
* @var array<class-string<Tag>> An array with a anotation s a key, and an
|
||||
* FQCN to a class that handles it as an array value.
|
||||
*/
|
||||
private $annotationMappings = [];
|
||||
private array $annotationMappings = [];
|
||||
|
||||
/**
|
||||
* @var ReflectionParameter[][] a lazy-loading cache containing parameters
|
||||
* for each tagHandler that has been used.
|
||||
*/
|
||||
private $tagHandlerParameterCache = [];
|
||||
private array $tagHandlerParameterCache = [];
|
||||
|
||||
/** @var FqsenResolver */
|
||||
private $fqsenResolver;
|
||||
private FqsenResolver $fqsenResolver;
|
||||
|
||||
/**
|
||||
* @var mixed[] an array representing a simple Service Locator where we can store parameters and
|
||||
* services that can be inserted into the Factory Methods of Tag Handlers.
|
||||
*/
|
||||
private $serviceLocator = [];
|
||||
private array $serviceLocator = [];
|
||||
|
||||
/**
|
||||
* Initialize this tag factory with the means to resolve an FQSEN and optionally a list of tag handlers.
|
||||
|
||||
@@ -27,13 +27,13 @@ use const FILTER_VALIDATE_EMAIL;
|
||||
final class Author extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string register that this is the author tag. */
|
||||
protected $name = 'author';
|
||||
protected string $name = 'author';
|
||||
|
||||
/** @var string The name of the author */
|
||||
private $authorName;
|
||||
private string $authorName;
|
||||
|
||||
/** @var string The email of the author */
|
||||
private $authorEmail;
|
||||
private string $authorEmail;
|
||||
|
||||
/**
|
||||
* Initializes this tag with the author name and e-mail.
|
||||
|
||||
@@ -22,10 +22,10 @@ use phpDocumentor\Reflection\DocBlock\Description;
|
||||
abstract class BaseTag implements DocBlock\Tag
|
||||
{
|
||||
/** @var string Name of the tag */
|
||||
protected $name = '';
|
||||
protected string $name = '';
|
||||
|
||||
/** @var Description|null Description of the tag. */
|
||||
protected $description;
|
||||
protected ?Description $description = null;
|
||||
|
||||
/**
|
||||
* Gets the name of this tag.
|
||||
|
||||
@@ -29,11 +29,9 @@ use function explode;
|
||||
*/
|
||||
final class Covers extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'covers';
|
||||
protected string $name = 'covers';
|
||||
|
||||
/** @var Fqsen */
|
||||
private $refers;
|
||||
private Fqsen $refers;
|
||||
|
||||
/**
|
||||
* Initializes this tag.
|
||||
|
||||
@@ -25,8 +25,7 @@ use function preg_match;
|
||||
*/
|
||||
final class Deprecated extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'deprecated';
|
||||
protected string $name = 'deprecated';
|
||||
|
||||
/**
|
||||
* PCRE regular expression matching a version vector.
|
||||
@@ -45,7 +44,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
|
||||
)';
|
||||
|
||||
/** @var string|null The version vector. */
|
||||
private $version;
|
||||
private ?string $version = null;
|
||||
|
||||
public function __construct(?string $version = null, ?Description $description = null)
|
||||
{
|
||||
|
||||
@@ -29,22 +29,19 @@ use function trim;
|
||||
final class Example implements Tag, Factory\StaticMethod
|
||||
{
|
||||
/** @var string Path to a file to use as an example. May also be an absolute URI. */
|
||||
private $filePath;
|
||||
private string $filePath;
|
||||
|
||||
/**
|
||||
* @var bool Whether the file path component represents an URI. This determines how the file portion
|
||||
* appears at {@link getContent()}.
|
||||
*/
|
||||
private $isURI;
|
||||
private bool $isURI;
|
||||
|
||||
/** @var int */
|
||||
private $startingLine;
|
||||
private int $startingLine;
|
||||
|
||||
/** @var int */
|
||||
private $lineCount;
|
||||
private int $lineCount;
|
||||
|
||||
/** @var string|null */
|
||||
private $content;
|
||||
private ?string $content = null;
|
||||
|
||||
public function __construct(
|
||||
string $filePath,
|
||||
|
||||
@@ -23,7 +23,7 @@ use function strlen;
|
||||
class AlignFormatter implements Formatter
|
||||
{
|
||||
/** @var int The maximum tag name length. */
|
||||
protected $maxLen = 0;
|
||||
protected int $maxLen = 0;
|
||||
|
||||
/**
|
||||
* @param Tag[] $tags All tags that should later be aligned with the formatter.
|
||||
|
||||
@@ -32,14 +32,11 @@ use function sprintf;
|
||||
*/
|
||||
final class InvalidTag implements Tag
|
||||
{
|
||||
/** @var string */
|
||||
private $name;
|
||||
private string $name;
|
||||
|
||||
/** @var string */
|
||||
private $body;
|
||||
private string $body;
|
||||
|
||||
/** @var Throwable|null */
|
||||
private $throwable;
|
||||
private ?Throwable $throwable = null;
|
||||
|
||||
private function __construct(string $name, string $body)
|
||||
{
|
||||
|
||||
@@ -24,11 +24,9 @@ use Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class Link extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'link';
|
||||
protected string $name = 'link';
|
||||
|
||||
/** @var string */
|
||||
private $link;
|
||||
private string $link;
|
||||
|
||||
/**
|
||||
* Initializes a link to a URL.
|
||||
|
||||
@@ -43,20 +43,15 @@ use const E_USER_DEPRECATED;
|
||||
*/
|
||||
final class Method extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'method';
|
||||
protected string $name = 'method';
|
||||
|
||||
/** @var string */
|
||||
private $methodName;
|
||||
private string $methodName;
|
||||
|
||||
/** @var bool */
|
||||
private $isStatic;
|
||||
private bool $isStatic;
|
||||
|
||||
/** @var Type */
|
||||
private $returnType;
|
||||
private Type $returnType;
|
||||
|
||||
/** @var bool */
|
||||
private $returnsReference;
|
||||
private bool $returnsReference;
|
||||
|
||||
/** @var MethodParameter[] */
|
||||
private array $parameters;
|
||||
|
||||
@@ -16,20 +16,15 @@ use phpDocumentor\Reflection\Type;
|
||||
|
||||
final class MethodParameter
|
||||
{
|
||||
/** @var Type */
|
||||
private $type;
|
||||
private Type $type;
|
||||
|
||||
/** @var bool */
|
||||
private $isReference;
|
||||
private bool $isReference;
|
||||
|
||||
/** @var bool */
|
||||
private $isVariadic;
|
||||
private bool $isVariadic;
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
private string $name;
|
||||
|
||||
/** @var string|null */
|
||||
private $defaultValue;
|
||||
private ?string $defaultValue = null;
|
||||
|
||||
public function __construct(
|
||||
string $name,
|
||||
|
||||
@@ -36,14 +36,13 @@ use const PREG_SPLIT_DELIM_CAPTURE;
|
||||
*/
|
||||
final class Param extends TagWithType implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string|null */
|
||||
private $variableName;
|
||||
private ?string $variableName = null;
|
||||
|
||||
/** @var bool determines whether this is a variadic argument */
|
||||
private $isVariadic;
|
||||
private bool $isVariadic;
|
||||
|
||||
/** @var bool determines whether this is passed by reference */
|
||||
private $isReference;
|
||||
private bool $isReference;
|
||||
|
||||
public function __construct(
|
||||
?string $variableName,
|
||||
|
||||
@@ -36,8 +36,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
|
||||
*/
|
||||
final class Property extends TagWithType implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string|null */
|
||||
protected $variableName;
|
||||
protected ?string $variableName = null;
|
||||
|
||||
public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null)
|
||||
{
|
||||
|
||||
@@ -36,8 +36,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
|
||||
*/
|
||||
final class PropertyRead extends TagWithType implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string|null */
|
||||
protected $variableName;
|
||||
protected ?string $variableName = null;
|
||||
|
||||
public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null)
|
||||
{
|
||||
|
||||
@@ -36,8 +36,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
|
||||
*/
|
||||
final class PropertyWrite extends TagWithType implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $variableName;
|
||||
protected string $variableName;
|
||||
|
||||
public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null)
|
||||
{
|
||||
|
||||
@@ -20,8 +20,7 @@ use phpDocumentor\Reflection\Fqsen as RealFqsen;
|
||||
*/
|
||||
final class Fqsen implements Reference
|
||||
{
|
||||
/** @var RealFqsen */
|
||||
private $fqsen;
|
||||
private RealFqsen $fqsen;
|
||||
|
||||
public function __construct(RealFqsen $fqsen)
|
||||
{
|
||||
|
||||
@@ -20,8 +20,7 @@ use Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class Url implements Reference
|
||||
{
|
||||
/** @var string */
|
||||
private $uri;
|
||||
private string $uri;
|
||||
|
||||
public function __construct(string $uri)
|
||||
{
|
||||
|
||||
@@ -33,11 +33,9 @@ use function preg_match;
|
||||
*/
|
||||
final class See extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'see';
|
||||
protected string $name = 'see';
|
||||
|
||||
/** @var Reference */
|
||||
protected $refers;
|
||||
protected Reference $refers;
|
||||
|
||||
/**
|
||||
* Initializes this tag.
|
||||
|
||||
@@ -25,8 +25,7 @@ use function preg_match;
|
||||
*/
|
||||
final class Since extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'since';
|
||||
protected string $name = 'since';
|
||||
|
||||
/**
|
||||
* PCRE regular expression matching a version vector.
|
||||
@@ -45,7 +44,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
|
||||
)';
|
||||
|
||||
/** @var string|null The version vector. */
|
||||
private $version;
|
||||
private ?string $version = null;
|
||||
|
||||
public function __construct(?string $version = null, ?Description $description = null)
|
||||
{
|
||||
|
||||
@@ -25,14 +25,13 @@ use function preg_match;
|
||||
*/
|
||||
final class Source extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'source';
|
||||
protected string $name = 'source';
|
||||
|
||||
/** @var int The starting line, relative to the structural element's location. */
|
||||
private $startingLine;
|
||||
private int $startingLine;
|
||||
|
||||
/** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */
|
||||
private $lineCount;
|
||||
private ?int $lineCount = null;
|
||||
|
||||
/**
|
||||
* @param int|string $startingLine should be a to int convertible value
|
||||
|
||||
@@ -23,7 +23,7 @@ use function trim;
|
||||
abstract class TagWithType extends BaseTag
|
||||
{
|
||||
/** @var ?Type */
|
||||
protected $type;
|
||||
protected ?Type $type = null;
|
||||
|
||||
/**
|
||||
* Returns the type section of the variable.
|
||||
|
||||
@@ -29,11 +29,9 @@ use function explode;
|
||||
*/
|
||||
final class Uses extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'uses';
|
||||
protected string $name = 'uses';
|
||||
|
||||
/** @var Fqsen */
|
||||
protected $refers;
|
||||
protected Fqsen $refers;
|
||||
|
||||
/**
|
||||
* Initializes this tag.
|
||||
|
||||
@@ -36,8 +36,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
|
||||
*/
|
||||
final class Var_ extends TagWithType implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string|null */
|
||||
protected $variableName = '';
|
||||
protected ?string $variableName = '';
|
||||
|
||||
public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null)
|
||||
{
|
||||
|
||||
@@ -25,8 +25,7 @@ use function preg_match;
|
||||
*/
|
||||
final class Version extends BaseTag implements Factory\StaticMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $name = 'version';
|
||||
protected string $name = 'version';
|
||||
|
||||
/**
|
||||
* PCRE regular expression matching a version vector.
|
||||
@@ -45,7 +44,7 @@ final class Version extends BaseTag implements Factory\StaticMethod
|
||||
)';
|
||||
|
||||
/** @var string|null The version vector. */
|
||||
private $version;
|
||||
private ?string $version = null;
|
||||
|
||||
public function __construct(?string $version = null, ?Description $description = null)
|
||||
{
|
||||
|
||||
@@ -44,11 +44,9 @@ use function trim;
|
||||
|
||||
final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
{
|
||||
/** @var DocBlock\DescriptionFactory */
|
||||
private $descriptionFactory;
|
||||
private DocBlock\DescriptionFactory $descriptionFactory;
|
||||
|
||||
/** @var TagFactory */
|
||||
private $tagFactory;
|
||||
private TagFactory $tagFactory;
|
||||
|
||||
/**
|
||||
* Initializes this factory with the required subcontractors.
|
||||
|
||||
Reference in New Issue
Block a user