-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from uuf6429/chore/phpcsfixer-setup
chore: Add initial PHP-CS-Fixer configuration and apply cs fixes
- Loading branch information
Showing
88 changed files
with
2,169 additions
and
1,850 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Git 2.23+ allows ignoring commits from git-blame, useful to not display large automated commits. | ||
# | ||
# This file is a list of such commits, that you most probably are not interested in. | ||
# To make this work for your local setup, you need to run the following command: | ||
# | ||
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs | ||
# | ||
# A few rules for changing this file: | ||
# - Commits are in chronological order - oldest on top. Therefore new commits should be added in the end. | ||
# - The purpose is specifically for large commits - avoid adding commits with a very small impact, even if related | ||
# to automated code style formatting. | ||
# - Each commit should be preceded with a comment detailing the purpose of the commit. | ||
|
||
# PHP-CS-Fixer Setup - Apply automated changes | ||
cc23fdc9376975d209489ae88b22ed945871d9cb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
/.github/ export-ignore | ||
/bin/ export-ignore | ||
/tests/ export-ignore | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/CONTRIBUTING.md export-ignore | ||
/phpunit.dist.xml export-ignore | ||
/.github/ export-ignore | ||
/bin/ export-ignore | ||
/tests/ export-ignore | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/CONTRIBUTING.md export-ignore | ||
/phpunit.dist.xml export-ignore | ||
/.php-cs-fixer.dist.php export-ignore | ||
/.git-blame-ignore-revs export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ composer.lock | |
.phpunit.cache | ||
.phpunit.result.cache | ||
phpunit.xml | ||
.php-cs-fixer.php | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
$finder = (new PhpCsFixer\Finder()) | ||
->in(__DIR__) | ||
->notPath('i18n.php'); | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) | ||
->setRules([ | ||
'@PER-CS' => true, | ||
'@Symfony' => true, | ||
'header_comment' => [ | ||
'header' => <<<'TEXT' | ||
This file is part of the Behat Gherkin Parser. | ||
(c) Konstantin Kudryashov <[email protected]> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
TEXT | ||
], | ||
'yoda_style' => [ | ||
'equal' => false, | ||
'identical' => false, | ||
'less_and_greater' => false, | ||
], | ||
'concat_space' => ['spacing' => 'one'], | ||
'phpdoc_align' => ['align' => 'left'], | ||
'heredoc_to_nowdoc' => true, | ||
'heredoc_indentation' => ['indentation' => 'same_as_start'], | ||
'single_line_throw' => false, | ||
'ternary_to_null_coalescing' => true, | ||
'global_namespace_import' => false, | ||
]) | ||
->setFinder($finder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -22,8 +22,8 @@ interface CacheInterface | |
/** | ||
* Checks that cache for feature exists and is fresh. | ||
* | ||
* @param string $path Feature path | ||
* @param integer $timestamp The last time feature was updated | ||
* @param string $path Feature path | ||
* @param int $timestamp The last time feature was updated | ||
* | ||
* @return bool | ||
*/ | ||
|
@@ -41,7 +41,7 @@ public function read($path); | |
/** | ||
* Caches feature node. | ||
* | ||
* @param string $path Feature path | ||
* @param string $path Feature path | ||
* @param FeatureNode $feature Feature instance | ||
*/ | ||
public function write($path, FeatureNode $feature); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Behat\Gherkin\Cache; | ||
|
||
use Behat\Gherkin\Exception\CacheException; | ||
use Behat\Gherkin\Node\FeatureNode; | ||
use Behat\Gherkin\Gherkin; | ||
use Behat\Gherkin\Node\FeatureNode; | ||
|
||
/** | ||
* File cache. | ||
|
@@ -27,13 +27,13 @@ class FileCache implements CacheInterface | |
/** | ||
* Initializes file cache. | ||
* | ||
* @param string $path Path to the folder where to store caches. | ||
* @param string $path path to the folder where to store caches | ||
* | ||
* @throws CacheException | ||
*/ | ||
public function __construct($path) | ||
{ | ||
$this->path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'v'.Gherkin::VERSION; | ||
$this->path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'v' . Gherkin::VERSION; | ||
|
||
if (!is_dir($this->path)) { | ||
@mkdir($this->path, 0777, true); | ||
|
@@ -47,8 +47,8 @@ public function __construct($path) | |
/** | ||
* Checks that cache for feature exists and is fresh. | ||
* | ||
* @param string $path Feature path | ||
* @param integer $timestamp The last time feature was updated | ||
* @param string $path Feature path | ||
* @param int $timestamp The last time feature was updated | ||
* | ||
* @return bool | ||
*/ | ||
|
@@ -78,7 +78,7 @@ public function read($path) | |
$feature = unserialize(file_get_contents($cachePath)); | ||
|
||
if (!$feature instanceof FeatureNode) { | ||
throw new CacheException(sprintf('Can not load cache for a feature "%s" from "%s".', $path, $cachePath )); | ||
throw new CacheException(sprintf('Can not load cache for a feature "%s" from "%s".', $path, $cachePath)); | ||
} | ||
|
||
return $feature; | ||
|
@@ -87,7 +87,7 @@ public function read($path) | |
/** | ||
* Caches feature node. | ||
* | ||
* @param string $path Feature path | ||
* @param string $path Feature path | ||
* @param FeatureNode $feature Feature instance | ||
*/ | ||
public function write($path, FeatureNode $feature) | ||
|
@@ -104,6 +104,6 @@ public function write($path, FeatureNode $feature) | |
*/ | ||
protected function getCachePathFor($path) | ||
{ | ||
return $this->path.'/'.md5($path).'.feature.cache'; | ||
return $this->path . '/' . md5($path) . '.feature.cache'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Behat\Gherkin\Cache; | ||
|
||
|
@@ -20,14 +20,14 @@ | |
*/ | ||
class MemoryCache implements CacheInterface | ||
{ | ||
private $features = array(); | ||
private $timestamps = array(); | ||
private $features = []; | ||
private $timestamps = []; | ||
|
||
/** | ||
* Checks that cache for feature exists and is fresh. | ||
* | ||
* @param string $path Feature path | ||
* @param integer $timestamp The last time feature was updated | ||
* @param string $path Feature path | ||
* @param int $timestamp The last time feature was updated | ||
* | ||
* @return bool | ||
*/ | ||
|
@@ -55,12 +55,12 @@ public function read($path) | |
/** | ||
* Caches feature node. | ||
* | ||
* @param string $path Feature path | ||
* @param string $path Feature path | ||
* @param FeatureNode $feature Feature instance | ||
*/ | ||
public function write($path, FeatureNode $feature) | ||
{ | ||
$this->features[$path] = $feature; | ||
$this->features[$path] = $feature; | ||
$this->timestamps[$path] = time(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -22,13 +22,11 @@ abstract class ComplexFilter implements ComplexFilterInterface | |
/** | ||
* Filters feature according to the filter. | ||
* | ||
* @param FeatureNode $feature | ||
* | ||
* @return FeatureNode | ||
*/ | ||
public function filterFeature(FeatureNode $feature) | ||
{ | ||
$scenarios = array(); | ||
$scenarios = []; | ||
foreach ($feature->getScenarios() as $scenario) { | ||
if (!$this->isScenarioMatch($feature, $scenario)) { | ||
continue; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -23,7 +23,7 @@ interface ComplexFilterInterface extends FeatureFilterInterface | |
/** | ||
* Checks if scenario or outline matches specified filter. | ||
* | ||
* @param FeatureNode $feature Feature node instance | ||
* @param FeatureNode $feature Feature node instance | ||
* @param ScenarioInterface $scenario Scenario or Outline node instance | ||
* | ||
* @return bool | ||
|
Oops, something went wrong.