Skip to content

Commit

Permalink
Enhancement: Enable trailing_comma_in_multiline_array fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz authored and sebastianbergmann committed Sep 8, 2018
1 parent a578749 commit 952160e
Show file tree
Hide file tree
Showing 47 changed files with 263 additions and 262 deletions.
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ return PhpCsFixer\Config::create()
'single_quote' => true,
'standardize_not_equals' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => true,
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/Constraint/IsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class IsType extends Constraint
'string' => true,
'scalar' => true,
'callable' => true,
'iterable' => true
'iterable' => true,
];

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Framework/Constraint/LogicalNot.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function negate(string $string): string
'starts with ',
'ends with ',
'reference ',
'not not '
'not not ',
];

$negatives = [
Expand All @@ -46,7 +46,7 @@ public static function negate(string $string): string
'starts not with ',
'ends not with ',
'don\'t reference ',
'not '
'not ',
];

\preg_match('/(\'[\w\W]*\')([\w\W]*)("[\w\W]*")/i', $string, $matches);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private function createPatternFromFormat(string $string): string
'%d' => '\d+',
'%x' => '[0-9a-fA-F]+',
'%f' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?',
'%c' => '.'
'%c' => '.',
]
);

Expand Down
16 changes: 8 additions & 8 deletions src/Framework/MockObject/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public function getMockForTrait($traitName, array $arguments = [], $mockClassNam
[
'prologue' => 'abstract ',
'class_name' => $className['className'],
'trait_name' => $traitName
'trait_name' => $traitName,
]
);

Expand Down Expand Up @@ -371,7 +371,7 @@ public function getObjectForTrait($traitName, array $arguments = [], $traitClass
[
'prologue' => '',
'class_name' => $className['className'],
'trait_name' => $traitName
'trait_name' => $traitName,
]
);

Expand Down Expand Up @@ -480,7 +480,7 @@ public function generateClassFromWsdl($wsdlFile, $className, array $methods = []
$methodTemplate->setVar(
[
'method_name' => $name,
'arguments' => \implode(', ', $args)
'arguments' => \implode(', ', $args),
]
);

Expand Down Expand Up @@ -511,7 +511,7 @@ public function generateClassFromWsdl($wsdlFile, $className, array $methods = []
'class_name' => $className,
'wsdl' => $wsdlFile,
'options' => $optionsBuffer,
'methods' => $methodsBuffer
'methods' => $methodsBuffer,
]
);

Expand Down Expand Up @@ -837,13 +837,13 @@ function ($m) {
},
$configurable
)
) . ']'
) . ']',
]
);

return [
'code' => $classTemplate->render(),
'mockClassName' => $mockClassName['className']
'mockClassName' => $mockClassName['className'],
];
}

Expand Down Expand Up @@ -886,7 +886,7 @@ private function generateClassName($type, $className, $prefix)
'className' => $className,
'originalClassName' => $type,
'fullClassName' => $fullClassName,
'namespaceName' => $namespaceName
'namespaceName' => $namespaceName,
];
}

Expand Down Expand Up @@ -1077,7 +1077,7 @@ private function generateMockedMethodDefinition($className, $methodName, $cloneA
'modifier' => $modifier,
'reference' => $reference,
'clone_arguments' => $cloneArguments ? 'true' : 'false',
'deprecation' => $deprecation
'deprecation' => $deprecation,
]
);

Expand Down
4 changes: 2 additions & 2 deletions src/Framework/MockObject/Invocation/StaticInvocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StaticInvocation implements Invocation, SelfDescribing
'sqlite3' => true,
'tidy' => true,
'xmlwriter' => true,
'xsl' => true
'xsl' => true,
];

