mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
CS: no whitespace before return type colon
This commit is contained in:
+12
-12
@@ -69,12 +69,12 @@ final class DocBlock
|
||||
$this->isTemplateStart = $isTemplateStart;
|
||||
}
|
||||
|
||||
public function getSummary() : string
|
||||
public function getSummary(): string
|
||||
{
|
||||
return $this->summary;
|
||||
}
|
||||
|
||||
public function getDescription() : DocBlock\Description
|
||||
public function getDescription(): DocBlock\Description
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ final class DocBlock
|
||||
/**
|
||||
* Returns the current context.
|
||||
*/
|
||||
public function getContext() : ?Types\Context
|
||||
public function getContext(): ?Types\Context
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ final class DocBlock
|
||||
/**
|
||||
* Returns the current location.
|
||||
*/
|
||||
public function getLocation() : ?Location
|
||||
public function getLocation(): ?Location
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ final class DocBlock
|
||||
*
|
||||
* @see self::isTemplateEnd() for the check whether a closing marker was provided.
|
||||
*/
|
||||
public function isTemplateStart() : bool
|
||||
public function isTemplateStart(): bool
|
||||
{
|
||||
return $this->isTemplateStart;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ final class DocBlock
|
||||
*
|
||||
* @see self::isTemplateStart() for a more complete description of the Docblock Template functionality.
|
||||
*/
|
||||
public function isTemplateEnd() : bool
|
||||
public function isTemplateEnd(): bool
|
||||
{
|
||||
return $this->isTemplateEnd;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ final class DocBlock
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTags() : array
|
||||
public function getTags(): array
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ final class DocBlock
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTagsByName(string $name) : array
|
||||
public function getTagsByName(string $name): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
@@ -170,7 +170,7 @@ final class DocBlock
|
||||
*
|
||||
* @return TagWithType[]
|
||||
*/
|
||||
public function getTagsWithTypeByName(string $name) : array
|
||||
public function getTagsWithTypeByName(string $name): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
@@ -190,7 +190,7 @@ final class DocBlock
|
||||
*
|
||||
* @param string $name Tag name to check for.
|
||||
*/
|
||||
public function hasTag(string $name) : bool
|
||||
public function hasTag(string $name): bool
|
||||
{
|
||||
foreach ($this->getTags() as $tag) {
|
||||
if ($tag->getName() === $name) {
|
||||
@@ -206,7 +206,7 @@ final class DocBlock
|
||||
*
|
||||
* @param Tag $tagToRemove The tag to remove.
|
||||
*/
|
||||
public function removeTag(Tag $tagToRemove) : void
|
||||
public function removeTag(Tag $tagToRemove): void
|
||||
{
|
||||
foreach ($this->tags as $key => $tag) {
|
||||
if ($tag === $tagToRemove) {
|
||||
@@ -221,7 +221,7 @@ final class DocBlock
|
||||
*
|
||||
* @param Tag $tag The tag to add.
|
||||
*/
|
||||
private function addTag(Tag $tag) : void
|
||||
private function addTag(Tag $tag): void
|
||||
{
|
||||
$this->tags[] = $tag;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class Description
|
||||
/**
|
||||
* Returns the body template.
|
||||
*/
|
||||
public function getBodyTemplate() : string
|
||||
public function getBodyTemplate(): string
|
||||
{
|
||||
return $this->bodyTemplate;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ class Description
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTags() : array
|
||||
public function getTags(): array
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ class Description
|
||||
* Renders this description as a string where the provided formatter will format the tags in the expected string
|
||||
* format.
|
||||
*/
|
||||
public function render(?Formatter $formatter = null) : string
|
||||
public function render(?Formatter $formatter = null): string
|
||||
{
|
||||
if ($formatter === null) {
|
||||
$formatter = new PassthroughFormatter();
|
||||
@@ -107,7 +107,7 @@ class Description
|
||||
/**
|
||||
* Returns a plain string representation of this description.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->render();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class DescriptionFactory
|
||||
/**
|
||||
* Returns the parsed text of this description.
|
||||
*/
|
||||
public function create(string $contents, ?TypeContext $context = null) : Description
|
||||
public function create(string $contents, ?TypeContext $context = null): Description
|
||||
{
|
||||
$tokens = $this->lex($contents);
|
||||
$count = count($tokens);
|
||||
@@ -88,7 +88,7 @@ class DescriptionFactory
|
||||
*
|
||||
* @return string[] A series of tokens of which the description text is composed.
|
||||
*/
|
||||
private function lex(string $contents) : array
|
||||
private function lex(string $contents): array
|
||||
{
|
||||
$contents = $this->removeSuperfluousStartingWhitespace($contents);
|
||||
|
||||
@@ -142,7 +142,7 @@ class DescriptionFactory
|
||||
* If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent
|
||||
* lines and this may cause rendering issues when, for example, using a Markdown converter.
|
||||
*/
|
||||
private function removeSuperfluousStartingWhitespace(string $contents) : string
|
||||
private function removeSuperfluousStartingWhitespace(string $contents): string
|
||||
{
|
||||
$lines = explode("\n", $contents);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class ExampleFinder
|
||||
/**
|
||||
* Attempts to find the example contents for the given descriptor.
|
||||
*/
|
||||
public function find(Example $example) : string
|
||||
public function find(Example $example): string
|
||||
{
|
||||
$filename = $example->getFilePath();
|
||||
|
||||
@@ -53,7 +53,7 @@ class ExampleFinder
|
||||
/**
|
||||
* Registers the project's root directory where an 'examples' folder can be expected.
|
||||
*/
|
||||
public function setSourceDirectory(string $directory = '') : void
|
||||
public function setSourceDirectory(string $directory = ''): void
|
||||
{
|
||||
$this->sourceDirectory = $directory;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class ExampleFinder
|
||||
/**
|
||||
* Returns the project's root directory where an 'examples' folder can be expected.
|
||||
*/
|
||||
public function getSourceDirectory() : string
|
||||
public function getSourceDirectory(): string
|
||||
{
|
||||
return $this->sourceDirectory;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class ExampleFinder
|
||||
*
|
||||
* @param string[] $directories
|
||||
*/
|
||||
public function setExampleDirectories(array $directories) : void
|
||||
public function setExampleDirectories(array $directories): void
|
||||
{
|
||||
$this->exampleDirectories = $directories;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ class ExampleFinder
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getExampleDirectories() : array
|
||||
public function getExampleDirectories(): array
|
||||
{
|
||||
return $this->exampleDirectories;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class ExampleFinder
|
||||
*
|
||||
* @return string[] all lines of the example file
|
||||
*/
|
||||
private function getExampleFileContents(string $filename) : ?array
|
||||
private function getExampleFileContents(string $filename): ?array
|
||||
{
|
||||
$normalizedPath = null;
|
||||
|
||||
@@ -129,7 +129,7 @@ class ExampleFinder
|
||||
/**
|
||||
* Get example filepath based on the example directory inside your project.
|
||||
*/
|
||||
private function getExamplePathFromExampleDirectory(string $file) : string
|
||||
private function getExamplePathFromExampleDirectory(string $file): string
|
||||
{
|
||||
return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ class ExampleFinder
|
||||
/**
|
||||
* Returns a path to the example file in the given directory..
|
||||
*/
|
||||
private function constructExamplePath(string $directory, string $file) : string
|
||||
private function constructExamplePath(string $directory, string $file): string
|
||||
{
|
||||
return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ class ExampleFinder
|
||||
/**
|
||||
* Get example filepath based on sourcecode.
|
||||
*/
|
||||
private function getExamplePathFromSource(string $file) : string
|
||||
private function getExamplePathFromSource(string $file): string
|
||||
{
|
||||
return sprintf(
|
||||
'%s%s%s',
|
||||
|
||||
@@ -72,7 +72,7 @@ class Serializer
|
||||
*
|
||||
* @return string The serialized doc block.
|
||||
*/
|
||||
public function getDocComment(DocBlock $docblock) : string
|
||||
public function getDocComment(DocBlock $docblock): string
|
||||
{
|
||||
$indent = str_repeat($this->indentString, $this->indent);
|
||||
$firstIndent = $this->isFirstLineIndented ? $indent : '';
|
||||
@@ -98,7 +98,7 @@ class Serializer
|
||||
return $comment . $indent . ' */';
|
||||
}
|
||||
|
||||
private function removeTrailingSpaces(string $indent, string $text) : string
|
||||
private function removeTrailingSpaces(string $indent, string $text): string
|
||||
{
|
||||
return str_replace(
|
||||
sprintf("\n%s * \n", $indent),
|
||||
@@ -107,7 +107,7 @@ class Serializer
|
||||
);
|
||||
}
|
||||
|
||||
private function addAsterisksForEachLine(string $indent, string $text) : string
|
||||
private function addAsterisksForEachLine(string $indent, string $text): string
|
||||
{
|
||||
return str_replace(
|
||||
"\n",
|
||||
@@ -116,7 +116,7 @@ class Serializer
|
||||
);
|
||||
}
|
||||
|
||||
private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength) : string
|
||||
private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength): string
|
||||
{
|
||||
$text = $docblock->getSummary() . ((string) $docblock->getDescription() ? "\n\n" . $docblock->getDescription()
|
||||
: '');
|
||||
@@ -129,7 +129,7 @@ class Serializer
|
||||
return $text;
|
||||
}
|
||||
|
||||
private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment) : string
|
||||
private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment): string
|
||||
{
|
||||
foreach ($docblock->getTags() as $tag) {
|
||||
$tagText = $this->tagFormatter->format($tag);
|
||||
|
||||
@@ -137,7 +137,7 @@ final class StandardTagFactory implements TagFactory
|
||||
$this->addService($fqsenResolver, FqsenResolver::class);
|
||||
}
|
||||
|
||||
public function create(string $tagLine, ?TypeContext $context = null) : Tag
|
||||
public function create(string $tagLine, ?TypeContext $context = null): Tag
|
||||
{
|
||||
if (!$context) {
|
||||
$context = new TypeContext('');
|
||||
@@ -151,17 +151,17 @@ final class StandardTagFactory implements TagFactory
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function addParameter(string $name, $value) : void
|
||||
public function addParameter(string $name, $value): void
|
||||
{
|
||||
$this->serviceLocator[$name] = $value;
|
||||
}
|
||||
|
||||
public function addService(object $service, ?string $alias = null) : void
|
||||
public function addService(object $service, ?string $alias = null): void
|
||||
{
|
||||
$this->serviceLocator[$alias ?: get_class($service)] = $service;
|
||||
}
|
||||
|
||||
public function registerTagHandler(string $tagName, string $handler) : void
|
||||
public function registerTagHandler(string $tagName, string $handler): void
|
||||
{
|
||||
Assert::stringNotEmpty($tagName);
|
||||
Assert::classExists($handler);
|
||||
@@ -181,7 +181,7 @@ final class StandardTagFactory implements TagFactory
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
private function extractTagParts(string $tagLine) : array
|
||||
private function extractTagParts(string $tagLine): array
|
||||
{
|
||||
$matches = [];
|
||||
if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{])\s*([^\s].*)|$)/us', $tagLine, $matches)) {
|
||||
@@ -201,7 +201,7 @@ final class StandardTagFactory implements TagFactory
|
||||
* Creates a new tag object with the given name and body or returns null if the tag name was recognized but the
|
||||
* body was invalid.
|
||||
*/
|
||||
private function createTag(string $body, string $name, TypeContext $context) : Tag
|
||||
private function createTag(string $body, string $name, TypeContext $context): Tag
|
||||
{
|
||||
$handlerClassName = $this->findHandlerClassName($name, $context);
|
||||
$arguments = $this->getArgumentsForParametersFromWiring(
|
||||
@@ -226,7 +226,7 @@ final class StandardTagFactory implements TagFactory
|
||||
*
|
||||
* @return class-string<Tag>
|
||||
*/
|
||||
private function findHandlerClassName(string $tagName, TypeContext $context) : string
|
||||
private function findHandlerClassName(string $tagName, TypeContext $context): string
|
||||
{
|
||||
$handlerClassName = Generic::class;
|
||||
if (isset($this->tagHandlerMappings[$tagName])) {
|
||||
@@ -251,7 +251,7 @@ final class StandardTagFactory implements TagFactory
|
||||
* @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters
|
||||
* is provided with this method.
|
||||
*/
|
||||
private function getArgumentsForParametersFromWiring(array $parameters, array $locator) : array
|
||||
private function getArgumentsForParametersFromWiring(array $parameters, array $locator): array
|
||||
{
|
||||
$arguments = [];
|
||||
foreach ($parameters as $parameter) {
|
||||
@@ -292,7 +292,7 @@ final class StandardTagFactory implements TagFactory
|
||||
*
|
||||
* @return ReflectionParameter[]
|
||||
*/
|
||||
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName) : array
|
||||
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName): array
|
||||
{
|
||||
if (!isset($this->tagHandlerParameterCache[$handlerClassName])) {
|
||||
$methodReflection = new ReflectionMethod($handlerClassName, 'create');
|
||||
@@ -319,7 +319,7 @@ final class StandardTagFactory implements TagFactory
|
||||
TypeContext $context,
|
||||
string $tagName,
|
||||
string $tagBody
|
||||
) : array {
|
||||
): array {
|
||||
return array_merge(
|
||||
$this->serviceLocator,
|
||||
[
|
||||
@@ -335,7 +335,7 @@ final class StandardTagFactory implements TagFactory
|
||||
*
|
||||
* @todo this method should be populated once we implement Annotation notation support.
|
||||
*/
|
||||
private function isAnnotation(string $tagContent) : bool
|
||||
private function isAnnotation(string $tagContent): bool
|
||||
{
|
||||
// 1. Contains a namespace separator
|
||||
// 2. Contains parenthesis
|
||||
|
||||
@@ -17,7 +17,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
||||
|
||||
interface Tag
|
||||
{
|
||||
public function getName() : string;
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* @return Tag|mixed Class that implements Tag
|
||||
@@ -26,7 +26,7 @@ interface Tag
|
||||
*/
|
||||
public static function create(string $body);
|
||||
|
||||
public function render(?Formatter $formatter = null) : string;
|
||||
public function render(?Formatter $formatter = null): string;
|
||||
|
||||
public function __toString() : string;
|
||||
public function __toString(): string;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ interface TagFactory
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function addParameter(string $name, $value) : void;
|
||||
public function addParameter(string $name, $value): void;
|
||||
|
||||
/**
|
||||
* Factory method responsible for instantiating the correct sub type.
|
||||
@@ -49,7 +49,7 @@ interface TagFactory
|
||||
*
|
||||
* @throws InvalidArgumentException If an invalid tag line was presented.
|
||||
*/
|
||||
public function create(string $tagLine, ?TypeContext $context = null) : Tag;
|
||||
public function create(string $tagLine, ?TypeContext $context = null): Tag;
|
||||
|
||||
/**
|
||||
* Registers a service with the Service Locator using the FQCN of the class or the alias, if provided.
|
||||
@@ -60,7 +60,7 @@ interface TagFactory
|
||||
* Because interfaces are regularly used as type-hints this method provides an alias parameter; if the FQCN of the
|
||||
* interface is passed as alias then every time that interface is requested the provided service will be returned.
|
||||
*/
|
||||
public function addService(object $service) : void;
|
||||
public function addService(object $service): void;
|
||||
|
||||
/**
|
||||
* Registers a handler for tags.
|
||||
@@ -80,5 +80,5 @@ interface TagFactory
|
||||
* @throws InvalidArgumentException If the handler is not an existing class.
|
||||
* @throws InvalidArgumentException If the handler does not implement the {@see Tag} interface.
|
||||
*/
|
||||
public function registerTagHandler(string $tagName, string $handler) : void;
|
||||
public function registerTagHandler(string $tagName, string $handler): void;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ final class Author extends BaseTag implements Factory\StaticMethod
|
||||
*
|
||||
* @return string The author's name.
|
||||
*/
|
||||
public function getAuthorName() : string
|
||||
public function getAuthorName(): string
|
||||
{
|
||||
return $this->authorName;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ final class Author extends BaseTag implements Factory\StaticMethod
|
||||
*
|
||||
* @return string The author's email.
|
||||
*/
|
||||
public function getEmail() : string
|
||||
public function getEmail(): string
|
||||
{
|
||||
return $this->authorEmail;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ final class Author extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns this tag in string form.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->authorEmail) {
|
||||
$authorEmail = '<' . $this->authorEmail . '>';
|
||||
@@ -85,7 +85,7 @@ final class Author extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Attempts to create a new Author object based on the tag body.
|
||||
*/
|
||||
public static function create(string $body) : ?self
|
||||
public static function create(string $body): ?self
|
||||
{
|
||||
$splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches);
|
||||
if (!$splitTagContent) {
|
||||
|
||||
@@ -32,17 +32,17 @@ abstract class BaseTag implements DocBlock\Tag
|
||||
*
|
||||
* @return string The name of this tag.
|
||||
*/
|
||||
public function getName() : string
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription() : ?Description
|
||||
public function getDescription(): ?Description
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function render(?Formatter $formatter = null) : string
|
||||
public function render(?Formatter $formatter = null): string
|
||||
{
|
||||
if ($formatter === null) {
|
||||
$formatter = new Formatter\PassthroughFormatter();
|
||||
|
||||
@@ -48,7 +48,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?FqsenResolver $resolver = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($descriptionFactory);
|
||||
Assert::notNull($resolver);
|
||||
@@ -61,7 +61,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod
|
||||
);
|
||||
}
|
||||
|
||||
private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen
|
||||
private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen
|
||||
{
|
||||
Assert::notNull($fqsenResolver);
|
||||
$fqsenParts = explode('::', $parts);
|
||||
@@ -77,7 +77,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the structural element this tag refers to.
|
||||
*/
|
||||
public function getReference() : Fqsen
|
||||
public function getReference(): Fqsen
|
||||
{
|
||||
return $this->refers;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation of this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -61,7 +61,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
|
||||
?string $body,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
if (empty($body)) {
|
||||
return new static();
|
||||
}
|
||||
@@ -85,7 +85,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Gets the version section of the tag.
|
||||
*/
|
||||
public function getVersion() : ?string
|
||||
public function getVersion(): ?string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -66,7 +66,7 @@ final class Example implements Tag, Factory\StaticMethod
|
||||
$this->isURI = $isURI;
|
||||
}
|
||||
|
||||
public function getContent() : string
|
||||
public function getContent(): string
|
||||
{
|
||||
if ($this->content === null || $this->content === '') {
|
||||
$filePath = $this->filePath;
|
||||
@@ -82,12 +82,12 @@ final class Example implements Tag, Factory\StaticMethod
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
public function getDescription() : ?string
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
public static function create(string $body) : ?Tag
|
||||
public static function create(string $body): ?Tag
|
||||
{
|
||||
// File component: File path in quotes or File URI / Source information
|
||||
if (!preg_match('/^\s*(?:(\"[^\"]+\")|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) {
|
||||
@@ -137,7 +137,7 @@ final class Example implements Tag, Factory\StaticMethod
|
||||
* @return string Path to a file to use as an example.
|
||||
* May also be an absolute URI.
|
||||
*/
|
||||
public function getFilePath() : string
|
||||
public function getFilePath(): string
|
||||
{
|
||||
return trim($this->filePath, '"');
|
||||
}
|
||||
@@ -145,7 +145,7 @@ final class Example implements Tag, Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
$filePath = (string) $this->filePath;
|
||||
$isDefaultLine = $this->startingLine === 1 && $this->lineCount === 0;
|
||||
@@ -168,27 +168,27 @@ final class Example implements Tag, Factory\StaticMethod
|
||||
/**
|
||||
* Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute).
|
||||
*/
|
||||
private function isUriRelative(string $uri) : bool
|
||||
private function isUriRelative(string $uri): bool
|
||||
{
|
||||
return strpos($uri, ':') === false;
|
||||
}
|
||||
|
||||
public function getStartingLine() : int
|
||||
public function getStartingLine(): int
|
||||
{
|
||||
return $this->startingLine;
|
||||
}
|
||||
|
||||
public function getLineCount() : int
|
||||
public function getLineCount(): int
|
||||
{
|
||||
return $this->lineCount;
|
||||
}
|
||||
|
||||
public function getName() : string
|
||||
public function getName(): string
|
||||
{
|
||||
return 'example';
|
||||
}
|
||||
|
||||
public function render(?Formatter $formatter = null) : string
|
||||
public function render(?Formatter $formatter = null): string
|
||||
{
|
||||
if ($formatter === null) {
|
||||
$formatter = new Formatter\PassthroughFormatter();
|
||||
|
||||
@@ -20,5 +20,5 @@ interface Formatter
|
||||
/**
|
||||
* Formats a tag into a string representation according to a specific format, such as Markdown.
|
||||
*/
|
||||
public function format(Tag $tag) : string;
|
||||
public function format(Tag $tag): string;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class AlignFormatter implements Formatter
|
||||
/**
|
||||
* Formats the given tag to return a simple plain text version.
|
||||
*/
|
||||
public function format(Tag $tag) : string
|
||||
public function format(Tag $tag): string
|
||||
{
|
||||
return '@' . $tag->getName() .
|
||||
str_repeat(
|
||||
|
||||
@@ -22,7 +22,7 @@ class PassthroughFormatter implements Formatter
|
||||
/**
|
||||
* Formats the given tag to return a simple plain text version.
|
||||
*/
|
||||
public function format(Tag $tag) : string
|
||||
public function format(Tag $tag): string
|
||||
{
|
||||
return trim('@' . $tag->getName() . ' ' . $tag);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ final class Generic extends BaseTag implements Factory\StaticMethod
|
||||
string $name = '',
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::stringNotEmpty($name);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
@@ -62,7 +62,7 @@ final class Generic extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the tag as a serialized string
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
@@ -76,7 +76,7 @@ final class Generic extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Validates if the tag name matches the expected format, otherwise throws an exception.
|
||||
*/
|
||||
private function validateTagName(string $name) : void
|
||||
private function validateTagName(string $name): void
|
||||
{
|
||||
if (!preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) {
|
||||
throw new InvalidArgumentException(
|
||||
|
||||
@@ -46,22 +46,22 @@ final class InvalidTag implements Tag
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
public function getException() : ?Throwable
|
||||
public function getException(): ?Throwable
|
||||
{
|
||||
return $this->throwable;
|
||||
}
|
||||
|
||||
public function getName() : string
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public static function create(string $body, string $name = '') : self
|
||||
public static function create(string $body, string $name = ''): self
|
||||
{
|
||||
return new self($name, $body);
|
||||
}
|
||||
|
||||
public function withError(Throwable $exception) : self
|
||||
public function withError(Throwable $exception): self
|
||||
{
|
||||
$this->flattenExceptionBacktrace($exception);
|
||||
$tag = new self($this->name, $this->body);
|
||||
@@ -76,7 +76,7 @@ final class InvalidTag implements Tag
|
||||
* Not all objects are serializable. So we need to remove them from the
|
||||
* stored exception to be sure that we do not break existing library usage.
|
||||
*/
|
||||
private function flattenExceptionBacktrace(Throwable $exception) : void
|
||||
private function flattenExceptionBacktrace(Throwable $exception): void
|
||||
{
|
||||
$traceProperty = (new ReflectionClass(Exception::class))->getProperty('trace');
|
||||
$traceProperty->setAccessible(true);
|
||||
@@ -85,7 +85,7 @@ final class InvalidTag implements Tag
|
||||
$trace = $exception->getTrace();
|
||||
if (isset($trace[0]['args'])) {
|
||||
$trace = array_map(
|
||||
function (array $call) : array {
|
||||
function (array $call): array {
|
||||
$call['args'] = array_map([$this, 'flattenArguments'], $call['args']);
|
||||
|
||||
return $call;
|
||||
@@ -128,7 +128,7 @@ final class InvalidTag implements Tag
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function render(?Formatter $formatter = null) : string
|
||||
public function render(?Formatter $formatter = null): string
|
||||
{
|
||||
if ($formatter === null) {
|
||||
$formatter = new Formatter\PassthroughFormatter();
|
||||
@@ -137,7 +137,7 @@ final class InvalidTag implements Tag
|
||||
return $formatter->format($this);
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ final class Link extends BaseTag implements Factory\StaticMethod
|
||||
string $body,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
$parts = Utils::pregSplit('/\s+/Su', $body, 2);
|
||||
@@ -55,7 +55,7 @@ final class Link extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Gets the link
|
||||
*/
|
||||
public function getLink() : string
|
||||
public function getLink(): string
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ final class Link extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -86,7 +86,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : ?self {
|
||||
): ?self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($typeResolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
@@ -176,7 +176,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Retrieves the method name.
|
||||
*/
|
||||
public function getMethodName() : string
|
||||
public function getMethodName(): string
|
||||
{
|
||||
return $this->methodName;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
*
|
||||
* @phpstan-return array<int, array{name: string, type: Type}>
|
||||
*/
|
||||
public function getArguments() : array
|
||||
public function getArguments(): array
|
||||
{
|
||||
return $this->arguments;
|
||||
}
|
||||
@@ -196,17 +196,17 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
*
|
||||
* @return bool TRUE if the method declaration is for a static method, FALSE otherwise.
|
||||
*/
|
||||
public function isStatic() : bool
|
||||
public function isStatic(): bool
|
||||
{
|
||||
return $this->isStatic;
|
||||
}
|
||||
|
||||
public function getReturnType() : Type
|
||||
public function getReturnType(): Type
|
||||
{
|
||||
return $this->returnType;
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
$arguments = [];
|
||||
foreach ($this->arguments as $argument) {
|
||||
@@ -242,7 +242,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
* @phpstan-param array<int, array{name: string, type: Type}|string> $arguments
|
||||
* @phpstan-return array<int, array{name: string, type: Type}>
|
||||
*/
|
||||
private function filterArguments(array $arguments = []) : array
|
||||
private function filterArguments(array $arguments = []): array
|
||||
{
|
||||
$result = [];
|
||||
foreach ($arguments as $argument) {
|
||||
@@ -268,7 +268,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
return $result;
|
||||
}
|
||||
|
||||
private static function stripRestArg(string $argument) : string
|
||||
private static function stripRestArg(string $argument): string
|
||||
{
|
||||
if (strpos($argument, '...') === 0) {
|
||||
$argument = trim(substr($argument, 3));
|
||||
|
||||
@@ -61,7 +61,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($typeResolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
@@ -114,7 +114,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*/
|
||||
public function getVariableName() : ?string
|
||||
public function getVariableName(): ?string
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns whether this tag is variadic.
|
||||
*/
|
||||
public function isVariadic() : bool
|
||||
public function isVariadic(): bool
|
||||
{
|
||||
return $this->isVariadic;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns whether this tag is passed by reference.
|
||||
*/
|
||||
public function isReference() : bool
|
||||
public function isReference(): bool
|
||||
{
|
||||
return $this->isReference;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
@@ -159,7 +159,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
|
||||
. ($description !== '' ? ($type !== '' || $variableName !== '' ? ' ' : '') . $description : '');
|
||||
}
|
||||
|
||||
private static function strStartsWithVariable(string $str) : bool
|
||||
private static function strStartsWithVariable(string $str): bool
|
||||
{
|
||||
return strpos($str, '$') === 0
|
||||
||
|
||||
|
||||
@@ -50,7 +50,7 @@ final class Property extends TagWithType implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($typeResolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
@@ -88,7 +88,7 @@ final class Property extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*/
|
||||
public function getVariableName() : ?string
|
||||
public function getVariableName(): ?string
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ final class Property extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -50,7 +50,7 @@ final class PropertyRead extends TagWithType implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($typeResolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
@@ -88,7 +88,7 @@ final class PropertyRead extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*/
|
||||
public function getVariableName() : ?string
|
||||
public function getVariableName(): ?string
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ final class PropertyRead extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -50,7 +50,7 @@ final class PropertyWrite extends TagWithType implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($typeResolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
@@ -88,7 +88,7 @@ final class PropertyWrite extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*/
|
||||
public function getVariableName() : ?string
|
||||
public function getVariableName(): ?string
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ final class PropertyWrite extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -31,7 +31,7 @@ final class Fqsen implements Reference
|
||||
/**
|
||||
* @return string string representation of the referenced fqsen
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->fqsen;
|
||||
}
|
||||
|
||||
@@ -18,5 +18,5 @@ namespace phpDocumentor\Reflection\DocBlock\Tags\Reference;
|
||||
*/
|
||||
interface Reference
|
||||
{
|
||||
public function __toString() : string;
|
||||
public function __toString(): string;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ final class Url implements Reference
|
||||
$this->uri = $uri;
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ final class Return_ extends TagWithType implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::notNull($typeResolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
@@ -49,7 +49,7 @@ final class Return_ extends TagWithType implements Factory\StaticMethod
|
||||
return new static($type, $description);
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -52,7 +52,7 @@ final class See extends BaseTag implements Factory\StaticMethod
|
||||
?FqsenResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
$parts = Utils::pregSplit('/\s+/Su', $body, 2);
|
||||
@@ -66,7 +66,7 @@ final class See extends BaseTag implements Factory\StaticMethod
|
||||
return new static(new FqsenRef(self::resolveFqsen($parts[0], $typeResolver, $context)), $description);
|
||||
}
|
||||
|
||||
private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen
|
||||
private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen
|
||||
{
|
||||
Assert::notNull($fqsenResolver);
|
||||
$fqsenParts = explode('::', $parts);
|
||||
@@ -82,7 +82,7 @@ final class See extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the ref of this tag.
|
||||
*/
|
||||
public function getReference() : Reference
|
||||
public function getReference(): Reference
|
||||
{
|
||||
return $this->refers;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ final class See extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation of this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -58,7 +58,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
|
||||
?string $body,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : ?self {
|
||||
): ?self {
|
||||
if (empty($body)) {
|
||||
return new static();
|
||||
}
|
||||
@@ -79,7 +79,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Gets the version section of the tag.
|
||||
*/
|
||||
public function getVersion() : ?string
|
||||
public function getVersion(): ?string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -51,7 +51,7 @@ final class Source extends BaseTag implements Factory\StaticMethod
|
||||
string $body,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
@@ -78,7 +78,7 @@ final class Source extends BaseTag implements Factory\StaticMethod
|
||||
* @return int The starting line, relative to the structural element's
|
||||
* location.
|
||||
*/
|
||||
public function getStartingLine() : int
|
||||
public function getStartingLine(): int
|
||||
{
|
||||
return $this->startingLine;
|
||||
}
|
||||
@@ -89,12 +89,12 @@ final class Source extends BaseTag implements Factory\StaticMethod
|
||||
* @return int|null The number of lines, relative to the starting line. NULL
|
||||
* means "to the end".
|
||||
*/
|
||||
public function getLineCount() : ?int
|
||||
public function getLineCount(): ?int
|
||||
{
|
||||
return $this->lineCount;
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -27,7 +27,7 @@ abstract class TagWithType extends BaseTag
|
||||
/**
|
||||
* Returns the type section of the variable.
|
||||
*/
|
||||
public function getType() : ?Type
|
||||
public function getType(): ?Type
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ abstract class TagWithType extends BaseTag
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
protected static function extractTypeFromBody(string $body) : array
|
||||
protected static function extractTypeFromBody(string $body): array
|
||||
{
|
||||
$type = '';
|
||||
$nestingLevel = 0;
|
||||
|
||||
@@ -37,7 +37,7 @@ final class Throws extends TagWithType implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::notNull($typeResolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
@@ -49,7 +49,7 @@ final class Throws extends TagWithType implements Factory\StaticMethod
|
||||
return new static($type, $description);
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -48,7 +48,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod
|
||||
?FqsenResolver $resolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::notNull($resolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
@@ -60,7 +60,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod
|
||||
);
|
||||
}
|
||||
|
||||
private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen
|
||||
private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen
|
||||
{
|
||||
Assert::notNull($fqsenResolver);
|
||||
$fqsenParts = explode('::', $parts);
|
||||
@@ -76,7 +76,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the structural element this tag refers to.
|
||||
*/
|
||||
public function getReference() : Fqsen
|
||||
public function getReference(): Fqsen
|
||||
{
|
||||
return $this->refers;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation of this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -50,7 +50,7 @@ final class Var_ extends TagWithType implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : self {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($typeResolver);
|
||||
Assert::notNull($descriptionFactory);
|
||||
@@ -89,7 +89,7 @@ final class Var_ extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns the variable's name.
|
||||
*/
|
||||
public function getVariableName() : ?string
|
||||
public function getVariableName(): ?string
|
||||
{
|
||||
return $this->variableName;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ final class Var_ extends TagWithType implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -58,7 +58,7 @@ final class Version extends BaseTag implements Factory\StaticMethod
|
||||
?string $body,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) : ?self {
|
||||
): ?self {
|
||||
if (empty($body)) {
|
||||
return new static();
|
||||
}
|
||||
@@ -82,7 +82,7 @@ final class Version extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Gets the version section of the tag.
|
||||
*/
|
||||
public function getVersion() : ?string
|
||||
public function getVersion(): ?string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ final class Version extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* Returns a string representation for this tag.
|
||||
*/
|
||||
public function __toString() : string
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->description) {
|
||||
$description = $this->description->render();
|
||||
|
||||
@@ -54,7 +54,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
*
|
||||
* @param array<string, class-string<Tag>> $additionalTags
|
||||
*/
|
||||
public static function createInstance(array $additionalTags = []) : self
|
||||
public static function createInstance(array $additionalTags = []): self
|
||||
{
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
@@ -75,7 +75,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
* @param object|string $docblock A string containing the DocBlock to parse or an object supporting the
|
||||
* getDocComment method (such as a ReflectionClass object).
|
||||
*/
|
||||
public function create($docblock, ?Types\Context $context = null, ?Location $location = null) : DocBlock
|
||||
public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock
|
||||
{
|
||||
if (is_object($docblock)) {
|
||||
if (!method_exists($docblock, 'getDocComment')) {
|
||||
@@ -112,7 +112,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
/**
|
||||
* @param class-string<Tag> $handler
|
||||
*/
|
||||
public function registerTagHandler(string $tagName, string $handler) : void
|
||||
public function registerTagHandler(string $tagName, string $handler): void
|
||||
{
|
||||
$this->tagFactory->registerTagHandler($tagName, $handler);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
*
|
||||
* @param string $comment String containing the comment text.
|
||||
*/
|
||||
private function stripDocComment(string $comment) : string
|
||||
private function stripDocComment(string $comment): string
|
||||
{
|
||||
$comment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]?(.*)?#u', '$1', $comment);
|
||||
Assert::string($comment);
|
||||
@@ -231,7 +231,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
*
|
||||
* @return DocBlock\Tag[]
|
||||
*/
|
||||
private function parseTagBlock(string $tags, Types\Context $context) : array
|
||||
private function parseTagBlock(string $tags, Types\Context $context): array
|
||||
{
|
||||
$tags = $this->filterTagBlock($tags);
|
||||
if ($tags === null) {
|
||||
@@ -250,7 +250,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function splitTagBlockIntoTagLines(string $tags) : array
|
||||
private function splitTagBlockIntoTagLines(string $tags): array
|
||||
{
|
||||
$result = [];
|
||||
foreach (explode("\n", $tags) as $tagLine) {
|
||||
@@ -264,7 +264,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function filterTagBlock(string $tags) : ?string
|
||||
private function filterTagBlock(string $tags): ?string
|
||||
{
|
||||
$tags = trim($tags);
|
||||
if (!$tags) {
|
||||
|
||||
@@ -14,10 +14,10 @@ interface DocBlockFactoryInterface
|
||||
*
|
||||
* @param array<string, class-string<Tag>> $additionalTags
|
||||
*/
|
||||
public static function createInstance(array $additionalTags = []) : DocBlockFactory;
|
||||
public static function createInstance(array $additionalTags = []): DocBlockFactory;
|
||||
|
||||
/**
|
||||
* @param string|object $docblock
|
||||
*/
|
||||
public function create($docblock, ?Types\Context $context = null, ?Location $location = null) : DocBlock;
|
||||
public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ use const PREG_RECURSION_LIMIT_ERROR;
|
||||
|
||||
final class PcreException extends InvalidArgumentException
|
||||
{
|
||||
public static function createFromPhpError(int $errorCode) : self
|
||||
public static function createFromPhpError(int $errorCode): self
|
||||
{
|
||||
switch ($errorCode) {
|
||||
case PREG_BACKTRACK_LIMIT_ERROR:
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ abstract class Utils
|
||||
*
|
||||
* @throws PcreException
|
||||
*/
|
||||
public static function pregSplit(string $pattern, string $subject, ?int $limit = -1, int $flags = 0) : array
|
||||
public static function pregSplit(string $pattern, string $subject, ?int $limit = -1, int $flags = 0): array
|
||||
{
|
||||
$parts = php_preg_split($pattern, $subject, $limit, $flags);
|
||||
if ($parts === false) {
|
||||
|
||||
Reference in New Issue
Block a user