Fix compatibility with the PHP-CS-Fixer 2.13.3 and above

This commit is contained in:
ErickSkrauch 2019-02-18 15:47:10 +03:00
parent 06a37576ee
commit 3ab60f5bd5
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
4 changed files with 9 additions and 5 deletions

View File

@ -3,6 +3,7 @@ php:
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- nightly
cache:
@ -25,7 +26,7 @@ stages:
jobs:
include:
- stage: Static Code Analysis
php: 7.2
php: 7.3
script:
- vendor/bin/php-cs-fixer fix -v --dry-run
allow_failures:

1
composer.lock generated
View File

@ -1887,6 +1887,7 @@
"mock",
"xunit"
],
"abandoned": true,
"time": "2018-08-07T07:02:44+00:00"
},
{

View File

@ -10,10 +10,10 @@ use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
use PhpCsFixer\FixerConfiguration\FixerOptionBuilder;
use PhpCsFixer\FixerDefinition\CodeSample;
use PhpCsFixer\FixerDefinition\FixerDefinition;
use PhpCsFixer\Preg;
use PhpCsFixer\Tokenizer\Token;
use PhpCsFixer\Tokenizer\Tokens;
use PhpCsFixer\Tokenizer\TokensAnalyzer;
use PhpCsFixer\Utils;
/**
* This is copy of the PR https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3688
@ -142,7 +142,8 @@ new class extends Foo {
}
// The final bit of the whitespace must be the next statement's indentation
$lines = Utils::splitLines($content);
Preg::matchAll('/[^\n\r]+[\r\n]*/', $content, $matches);
$lines = $matches[0];
$eol = $this->whitespacesConfig->getLineEnding();
$tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]);
}

View File

@ -7,9 +7,9 @@ use Ely\CS\Fixer\AbstractFixer;
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
use PhpCsFixer\FixerDefinition\CodeSample;
use PhpCsFixer\FixerDefinition\FixerDefinition;
use PhpCsFixer\Preg;
use PhpCsFixer\Tokenizer\Token;
use PhpCsFixer\Tokenizer\Tokens;
use PhpCsFixer\Utils;
use SplFileInfo;
/**
@ -123,7 +123,8 @@ class Foo
}
// The final bit of the whitespace must be the next statement's indentation
$lines = Utils::splitLines($content);
Preg::matchAll('/[^\n\r]+[\r\n]*/', $content, $matches);
$lines = $matches[0];
$eol = $this->whitespacesConfig->getLineEnding();
$tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]);
}