Skip to content

Commit 1c8f795

Browse files
committed
apply coding standard to code
1 parent 89a0935 commit 1c8f795

Some content is hidden

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

45 files changed

+212
-216
lines changed

src/DocBlock/DescriptionFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private function parse($tokens, ?TypeContext $context = null): array
112112
{
113113
$count = count($tokens);
114114
$tagCount = 0;
115-
$tags = [];
115+
$tags = [];
116116

117117
for ($i = 1; $i < $count; $i += 2) {
118118
$tags[] = $this->tagFactory->create($tokens[$i], $context);
@@ -156,7 +156,7 @@ private function removeSuperfluousStartingWhitespace(string $contents): string
156156

157157
// determine how many whitespace characters need to be stripped
158158
$startingSpaceCount = 9999999;
159-
for ($i = 1; $i < count($lines); $i++) {
159+
for ($i = 1; $i < count($lines); ++$i) {
160160
// lines with a no length do not count as they are not indented at all
161161
if (strlen(trim($lines[$i])) === 0) {
162162
continue;
@@ -169,7 +169,7 @@ private function removeSuperfluousStartingWhitespace(string $contents): string
169169

170170
// strip the number of spaces from each line
171171
if ($startingSpaceCount > 0) {
172-
for ($i = 1; $i < count($lines); $i++) {
172+
for ($i = 1; $i < count($lines); ++$i) {
173173
$lines[$i] = substr($lines[$i], $startingSpaceCount);
174174
}
175175
}

src/DocBlock/Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function addAsterisksForEachLine($indent, $text)
105105

106106
private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength): string
107107
{
108-
$text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription()
108+
$text = $docblock->getSummary() . ((string) $docblock->getDescription() ? "\n\n" . $docblock->getDescription()
109109
: '');
110110
if ($wrapLength !== null) {
111111
$text = wordwrap($text, $wrapLength);

src/DocBlock/StandardTagFactory.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,25 @@ final class StandardTagFactory implements TagFactory
4545
* @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value.
4646
*/
4747
private $tagHandlerMappings = [
48-
'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author',
49-
'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers',
50-
'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated',
48+
'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author',
49+
'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers',
50+
'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated',
5151
// 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example',
52-
'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link',
53-
'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method',
54-
'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param',
55-
'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead',
56-
'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property',
52+
'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link',
53+
'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method',
54+
'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param',
55+
'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead',
56+
'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property',
5757
'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite',
58-
'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_',
59-
'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See',
60-
'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since',
61-
'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source',
62-
'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
63-
'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
64-
'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses',
65-
'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_',
66-
'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version'
58+
'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_',
59+
'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See',
60+
'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since',
61+
'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source',
62+
'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
63+
'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws',
64+
'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses',
65+
'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_',
66+
'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version',
6767
];
6868

6969
/**
@@ -186,7 +186,7 @@ private function extractTagParts(string $tagLine)
186186
private function createTag(string $body, string $name, TypeContext $context): ?Tag
187187
{
188188
$handlerClassName = $this->findHandlerClassName($name, $context);
189-
$arguments = $this->getArgumentsForParametersFromWiring(
189+
$arguments = $this->getArgumentsForParametersFromWiring(
190190
$this->fetchParametersForHandlerFactoryMethod($handlerClassName),
191191
$this->getServiceLocatorWithDynamicParameters($context, $name, $body)
192192
);
@@ -254,7 +254,7 @@ private function getArgumentsForParametersFromWiring($parameters, $locator)
254254
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName)
255255
{
256256
if (! isset($this->tagHandlerParameterCache[$handlerClassName])) {
257-
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
257+
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
258258
$this->tagHandlerParameterCache[$handlerClassName] = $methodReflection->getParameters();
259259
}
260260

@@ -276,9 +276,9 @@ private function getServiceLocatorWithDynamicParameters(TypeContext $context, st
276276
$locator = array_merge(
277277
$this->serviceLocator,
278278
[
279-
'name' => $tagName,
280-
'body' => $tagBody,
281-
TypeContext::class => $context
279+
'name' => $tagName,
280+
'body' => $tagBody,
281+
TypeContext::class => $context,
282282
]
283283
);
284284

src/DocBlock/Tags/Author.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(string $authorName, string $authorEmail)
3636
throw new \InvalidArgumentException('The author tag does not have a valid e-mail address');
3737
}
3838

39-
$this->authorName = $authorName;
39+
$this->authorName = $authorName;
4040
$this->authorEmail = $authorEmail;
4141
}
4242

src/DocBlock/Tags/Example.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getContent()
6969
if ($this->isURI) {
7070
$filePath = $this->isUriRelative($this->filePath)
7171
? str_replace('%2F', '/', rawurlencode($this->filePath))
72-
:$this->filePath;
72+
: $this->filePath;
7373
}
7474

7575
return trim($filePath . ' ' . parent::getDescription());
@@ -89,25 +89,25 @@ public static function create(string $body)
8989
}
9090

9191
$filePath = null;
92-
$fileUri = null;
92+
$fileUri = null;
9393
if ('' !== $matches[1]) {
9494
$filePath = $matches[1];
9595
} else {
9696
$fileUri = $matches[2];
9797
}
9898

9999
$startingLine = 1;
100-
$lineCount = null;
101-
$description = null;
100+
$lineCount = null;
101+
$description = null;
102102

103103
if (array_key_exists(3, $matches)) {
104104
$description = $matches[3];
105105

106106
// Starting line / Number of lines / Description
107107
if (preg_match('/^([1-9]\d*)(?:\s+((?1))\s*)?(.*)$/sux', $matches[3], $contentMatches)) {
108-
$startingLine = (int)$contentMatches[1];
108+
$startingLine = (int) $contentMatches[1];
109109
if (isset($contentMatches[2]) && $contentMatches[2] !== '') {
110-
$lineCount = (int)$contentMatches[2];
110+
$lineCount = (int) $contentMatches[2];
111111
}
112112

113113
if (array_key_exists(3, $contentMatches)) {
@@ -117,7 +117,7 @@ public static function create(string $body)
117117
}
118118

119119
return new static(
120-
$filePath !== null?$filePath:$fileUri,
120+
$filePath !== null ? $filePath : $fileUri,
121121
$fileUri !== null,
122122
$startingLine,
123123
$lineCount,

src/DocBlock/Tags/Formatter/AlignFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function __construct(array $tags)
3939
*/
4040
public function format(Tag $tag): string
4141
{
42-
return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string)$tag;
42+
return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string) $tag;
4343
}
4444
}

src/DocBlock/Tags/Formatter/PassthroughFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ class PassthroughFormatter implements Formatter
2323
*/
2424
public function format(Tag $tag): string
2525
{
26-
return trim('@' . $tag->getName() . ' ' . (string)$tag);
26+
return trim('@' . $tag->getName() . ' ' . (string) $tag);
2727
}
2828
}

src/DocBlock/Tags/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(string $link, ?Description $description = null)
4040
/**
4141
* {@inheritdoc}
4242
*/
43-
public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): Link
43+
public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self
4444
{
4545
Assert::notNull($descriptionFactory);
4646

src/DocBlock/Tags/Method.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public function __construct(
5454
$returnType = new Void_();
5555
}
5656

57-
$this->methodName = $methodName;
58-
$this->arguments = $this->filterArguments($arguments);
59-
$this->returnType = $returnType;
60-
$this->isStatic = $static;
57+
$this->methodName = $methodName;
58+
$this->arguments = $this->filterArguments($arguments);
59+
$this->returnType = $returnType;
60+
$this->isStatic = $static;
6161
$this->description = $description;
6262
}
6363

@@ -71,7 +71,7 @@ public static function create(
7171
?TypeContext $context = null
7272
): ?self {
7373
Assert::stringNotEmpty($body);
74-
Assert::allNotNull([ $typeResolver, $descriptionFactory ]);
74+
Assert::allNotNull([$typeResolver, $descriptionFactory]);
7575

7676
// 1. none or more whitespace
7777
// 2. optionally the keyword "static" followed by whitespace
@@ -131,7 +131,7 @@ public static function create(
131131
$returnType = 'void';
132132
}
133133

134-
$returnType = $typeResolver->resolve($returnType, $context);
134+
$returnType = $typeResolver->resolve($returnType, $context);
135135
$description = $descriptionFactory->create($description, $context);
136136

137137
if (is_string($arguments) && strlen($arguments) > 0) {
@@ -150,7 +150,7 @@ public static function create(
150150
}
151151
}
152152

153-
$argument = [ 'name' => $argumentName, 'type' => $argumentType];
153+
$argument = ['name' => $argumentName, 'type' => $argumentType];
154154
}
155155
} else {
156156
$arguments = [];
@@ -198,7 +198,7 @@ public function __toString(): string
198198
}
199199

200200
return trim(($this->isStatic() ? 'static ' : '')
201-
. (string)$this->returnType . ' '
201+
. (string) $this->returnType . ' '
202202
. $this->methodName
203203
. '(' . implode(', ', $arguments) . ')'
204204
. ($this->description ? ' ' . $this->description->render() : ''));
@@ -208,7 +208,7 @@ private function filterArguments($arguments)
208208
{
209209
foreach ($arguments as &$argument) {
210210
if (is_string($argument)) {
211-
$argument = [ 'name' => $argument ];
211+
$argument = ['name' => $argument];
212212
}
213213

214214
if (! isset($argument['type'])) {
@@ -217,7 +217,7 @@ private function filterArguments($arguments)
217217

218218
$keys = array_keys($argument);
219219
sort($keys);
220-
if ($keys !== [ 'name', 'type' ]) {
220+
if ($keys !== ['name', 'type']) {
221221
throw new \InvalidArgumentException(
222222
'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true)
223223
);

src/DocBlock/Tags/Reference/Fqsen.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ public function __construct(RealFqsen $fqsen)
3838
*/
3939
public function __toString(): string
4040
{
41-
return (string)$this->fqsen;
41+
return (string) $this->fqsen;
4242
}
4343
}

0 commit comments

Comments
 (0)