Skip to content

Commit 442ea28

Browse files
committed
styles fix
1 parent 533de86 commit 442ea28

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

src/Ast/Comment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
class Comment
66
{
7-
/**
8-
* @var string
9-
*/
7+
8+
/** @var string */
109
protected $text;
1110

1211
/** @var int */
@@ -15,7 +14,8 @@ class Comment
1514
/** @var int */
1615
protected $startIndex;
1716

18-
public function __construct(string $text, int $startLine = -1, int $startIndex = -1) {
17+
public function __construct(string $text, int $startLine = -1, int $startIndex = -1)
18+
{
1919
$this->text = $text;
2020
$this->startLine = $startLine;
2121
$this->startIndex = $startIndex;

src/Parser/TypeParser.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function parse(TokenIterator $tokens): Ast\Type\TypeNode
7979
*/
8080
public function enrichWithAttributes(TokenIterator $tokens, Ast\Node $type, int $startLine, int $startIndex, array $comments = []): Ast\Node
8181
{
82-
if($tokens->currentTokenType() == Lexer::TOKEN_COMMENT) {
82+
if ($tokens->currentTokenType() === Lexer::TOKEN_COMMENT) {
8383
$comments[] = new Ast\Comment(
8484
$tokens->currentTokenValue(),
8585
$tokens->currentTokenLine(),
@@ -158,7 +158,6 @@ private function parseAtomic(TokenIterator $tokens): Ast\Type\TypeNode
158158
return $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex);
159159
}
160160

161-
162161
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_THIS_VARIABLE)) {
163162
$type = $this->enrichWithAttributes($tokens, new Ast\Type\ThisTypeNode(), $startLine, $startIndex);
164163

@@ -774,21 +773,19 @@ private function parseArrayShape(TokenIterator $tokens, Ast\Type\TypeNode $type,
774773
$comments = [];
775774

776775
do {
777-
while(1) {
778-
if($tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL)){
776+
while (1) {
777+
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL)) {
779778
continue;
780-
}
781-
else if($tokens->currentTokenType() == Lexer::TOKEN_COMMENT) {
779+
} elseif ($tokens->currentTokenType() === Lexer::TOKEN_COMMENT) {
782780
$comments[] = new Ast\Comment($tokens->currentTokenValue(), $tokens->currentTokenLine(), $tokens->currentTokenIndex());
783781
$tokens->next();
784-
}
785-
else {
782+
} else {
786783
break;
787784
}
788-
};
785+
}
789786

790787
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET)) {
791-
return new Ast\Type\ArrayShapeNode($items, true, $kind);
788+
return new Ast\Type\ArrayShapeNode($items, true, $kind);
792789
}
793790

794791
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC)) {

tests/PHPStan/Parser/TypeParserTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,27 +178,27 @@ public function provideParseData(): array
178178

179179
[
180180
'string // with comment after',
181-
new IdentifierTypeNode('string'),
181+
new IdentifierTypeNode('string'),
182182
],
183183
[
184-
'string',
185-
new IdentifierTypeNode('string'),
184+
'string',
185+
new IdentifierTypeNode('string'),
186186
],
187187
[
188-
' string ',
189-
new IdentifierTypeNode('string'),
188+
' string ',
189+
new IdentifierTypeNode('string'),
190190
],
191191
[
192-
' ( string ) ',
193-
new IdentifierTypeNode('string'),
192+
' ( string ) ',
193+
new IdentifierTypeNode('string'),
194194
],
195195
[
196-
'( ( string ) )',
197-
new IdentifierTypeNode('string'),
196+
'( ( string ) )',
197+
new IdentifierTypeNode('string'),
198198
],
199199
[
200-
'\\Foo\Bar\\Baz',
201-
new IdentifierTypeNode('\\Foo\Bar\\Baz'),
200+
'\\Foo\Bar\\Baz',
201+
new IdentifierTypeNode('\\Foo\Bar\\Baz'),
202202
],
203203
// [
204204
// ' \\Foo\Bar\\Baz ',

0 commit comments

Comments
 (0)