ClassDefinitionFixer::getClassyInheritanceInfo()   A
last analyzed

Complexity

Conditions 6
Paths 8

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 20
rs 9.2222
cc 6
nc 8
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of PHP CS Fixer.
7
 *
8
 * (c) Fabien Potencier <[email protected]>
9
 *     Dariusz Rumiński <[email protected]>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14
15
namespace PhpCsFixer\Fixer\ClassNotation;
16
17
use PhpCsFixer\AbstractFixer;
18
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
19
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
20
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
21
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface;
22
use PhpCsFixer\FixerConfiguration\FixerOptionBuilder;
23
use PhpCsFixer\FixerDefinition\CodeSample;
24
use PhpCsFixer\FixerDefinition\FixerDefinition;
25
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
26
use PhpCsFixer\FixerDefinition\VersionSpecification;
27
use PhpCsFixer\FixerDefinition\VersionSpecificCodeSample;
28
use PhpCsFixer\Tokenizer\Token;
29
use PhpCsFixer\Tokenizer\Tokens;
30
use PhpCsFixer\Tokenizer\TokensAnalyzer;
31
32
/**
33
 * Fixer for part of the rules defined in PSR2 ¶4.1 Extends and Implements and PSR12 ¶8. Anonymous Classes.
34
 *
35
 * @author SpacePossum
36
 */
