@@ -52,7 +52,7 @@ jobs:
| grep -v tests/TestCase.php \
&& (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
- ./check_trailing_spaces.sh || travis_terminate 1
- - ./dev-tools/tools/phpstan analyse
+ - php -d auto_prepend_file=dev-tools/vendor/autoload.php ./dev-tools/tools/phpstan analyse
- if [ -n "$COMMIT_SCA_FILES" ]; then ./dev-tools/vendor/bin/phpmd `echo "$COMMIT_SCA_FILES" | grep -Ev "^tests/Fixtures" | xargs | sed 's/ /,/g'` text phpmd.xml || travis_terminate 1; fi
- ./dev-tools/tools/composer-require-checker check composer.json --config-file $(realpath .composer-require-checker.json) || travis_terminate 1
- composer normalize -d ./dev-tools ./../composer.json --dry-run
@@ -6,7 +6,8 @@
"humbug/box": "~3.7.0",
"localheinz/composer-normalize": "^1.1",
"mi-schi/phpmd-extension": "^4.3",
- "phpmd/phpmd": "^2.6"
+ "phpmd/phpmd": "^2.6",
+ "phpstan/phpstan-phpunit": "^0.11.2"
},
"conflict": {
"hhvm": "*"
@@ -1,5 +1,8 @@
+includes:
+ - dev-tools/vendor/phpstan/phpstan-phpunit/extension.neon
+
parameters:
- level: 0
+ level: 1
paths:
- src
- tests
@@ -37,6 +37,7 @@ abstract class AbstractLinesBeforeNamespaceFixer extends AbstractFixer implement
{
// Let's determine the total numbers of new lines before the namespace
// and the opening token
+ $openingTokenIndex = null;
$precedingNewlines = 0;
$newlineInOpening = false;
$openingToken = null;
@@ -279,8 +279,9 @@ final class DescribeCommand extends Command
$old = $codeSample->getCode();
$tokens = Tokens::fromCode($old);
+ $configuration = $codeSample->getConfiguration();
if ($fixer instanceof ConfigurableFixerInterface) {
- $configuration = $codeSample->getConfiguration();
$fixer->configure(null === $configuration ? [] : $configuration);
}
@@ -566,11 +566,11 @@ class Foo
continue;
- if (!$isAnonymousClass) {
- $prevToken = $tokens[$closingParenthesisIndex - 1];
- }
-
- if (!$isAnonymousClass && $prevToken->isWhitespace() && false !== strpos($prevToken->getContent(), "\n")) {
+ if (
+ !$isAnonymousClass
+ && $tokens[$closingParenthesisIndex - 1]->isWhitespace()
+ && false !== strpos($tokens[$closingParenthesisIndex - 1]->getContent(), "\n")
+ ) {
if (!$tokens[$startBraceIndex - 2]->isComment()) {
$tokens->ensureWhitespaceAtIndex($startBraceIndex - 1, 1, ' ');
@@ -230,6 +230,8 @@ class Sample
static $methodAttr = [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_ABSTRACT, T_FINAL, T_STATIC];
+ $nonWhiteAbove = null;
// find out where the element definition starts
$firstElementAttributeIndex = $elementIndex;
for ($i = $elementIndex; $i > $classStartIndex; --$i) {
@@ -99,6 +99,7 @@ final class SingleImportPerStatementFixer extends AbstractFixer implements White
$groupPrefix = '';
$comment = '';
+ $groupOpenIndex = null;
for ($i = $index + 1;; ++$i) {
if ($tokens[$i]->isGivenKind(CT::T_GROUP_IMPORT_BRACE_OPEN)) {
$groupOpenIndex = $i;