Skip to content

Commit a607236

Browse files
committed
CS: no whitespace before return type colon
1 parent 2a1aba8 commit a607236

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+522
-522
lines changed

src/DocBlock.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,28 @@ public function __construct(
6969
$this->isTemplateStart = $isTemplateStart;
7070
}
7171

72-
public function getSummary() : string
72+
public function getSummary(): string
7373
{
7474
return $this->summary;
7575
}
7676

77-
public function getDescription() : DocBlock\Description
77+
public function getDescription(): DocBlock\Description
7878
{
7979
return $this->description;
8080
}
8181

8282
/**
8383
* Returns the current context.
8484
*/
85-
public function getContext() : ?Types\Context
85+
public function getContext(): ?Types\Context
8686
{
8787
return $this->context;
8888
}
8989

9090
/**
9191
* Returns the current location.
9292
*/
93-
public function getLocation() : ?Location
93+
public function getLocation(): ?Location
9494
{
9595
return $this->location;
9696
}
@@ -114,7 +114,7 @@ public function getLocation() : ?Location
114114
*
115115
* @see self::isTemplateEnd() for the check whether a closing marker was provided.
116116
*/
117-
public function isTemplateStart() : bool
117+
public function isTemplateStart(): bool
118118
{
119119
return $this->isTemplateStart;
120120
}
@@ -124,7 +124,7 @@ public function isTemplateStart() : bool
124124
*
125125
* @see self::isTemplateStart() for a more complete description of the Docblock Template functionality.
126126
*/
127-
public function isTemplateEnd() : bool
127+
public function isTemplateEnd(): bool
128128
{
129129
return $this->isTemplateEnd;
130130
}
@@ -134,7 +134,7 @@ public function isTemplateEnd() : bool
134134
*
135135
* @return Tag[]
136136
*/
137-
public function getTags() : array
137+
public function getTags(): array
138138
{
139139
return $this->tags;
140140
}
@@ -147,7 +147,7 @@ public function getTags() : array
147147
*
148148
* @return Tag[]
149149
*/
150-
public function getTagsByName(string $name) : array
150+
public function getTagsByName(string $name): array
151151
{
152152
$result = [];
153153

@@ -170,7 +170,7 @@ public function getTagsByName(string $name) : array
170170
*
171171
* @return TagWithType[]
172172
*/
173-
public function getTagsWithTypeByName(string $name) : array
173+
public function getTagsWithTypeByName(string $name): array
174174
{
175175
$result = [];
176176

@@ -190,7 +190,7 @@ public function getTagsWithTypeByName(string $name) : array
190190
*
191191
* @param string $name Tag name to check for.
192192
*/
193-
public function hasTag(string $name) : bool
193+
public function hasTag(string $name): bool
194194
{
195195
foreach ($this->getTags() as $tag) {
196196
if ($tag->getName() === $name) {
@@ -206,7 +206,7 @@ public function hasTag(string $name) : bool
206206
*
207207
* @param Tag $tagToRemove The tag to remove.
208208
*/
209-
public function removeTag(Tag $tagToRemove) : void
209+
public function removeTag(Tag $tagToRemove): void
210210
{
211211
foreach ($this->tags as $key => $tag) {
212212
if ($tag === $tagToRemove) {
@@ -221,7 +221,7 @@ public function removeTag(Tag $tagToRemove) : void
221221
*
222222
* @param Tag $tag The tag to add.
223223
*/
224-
private function addTag(Tag $tag) : void
224+
private function addTag(Tag $tag): void
225225
{
226226
$this->tags[] = $tag;
227227
}

src/DocBlock/Description.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct(string $bodyTemplate, array $tags = [])
7171
/**
7272
* Returns the body template.
7373
*/
74-
public function getBodyTemplate() : string
74+
public function getBodyTemplate(): string
7575
{
7676
return $this->bodyTemplate;
7777
}
@@ -81,7 +81,7 @@ public function getBodyTemplate() : string
8181
*
8282
* @return Tag[]
8383
*/
84-
public function getTags() : array
84+
public function getTags(): array
8585
{
8686
return $this->tags;
8787
}
@@ -90,7 +90,7 @@ public function getTags() : array
9090
* Renders this description as a string where the provided formatter will format the tags in the expected string
9191
* format.
9292
*/
93-
public function render(?Formatter $formatter = null) : string
93+
public function render(?Formatter $formatter = null): string
9494
{
9595
if ($formatter === null) {
9696
$formatter = new PassthroughFormatter();
@@ -107,7 +107,7 @@ public function render(?Formatter $formatter = null) : string
107107
/**
108108
* Returns a plain string representation of this description.
109109
*/
110-
public function __toString() : string
110+
public function __toString(): string
111111
{
112112
return $this->render();
113113
}

src/DocBlock/DescriptionFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(TagFactory $tagFactory)
6060
/**
6161
* Returns the parsed text of this description.
6262
*/
63-
public function create(string $contents, ?TypeContext $context = null) : Description
63+
public function create(string $contents, ?TypeContext $context = null): Description
6464
{
6565
$tokens = $this->lex($contents);
6666
$count = count($tokens);
@@ -88,7 +88,7 @@ public function create(string $contents, ?TypeContext $context = null) : Descrip
8888
*
8989
* @return string[] A series of tokens of which the description text is composed.
9090
*/
91-
private function lex(string $contents) : array
91+
private function lex(string $contents): array
9292
{
9393
$contents = $this->removeSuperfluousStartingWhitespace($contents);
9494

@@ -142,7 +142,7 @@ private function lex(string $contents) : array
142142
* If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent
143143
* lines and this may cause rendering issues when, for example, using a Markdown converter.
144144
*/
145-
private function removeSuperfluousStartingWhitespace(string $contents) : string
145+
private function removeSuperfluousStartingWhitespace(string $contents): string
146146
{
147147
$lines = explode("\n", $contents);
148148

src/DocBlock/ExampleFinder.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ExampleFinder
3838
/**
3939
* Attempts to find the example contents for the given descriptor.
4040
*/
41-
public function find(Example $example) : string
41+
public function find(Example $example): string
4242
{
4343
$filename = $example->getFilePath();
4444

@@ -53,15 +53,15 @@ public function find(Example $example) : string
5353
/**
5454
* Registers the project's root directory where an 'examples' folder can be expected.
5555
*/
56-
public function setSourceDirectory(string $directory = '') : void
56+
public function setSourceDirectory(string $directory = ''): void
5757
{
5858
$this->sourceDirectory = $directory;
5959
}
6060

6161
/**
6262
* Returns the project's root directory where an 'examples' folder can be expected.
6363
*/
64-
public function getSourceDirectory() : string
64+
public function getSourceDirectory(): string
6565
{
6666
return $this->sourceDirectory;
6767
}
@@ -71,7 +71,7 @@ public function getSourceDirectory() : string
7171
*
7272
* @param string[] $directories
7373
*/
74-
public function setExampleDirectories(array $directories) : void
74+
public function setExampleDirectories(array $directories): void
7575
{
7676
$this->exampleDirectories = $directories;
7777
}
@@ -81,7 +81,7 @@ public function setExampleDirectories(array $directories) : void
8181
*
8282
* @return string[]
8383
*/
84-
public function getExampleDirectories() : array
84+
public function getExampleDirectories(): array
8585
{
8686
return $this->exampleDirectories;
8787
}
@@ -99,7 +99,7 @@ public function getExampleDirectories() : array
9999
*
100100
* @return string[] all lines of the example file
101101
*/
102-
private function getExampleFileContents(string $filename) : ?array
102+
private function getExampleFileContents(string $filename): ?array
103103
{
104104
$normalizedPath = null;
105105

@@ -129,23 +129,23 @@ private function getExampleFileContents(string $filename) : ?array
129129
/**
130130
* Get example filepath based on the example directory inside your project.
131131
*/
132-
private function getExamplePathFromExampleDirectory(string $file) : string
132+
private function getExamplePathFromExampleDirectory(string $file): string
133133
{
134134
return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file;
135135
}
136136

137137
/**
138138
* Returns a path to the example file in the given directory..
139139
*/
140-
private function constructExamplePath(string $directory, string $file) : string
140+
private function constructExamplePath(string $directory, string $file): string
141141
{
142142
return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file;
143143
}
144144

145145
/**
146146
* Get example filepath based on sourcecode.
147147
*/
148-
private function getExamplePathFromSource(string $file) : string
148+
private function getExamplePathFromSource(string $file): string
149149
{
150150
return sprintf(
151151
'%s%s%s',

src/DocBlock/Serializer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __construct(
7272
*
7373
* @return string The serialized doc block.
7474
*/
75-
public function getDocComment(DocBlock $docblock) : string
75+
public function getDocComment(DocBlock $docblock): string
7676
{
7777
$indent = str_repeat($this->indentString, $this->indent);
7878
$firstIndent = $this->isFirstLineIndented ? $indent : '';
@@ -98,7 +98,7 @@ public function getDocComment(DocBlock $docblock) : string
9898
return $comment . $indent . ' */';
9999
}
100100

101-
private function removeTrailingSpaces(string $indent, string $text) : string
101+
private function removeTrailingSpaces(string $indent, string $text): string
102102
{
103103
return str_replace(
104104
sprintf("\n%s * \n", $indent),
@@ -107,7 +107,7 @@ private function removeTrailingSpaces(string $indent, string $text) : string
107107
);
108108
}
109109

110-
private function addAsterisksForEachLine(string $indent, string $text) : string
110+
private function addAsterisksForEachLine(string $indent, string $text): string
111111
{
112112
return str_replace(
113113
"\n",
@@ -116,7 +116,7 @@ private function addAsterisksForEachLine(string $indent, string $text) : string
116116
);
117117
}
118118

119-
private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength) : string
119+
private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength): string
120120
{
121121
$text = $docblock->getSummary() . ((string) $docblock->getDescription() ? "\n\n" . $docblock->getDescription()
122122
: '');
@@ -129,7 +129,7 @@ private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wra
129129
return $text;
130130
}
131131

132-
private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment) : string
132+
private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment): string
133133
{
134134
foreach ($docblock->getTags() as $tag) {
135135
$tagText = $this->tagFormatter->format($tag);

src/DocBlock/StandardTagFactory.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function __construct(FqsenResolver $fqsenResolver, ?array $tagHandlers =
137137
$this->addService($fqsenResolver, FqsenResolver::class);
138138
}
139139

140-
public function create(string $tagLine, ?TypeContext $context = null) : Tag
140+
public function create(string $tagLine, ?TypeContext $context = null): Tag
141141
{
142142
if (!$context) {
143143
$context = new TypeContext('');
@@ -151,17 +151,17 @@ public function create(string $tagLine, ?TypeContext $context = null) : Tag
151151
/**
152152
* @param mixed $value
153153
*/
154-
public function addParameter(string $name, $value) : void
154+
public function addParameter(string $name, $value): void
155155
{
156156
$this->serviceLocator[$name] = $value;
157157
}
158158

159-
public function addService(object $service, ?string $alias = null) : void
159+
public function addService(object $service, ?string $alias = null): void
160160
{
161161
$this->serviceLocator[$alias ?: get_class($service)] = $service;
162162
}
163163

164-
public function registerTagHandler(string $tagName, string $handler) : void
164+
public function registerTagHandler(string $tagName, string $handler): void
165165
{
166166
Assert::stringNotEmpty($tagName);
167167
Assert::classExists($handler);
@@ -181,7 +181,7 @@ public function registerTagHandler(string $tagName, string $handler) : void
181181
*
182182
* @return string[]
183183
*/
184-
private function extractTagParts(string $tagLine) : array
184+
private function extractTagParts(string $tagLine): array
185185
{
186186
$matches = [];
187187
if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{])\s*([^\s].*)|$)/us', $tagLine, $matches)) {
@@ -201,7 +201,7 @@ private function extractTagParts(string $tagLine) : array
201201
* Creates a new tag object with the given name and body or returns null if the tag name was recognized but the
202202
* body was invalid.
203203
*/
204-
private function createTag(string $body, string $name, TypeContext $context) : Tag
204+
private function createTag(string $body, string $name, TypeContext $context): Tag
205205
{
206206
$handlerClassName = $this->findHandlerClassName($name, $context);
207207
$arguments = $this->getArgumentsForParametersFromWiring(
@@ -226,7 +226,7 @@ private function createTag(string $body, string $name, TypeContext $context) : T
226226
*
227227
* @return class-string<Tag>
228228
*/
229-
private function findHandlerClassName(string $tagName, TypeContext $context) : string
229+
private function findHandlerClassName(string $tagName, TypeContext $context): string
230230
{
231231
$handlerClassName = Generic::class;
232232
if (isset($this->tagHandlerMappings[$tagName])) {
@@ -251,7 +251,7 @@ private function findHandlerClassName(string $tagName, TypeContext $context) : s
251251
* @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters
252252
* is provided with this method.
253253
*/
254-
private function getArgumentsForParametersFromWiring(array $parameters, array $locator) : array
254+
private function getArgumentsForParametersFromWiring(array $parameters, array $locator): array
255255
{
256256
$arguments = [];
257257
foreach ($parameters as $parameter) {
@@ -292,7 +292,7 @@ private function getArgumentsForParametersFromWiring(array $parameters, array $l
292292
*
293293
* @return ReflectionParameter[]
294294
*/
295-
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName) : array
295+
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName): array
296296
{
297297
if (!isset($this->tagHandlerParameterCache[$handlerClassName])) {
298298
$methodReflection = new ReflectionMethod($handlerClassName, 'create');
@@ -319,7 +319,7 @@ private function getServiceLocatorWithDynamicParameters(
319319
TypeContext $context,
320320
string $tagName,
321321
string $tagBody
322-
) : array {
322+
): array {
323323
return array_merge(
324324
$this->serviceLocator,
325325
[
@@ -335,7 +335,7 @@ private function getServiceLocatorWithDynamicParameters(
335335
*
336336
* @todo this method should be populated once we implement Annotation notation support.
337337
*/
338-
private function isAnnotation(string $tagContent) : bool
338+
private function isAnnotation(string $tagContent): bool
339339
{
340340
// 1. Contains a namespace separator
341341
// 2. Contains parenthesis

0 commit comments

Comments
 (0)