37
final class ClassDefinitionFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface
38
{
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getDefinition(): FixerDefinitionInterface
43
    {
44
        return new FixerDefinition(
45
            'Whitespace around the keywords of a class, trait or interfaces definition should be one space.',
46
            [
47
                new CodeSample(
48
                    '<?php
49
50
class  Foo  extends  Bar  implements  Baz,  BarBaz
51
{
52
}
53
54
final  class  Foo  extends  Bar  implements  Baz,  BarBaz
55
{
56
}
57
58
trait  Foo
59
{
60
}
61
'
62
                ),
63
                new VersionSpecificCodeSample(
64
                    '<?php
65
66
$foo = new  class  extends  Bar  implements  Baz,  BarBaz {};
67
',
68
                    new VersionSpecification(70100)
69
                ),
70
                new CodeSample(
71
                    '<?php
72
73
class Foo
74
extends Bar
75
implements Baz, BarBaz
76
{}
77
',
78
                    ['single_line' => true]
79
                ),
80
                new CodeSample(
81
                    '<?php
82
83
class Foo
84
extends Bar
85
implements Baz
86
{}
87
',
88
                    ['single_item_single_line' => true]
89
                ),
90
                new CodeSample(
91
                    '<?php
92
93
interface Bar extends
94
    Bar, BarBaz, FooBarBaz
95
{}
96
',
97
                    ['multi_line_extends_each_single_line' => true]
98
                ),
99
                new CodeSample(
100
                    '<?php
101
$foo = new class(){};
102
',
103
                    ['space_before_parenthesis' => true]
104
                ),
105
            ]
106
        );
107
    }
108
109
    /**
110
     * {@inheritdoc}
111
     *
112
     * Must run before BracesFixer.
113
     */
114
    public function getPriority(): int
115
    {
116
        return 36;
117
    }
118
119
    /**
120
     * {@inheritdoc}
121
     */
122
    public function isCandidate(Tokens $tokens): bool
123
    {
124
        return $tokens->isAnyTokenKindsFound(Token::getClassyTokenKinds());
125
    }
126
127
    /**
128
     * {@inheritdoc}
129
     */
130
    protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
131
    {
132
        // -4, one for count to index, 3 because min. of tokens for a classy location.
133
        for ($index = $tokens->getSize() - 4; $index > 0; --$index) {
134
            if ($tokens[$index]->isClassy()) {
135
                $this->fixClassyDefinition($tokens, $index);
136
            }
137
        }
138
    }
139
140
    /**
141
     * {@inheritdoc}
142
     */
143
    protected function createConfigurationDefinition(): FixerConfigurationResolverInterface
144
    {
145
        return new FixerConfigurationResolver([
146
            (new FixerOptionBuilder('multi_line_extends_each_single_line', 'Whether definitions should be multiline.'))
147
                ->setAllowedTypes(['bool'])
148
                ->setDefault(false)
149
                ->getOption(),
150
            (new FixerOptionBuilder('single_item_single_line', 'Whether definitions should be single line when including a single item.'))
151
                ->setAllowedTypes(['bool'])
152
                ->setDefault(false)
153
                ->getOption(),
154
            (new FixerOptionBuilder('single_line', 'Whether definitions should be single line.'))
155
                ->setAllowedTypes(['bool'])
156
                ->setDefault(false)
157
                ->getOption(),
158
            (new FixerOptionBuilder('space_before_parenthesis', 'Whether there should be a single space after the parenthesis of anonymous class (PSR12) or not.'))
159
                ->setAllowedTypes(['bool'])
160
                ->setDefault(false)
161
                ->getOption(),
162
        ]);
163
    }
164
165
    /**
166
     * @param int $classyIndex Class definition token start index
167
     */
168
    private function fixClassyDefinition(Tokens $tokens, int $classyIndex): void
169
    {
170
        $classDefInfo = $this->getClassyDefinitionInfo($tokens, $classyIndex);
171
172
        // PSR2 4.1 Lists of implements MAY be split across multiple lines, where each subsequent line is indented once.
173
        // When doing so, the first item in the list MUST be on the next line, and there MUST be only one interface per line.
174
175
        if (false !== $classDefInfo['implements']) {
176
            $classDefInfo['implements'] = $this->fixClassyDefinitionImplements(
177
                $tokens,
178
                $classDefInfo['open'],
0 ignored issues
show
Bug introduced by
It seems like $classDefInfo['open'] can also be of type null; however, parameter $classOpenIndex of PhpCsFixer\Fixer\ClassNo...yDefinitionImplements() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

178
                /** @scrutinizer ignore-type */ $classDefInfo['open'],
Loading history...
179
                $classDefInfo['implements']
180
            );
181
        }
182
183
        if (false !== $classDefInfo['extends']) {
184
            $classDefInfo['extends'] = $this->fixClassyDefinitionExtends(
185
                $tokens,
186
                false === $classDefInfo['implements'] ? $classDefInfo['open'] : $classDefInfo['implements']['start'],
0 ignored issues
show
Bug introduced by
It seems like false === $classDefInfo[...['implements']['start'] can also be of type null; however, parameter $classOpenIndex of PhpCsFixer\Fixer\ClassNo...assyDefinitionExtends() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

186
                /** @scrutinizer ignore-type */ false === $classDefInfo['implements'] ? $classDefInfo['open'] : $classDefInfo['implements']['start'],
Loading history...
187
                $classDefInfo['extends']
0 ignored issues
show
Bug introduced by
It seems like $classDefInfo['extends'] can also be of type false; however, parameter $classExtendsInfo of PhpCsFixer\Fixer\ClassNo...assyDefinitionExtends() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

187
                /** @scrutinizer ignore-type */ $classDefInfo['extends']
Loading history...
188
            );
189
        }
190
191
        // PSR2: class definition open curly brace must go on a new line.
192
        // PSR12: anonymous class curly brace on same line if not multi line implements.
193
194
        $classDefInfo['open'] = $this->fixClassyDefinitionOpenSpacing($tokens, $classDefInfo);
195
196
        if ($classDefInfo['implements']) {
197
            $end = $classDefInfo['implements']['start'];
198
        } elseif ($classDefInfo['extends']) {
199
            $end = $classDefInfo['extends']['start'];
200
        } else {
201
            $end = $tokens->getPrevNonWhitespace($classDefInfo['open']);
202
        }
203
204
        // 4.1 The extends and implements keywords MUST be declared on the same line as the class name.
205
        $this->makeClassyDefinitionSingleLine($tokens, $classDefInfo['start'], $end);
206
    }
207
208
    private function fixClassyDefinitionExtends(Tokens $tokens, int $classOpenIndex, array $classExtendsInfo): array
209
    {
210
        $endIndex = $tokens->getPrevNonWhitespace($classOpenIndex);
211
212
        if ($this->configuration['single_line'] || false === $classExtendsInfo['multiLine']) {
213
            $this->makeClassyDefinitionSingleLine($tokens, $classExtendsInfo['start'], $endIndex);
0 ignored issues
show
Bug introduced by
It seems like $endIndex can also be of type null; however, parameter $endIndex of PhpCsFixer\Fixer\ClassNo...yDefinitionSingleLine() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

213
            $this->makeClassyDefinitionSingleLine($tokens, $classExtendsInfo['start'], /** @scrutinizer ignore-type */ $endIndex);
Loading history...
214
            $classExtendsInfo['multiLine'] = false;
215
        } elseif ($this->configuration['single_item_single_line'] && 1 === $classExtendsInfo['numberOfExtends']) {
216
            $this->makeClassyDefinitionSingleLine($tokens, $classExtendsInfo['start'], $endIndex);
217
            $classExtendsInfo['multiLine'] = false;
218
        } elseif ($this->configuration['multi_line_extends_each_single_line'] && $classExtendsInfo['multiLine']) {
219
            $this->makeClassyInheritancePartMultiLine($tokens, $classExtendsInfo['start'], $endIndex);
0 ignored issues
show
Bug introduced by
It seems like $endIndex can also be of type null; however, parameter $endIndex of PhpCsFixer\Fixer\ClassNo...eritancePartMultiLine() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

219
            $this->makeClassyInheritancePartMultiLine($tokens, $classExtendsInfo['start'], /** @scrutinizer ignore-type */ $endIndex);
Loading history...
220
            $classExtendsInfo['multiLine'] = true;
221
        }
222
223
        return $classExtendsInfo;
224
    }
225
226
    private function fixClassyDefinitionImplements(Tokens $tokens, int $classOpenIndex, array $classImplementsInfo): array
227
    {
228
        $endIndex = $tokens->getPrevNonWhitespace($classOpenIndex);
229
230
        if ($this->configuration['single_line'] || false === $classImplementsInfo['multiLine']) {
231
            $this->makeClassyDefinitionSingleLine($tokens, $classImplementsInfo['start'], $endIndex);
0 ignored issues
show
Bug introduced by
It seems like $endIndex can also be of type null; however, parameter $endIndex of PhpCsFixer\Fixer\ClassNo...yDefinitionSingleLine() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

231
            $this->makeClassyDefinitionSingleLine($tokens, $classImplementsInfo['start'], /** @scrutinizer ignore-type */ $endIndex);
Loading history...
232
            $classImplementsInfo['multiLine'] = false;
233
        } elseif ($this->configuration['single_item_single_line'] && 1 === $classImplementsInfo['numberOfImplements']) {
234
            $this->makeClassyDefinitionSingleLine($tokens, $classImplementsInfo['start'], $endIndex);
235
            $classImplementsInfo['multiLine'] = false;
236
        } else {
237
            $this->makeClassyInheritancePartMultiLine($tokens, $classImplementsInfo['start'], $endIndex);
0 ignored issues
show
Bug introduced by
It seems like $endIndex can also be of type null; however, parameter $endIndex of PhpCsFixer\Fixer\ClassNo...eritancePartMultiLine() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

237
            $this->makeClassyInheritancePartMultiLine($tokens, $classImplementsInfo['start'], /** @scrutinizer ignore-type */ $endIndex);
Loading history...
238
            $classImplementsInfo['multiLine'] = true;
239
        }
240
241
        return $classImplementsInfo;
242
    }
243
244
    private function fixClassyDefinitionOpenSpacing(Tokens $tokens, array $classDefInfo): int
245
    {
246
        if ($classDefInfo['anonymousClass']) {
247
            if (false !== $classDefInfo['implements']) {
248
                $spacing = $classDefInfo['implements']['multiLine'] ? $this->whitespacesConfig->getLineEnding() : ' ';
249
            } elseif (false !== $classDefInfo['extends']) {
250
                $spacing = $classDefInfo['extends']['multiLine'] ? $this->whitespacesConfig->getLineEnding() : ' ';
251
            } else {
252
                $spacing = ' ';
253
            }
254
        } else {
255
            $spacing = $this->whitespacesConfig->getLineEnding();
256
        }
257
258
        $openIndex = $tokens->getNextTokenOfKind($classDefInfo['classy'], ['{']);
259
260
        if (' ' !== $spacing && false !== strpos($tokens[$openIndex - 1]->getContent(), "\n")) {
261
            return $openIndex;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $openIndex could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
262
        }
263
264
        if ($tokens[$openIndex - 1]->isWhitespace()) {
265
            if (' ' !== $spacing || !$tokens[$tokens->getPrevNonWhitespace($openIndex - 1)]->isComment()) {
266
                $tokens[$openIndex - 1] = new Token([T_WHITESPACE, $spacing]);
267
            }
268
269
            return $openIndex;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $openIndex could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
270
        }
271
272
        $tokens->insertAt($openIndex, new Token([T_WHITESPACE, $spacing]));
0 ignored issues
show
Bug introduced by
It seems like $openIndex can also be of type null; however, parameter $index of PhpCsFixer\Tokenizer\Tokens::insertAt() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

272
        $tokens->insertAt(/** @scrutinizer ignore-type */ $openIndex, new Token([T_WHITESPACE, $spacing]));
Loading history...
273
274
        return $openIndex + 1;
275
    }
276
277
    private function getClassyDefinitionInfo(Tokens $tokens, int $classyIndex): array
278
    {
279
        $openIndex = $tokens->getNextTokenOfKind($classyIndex, ['{']);
280
        $extends = false;
281
        $implements = false;
282
        $anonymousClass = false;
283
284
        if (!$tokens[$classyIndex]->isGivenKind(T_TRAIT)) {
285
            $extends = $tokens->findGivenKind(T_EXTENDS, $classyIndex, $openIndex);
286
            $extends = \count($extends) ? $this->getClassyInheritanceInfo($tokens, key($extends), 'numberOfExtends') : false;
287
288
            if (!$tokens[$classyIndex]->isGivenKind(T_INTERFACE)) {
289
                $implements = $tokens->findGivenKind(T_IMPLEMENTS, $classyIndex, $openIndex);
290
                $implements = \count($implements) ? $this->getClassyInheritanceInfo($tokens, key($implements), 'numberOfImplements') : false;
291
                $tokensAnalyzer = new TokensAnalyzer($tokens);
292
                $anonymousClass = $tokensAnalyzer->isAnonymousClass($classyIndex);
293
            }
294
        }
295
296
        if ($anonymousClass) {
297
            $startIndex = $tokens->getPrevMeaningfulToken($classyIndex); // go to "new" for anonymous class
298
        } else {
299
            $prev = $tokens->getPrevMeaningfulToken($classyIndex);
300
            $startIndex = $tokens[$prev]->isGivenKind([T_FINAL, T_ABSTRACT]) ? $prev : $classyIndex;
301
        }
302
303
        return [
304
            'start' => $startIndex,
305
            'classy' => $classyIndex,
306
            'open' => $openIndex,
307
            'extends' => $extends,
308
            'implements' => $implements,
309
            'anonymousClass' => $anonymousClass,
310
        ];
311
    }
312
313
    private function getClassyInheritanceInfo(Tokens $tokens, int $startIndex, string $label): array
314
    {
315
        $implementsInfo = ['start' => $startIndex, $label => 1, 'multiLine' => false];
316
        ++$startIndex;
317
        $endIndex = $tokens->getNextTokenOfKind($startIndex, ['{', [T_IMPLEMENTS], [T_EXTENDS]]);
318
        $endIndex = $tokens[$endIndex]->equals('{') ? $tokens->getPrevNonWhitespace($endIndex) : $endIndex;
0 ignored issues
show
Bug introduced by
It seems like $endIndex can also be of type null; however, parameter $index of PhpCsFixer\Tokenizer\Tok...:getPrevNonWhitespace() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

318
        $endIndex = $tokens[$endIndex]->equals('{') ? $tokens->getPrevNonWhitespace(/** @scrutinizer ignore-type */ $endIndex) : $endIndex;
Loading history...
319
320
        for ($i = $startIndex; $i < $endIndex; ++$i) {
321
            if ($tokens[$i]->equals(',')) {
322
                ++$implementsInfo[$label];
323
324
                continue;
325
            }
326
327
            if (!$implementsInfo['multiLine'] && false !== strpos($tokens[$i]->getContent(), "\n")) {
328
                $implementsInfo['multiLine'] = true;
329
            }
330
        }
331
332
        return $implementsInfo;
333
    }
334
335
    private function makeClassyDefinitionSingleLine(Tokens $tokens, int $startIndex, int $endIndex): void
336
    {
337
        for ($i = $endIndex; $i >= $startIndex; --$i) {
338
            if ($tokens[$i]->isWhitespace()) {
339
                if ($tokens[$i - 1]->isComment() || $tokens[$i + 1]->isComment()) {
340
                    $content = $tokens[$i - 1]->getContent();
341
342
                    if (!('#' === $content || '//' === substr($content, 0, 2))) {
343
                        $content = $tokens[$i + 1]->getContent();
344
345
                        if (!('#' === $content || '//' === substr($content, 0, 2))) {
346
                            $tokens[$i] = new Token([T_WHITESPACE, ' ']);
347
                        }
348
                    }
349
350
                    continue;
351
                }
352
353
                if ($tokens[$i - 1]->isGivenKind(T_CLASS) && $tokens[$i + 1]->equals('(')) {
354
                    if (true === $this->configuration['space_before_parenthesis']) {
355
                        $tokens[$i] = new Token([T_WHITESPACE, ' ']);
356
                    } else {
357
                        $tokens->clearAt($i);
358
                    }
359
360
                    continue;
361
                }
362
363
                if (!$tokens[$i - 1]->equals(',') && $tokens[$i + 1]->equalsAny([',', ')']) || $tokens[$i - 1]->equals('(')) {
0 ignored issues
show
introduced by
Consider adding parentheses for clarity. Current Interpretation: (! $tokens[$i - 1]->equa...ns[$i - 1]->equals('('), Probably Intended Meaning: ! $tokens[$i - 1]->equal...s[$i - 1]->equals('('))
Loading history...
364
                    $tokens->clearAt($i);
365
366
                    continue;
367
                }
368
369
                $tokens[$i] = new Token([T_WHITESPACE, ' ']);
370
371
                continue;
372
            }
373
374
            if ($tokens[$i]->equals(',') && !$tokens[$i + 1]->isWhitespace()) {
375
                $tokens->insertAt($i + 1, new Token([T_WHITESPACE, ' ']));
376
377
                continue;
378
            }
379
380
            if ($this->configuration['space_before_parenthesis'] && $tokens[$i]->isGivenKind(T_CLASS) && !$tokens[$i + 1]->isWhitespace()) {
381
                $tokens->insertAt($i + 1, new Token([T_WHITESPACE, ' ']));
382
383
                continue;
384
            }
385
386
            if (!$tokens[$i]->isComment()) {
387
                continue;
388
            }
389
390
            if (!$tokens[$i + 1]->isWhitespace() && !$tokens[$i + 1]->isComment() && false === strpos($tokens[$i]->getContent(), "\n")) {
391
                $tokens->insertAt($i + 1, new Token([T_WHITESPACE, ' ']));
392
            }
393
394
            if (!$tokens[$i - 1]->isWhitespace() && !$tokens[$i - 1]->isComment()) {
395
                $tokens->insertAt($i, new Token([T_WHITESPACE, ' ']));
396
            }
397
        }
398
    }
399
400
    private function makeClassyInheritancePartMultiLine(Tokens $tokens, int $startIndex, int $endIndex): void
401
    {
402
        for ($i = $endIndex; $i > $startIndex; --$i) {
403
            $previousInterfaceImplementingIndex = $tokens->getPrevTokenOfKind($i, [',', [T_IMPLEMENTS], [T_EXTENDS]]);
404
            $breakAtIndex = $tokens->getNextMeaningfulToken($previousInterfaceImplementingIndex);
0 ignored issues
show
Bug introduced by
It seems like $previousInterfaceImplementingIndex can also be of type null; however, parameter $index of PhpCsFixer\Tokenizer\Tok...etNextMeaningfulToken() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

404
            $breakAtIndex = $tokens->getNextMeaningfulToken(/** @scrutinizer ignore-type */ $previousInterfaceImplementingIndex);
Loading history...
405
406
            // make the part of a ',' or 'implements' single line
407
            $this->makeClassyDefinitionSingleLine(
408
                $tokens,
409
                $breakAtIndex,
0 ignored issues
show
Bug introduced by
It seems like $breakAtIndex can also be of type null; however, parameter $startIndex of PhpCsFixer\Fixer\ClassNo...yDefinitionSingleLine() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

409
                /** @scrutinizer ignore-type */ $breakAtIndex,
Loading history...
410
                $i
411
            );
412
413
            // make sure the part is on its own line
414
            $isOnOwnLine = false;
415
416
            for ($j = $breakAtIndex; $j > $previousInterfaceImplementingIndex; --$j) {
417
                if (false !== strpos($tokens[$j]->getContent(), "\n")) {
418
                    $isOnOwnLine = true;
419
420
                    break;
421
                }
422
            }
423
424
            if (!$isOnOwnLine) {
425
                if ($tokens[$breakAtIndex - 1]->isWhitespace()) {
426
                    $tokens[$breakAtIndex - 1] = new Token([
427
                        T_WHITESPACE,
428
                        $this->whitespacesConfig->getLineEnding().$this->whitespacesConfig->getIndent(),
429
                    ]);
430
                } else {
431
                    $tokens->insertAt($breakAtIndex, new Token([T_WHITESPACE, $this->whitespacesConfig->getLineEnding().$this->whitespacesConfig->getIndent()]));
0 ignored issues
show
Bug introduced by
It seems like $breakAtIndex can also be of type null; however, parameter $index of PhpCsFixer\Tokenizer\Tokens::insertAt() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

431
                    $tokens->insertAt(/** @scrutinizer ignore-type */ $breakAtIndex, new Token([T_WHITESPACE, $this->whitespacesConfig->getLineEnding().$this->whitespacesConfig->getIndent()]));
Loading history...
432
                }
433
            }
434
435
            $i = $previousInterfaceImplementingIndex + 1;
436
        }
437
    }
438
}
439