/**
Expand All @@ -42,7 +42,7 @@ class StaticInvocation implements Invocation, SelfDescribing
'RecursiveIteratorIterator',
'SplFileObject',
'PDORow',
'ZipArchive'
'ZipArchive',
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/TestResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public function endTest(Test $test, float $time): void
'size' => \PHPUnit\Util\Test::getSize(
$class,
$test->getName(false)
)
),
];

$this->time += $time;
Expand Down
18 changes: 9 additions & 9 deletions src/Runner/PhptTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class PhptTestCase implements Test, SelfDescribing
'report_memleaks=0',
'report_zend_debug=0',
'safe_mode=0',
'xdebug.default_enable=0'
'xdebug.default_enable=0',
];

/**
Expand Down Expand Up @@ -345,7 +345,7 @@ private function parse(): array
'CGI',
'EXPECTHEADERS',
'EXTENSIONS',
'PHPDBG'
'PHPDBG',
];

foreach (\file($this->filename) as $line) {
Expand Down Expand Up @@ -394,7 +394,7 @@ private function parseExternal(array &$sections): void
'FILE',
'EXPECT',
'EXPECTF',
'EXPECTREGEX'
'EXPECTREGEX',
];
$testDirectory = \dirname($this->filename) . \DIRECTORY_SEPARATOR;

Expand Down Expand Up @@ -427,8 +427,8 @@ private function validate(array &$sections): bool
[
'EXPECT',
'EXPECTF',
'EXPECTREGEX'
]
'EXPECTREGEX',
],
];

foreach ($requiredSections as $section) {
Expand Down Expand Up @@ -463,11 +463,11 @@ private function render(string $code): string
return \str_replace(
[
'__DIR__',
'__FILE__'
'__FILE__',
],
[
"'" . \dirname($this->filename) . "'",
"'" . $this->filename . "'"
"'" . $this->filename . "'",
],
$code
);
Expand All @@ -480,7 +480,7 @@ private function getCoverageFiles(): array

return [
'coverage' => $baseDir . $basename . 'coverage',
'job' => $baseDir . $basename . 'php'
'job' => $baseDir . $basename . 'php',
];
}

Expand Down Expand Up @@ -516,7 +516,7 @@ private function renderForCoverage(string &$job): void
'phar' => $phar,
'globals' => $globals,
'job' => $files['job'],
'coverageFile' => $files['coverage']
'coverageFile' => $files['coverage'],
]
);

Expand Down
2 changes: 1 addition & 1 deletion src/Runner/TestSuiteSorter.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class TestSuiteSorter
BaseTestRunner::STATUS_INCOMPLETE => 3,
BaseTestRunner::STATUS_RISKY => 2,
BaseTestRunner::STATUS_SKIPPED => 1,
BaseTestRunner::STATUS_UNKNOWN => 0
BaseTestRunner::STATUS_UNKNOWN => 0,
];

/**
Expand Down
4 changes: 2 additions & 2 deletions src/TextUI/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Command
'loader' => null,
'useDefaultConfiguration' => true,
'loadedExtensions' => [],
'notLoadedExtensions' => []
'notLoadedExtensions' => [],
];

/**
Expand Down Expand Up @@ -139,7 +139,7 @@ class Command
'testsuite=' => null,
'verbose' => null,
'version' => null,
'whitelist=' => null
'whitelist=' => null,
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/TextUI/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ResultPrinter extends Printer implements TestListener
'bg-blue' => 44,
'bg-magenta' => 45,
'bg-cyan' => 46,
'bg-white' => 47
'bg-white' => 47,
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Blacklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ final class Blacklist
Instantiator::class => 1,
DocBlock::class => 1,
Prophet::class => 1,
DeepCopy::class => 1
DeepCopy::class => 1,
];

/**
Expand Down
18 changes: 9 additions & 9 deletions src/Util/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function getExtensionConfiguration(): array
$result[] = [
'class' => $class,
'file' => $file,
'arguments' => $arguments
'arguments' => $arguments,
];
}

Expand Down Expand Up @@ -338,13 +338,13 @@ public function getFilterConfiguration(): array
'processUncoveredFilesFromWhitelist' => $processUncoveredFilesFromWhitelist,
'include' => [
'directory' => $includeDirectory,
'file' => $includeFile
'file' => $includeFile,
],
'exclude' => [
'directory' => $excludeDirectory,
'file' => $excludeFile
]
]
'file' => $excludeFile,
],
],
];
}

Expand Down Expand Up @@ -387,7 +387,7 @@ public function getListenerConfiguration(): array
$result[] = [
'class' => $class,
'file' => $file,
'arguments' => $arguments
'arguments' => $arguments,
];
}

Expand Down Expand Up @@ -471,7 +471,7 @@ public function getPHPConfiguration(): array
'cookie' => [],
'server' => [],
'files' => [],
'request' => []
'request' => [],
];

foreach ($this->xpath->query('php/includePath') as $includePath) {
Expand Down Expand Up @@ -1240,7 +1240,7 @@ private function readFilterDirectories(string $query): array
'path' => $this->toAbsolutePath($directoryPath),
'prefix' => $prefix,
'suffix' => $suffix,
'group' => $group
'group' => $group,
];
}

Expand Down Expand Up @@ -1307,7 +1307,7 @@ private function parseGroupConfiguration(string $root): array
{
$groups = [
'include' => [],
'exclude' => []
'exclude' => [],
];

foreach ($this->xpath->query($root . '/include/group') as $group) {
Expand Down
4 changes: 2 additions & 2 deletions src/Util/ConfigurationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public function generateDefaultConfiguration(string $phpunitVersion, string $boo
'{phpunit_version}',
'{bootstrap_script}',
'{tests_directory}',
'{src_directory}'
'{src_directory}',
],
[
$phpunitVersion,
$bootstrapScript,
$testsDirectory,
$srcDirectory
$srcDirectory,
],
self::TEMPLATE
);
Expand Down
2 changes: 1 addition & 1 deletion src/Util/GlobalState.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class GlobalState
'_COOKIE',
'_SERVER',
'_FILES',
'_REQUEST'
'_REQUEST',
];

public static function getIncludedFilesAsString(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Log/TeamCity.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function endTest(Test $test, float $time): void
'testFinished',
[
'name' => $test->getName(),
'duration' => self::toMilliseconds($time)
'duration' => self::toMilliseconds($time),
]
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Util/PHP/WindowsPhpProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function getHandles(): array
}

return [
1 => $stdout_handle
1 => $stdout_handle,
];
}

Expand Down
Loading

0 comments on commit 952160e

Please sign in to comment.