Skip to content

Commit 3ab60f5

Browse files
committed
Fix compatibility with the PHP-CS-Fixer 2.13.3 and above
1 parent 06a3757 commit 3ab60f5

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ php:
33
- '7.0'
44
- '7.1'
55
- '7.2'
6+
- '7.3'
67
- nightly
78

89
cache:
@@ -25,7 +26,7 @@ stages:
2526
jobs:
2627
include:
2728
- stage: Static Code Analysis
28-
php: 7.2
29+
php: 7.3
2930
script:
3031
- vendor/bin/php-cs-fixer fix -v --dry-run
3132
allow_failures:

composer.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Fixer/Whitespace/BlankLineAroundClassBodyFixer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
use PhpCsFixer\FixerConfiguration\FixerOptionBuilder;
1111
use PhpCsFixer\FixerDefinition\CodeSample;
1212
use PhpCsFixer\FixerDefinition\FixerDefinition;
13+
use PhpCsFixer\Preg;
1314
use PhpCsFixer\Tokenizer\Token;
1415
use PhpCsFixer\Tokenizer\Tokens;
1516
use PhpCsFixer\Tokenizer\TokensAnalyzer;
16-
use PhpCsFixer\Utils;
1717

1818
/**
1919
* This is copy of the PR https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3688
@@ -142,7 +142,8 @@ private function fixBlankLines(Tokens $tokens, $index, $countLines) {
142142
}
143143

144144
// The final bit of the whitespace must be the next statement's indentation
145-
$lines = Utils::splitLines($content);
145+
Preg::matchAll('/[^\n\r]+[\r\n]*/', $content, $matches);
146+
$lines = $matches[0];
146147
$eol = $this->whitespacesConfig->getLineEnding();
147148
$tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]);
148149
}

src/Fixer/Whitespace/LineBreakAfterStatementsFixer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
88
use PhpCsFixer\FixerDefinition\CodeSample;
99
use PhpCsFixer\FixerDefinition\FixerDefinition;
10+
use PhpCsFixer\Preg;
1011
use PhpCsFixer\Tokenizer\Token;
1112
use PhpCsFixer\Tokenizer\Tokens;
12-
use PhpCsFixer\Utils;
1313
use SplFileInfo;
1414

1515
/**
@@ -123,7 +123,8 @@ private function fixBlankLines(Tokens $tokens, $index, $countLines) {
123123
}
124124

125125
// The final bit of the whitespace must be the next statement's indentation
126-
$lines = Utils::splitLines($content);
126+
Preg::matchAll('/[^\n\r]+[\r\n]*/', $content, $matches);
127+
$lines = $matches[0];
127128
$eol = $this->whitespacesConfig->getLineEnding();
128129
$tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]);
129130
}

0 commit comments

Comments
 (0)