-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use php-cs-fixer as coding style tool
- Loading branch information
1 parent
a5fc431
commit 5f56351
Showing
7 changed files
with
70 additions
and
7 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
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 |
---|---|---|
|
@@ -126,3 +126,5 @@ nb-configuration.xml | |
/results/ | ||
/phpunit*.xml | ||
/.phpunit.*.cache | ||
|
||
/.php-cs-fixer.php |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
use Nexus\CsConfig\Factory; | ||
use PhpCsFixer\Finder; | ||
use Utils\PhpCsFixer\CodeIgniter4; | ||
|
||
$finder = Finder::create() | ||
->files() | ||
->in([ | ||
__DIR__ . '/app', // @todo relocate when `header_comment` is enabled | ||
__DIR__ . '/public', // @todo relocate when `header_comment` is enabled | ||
__DIR__ . '/system', | ||
__DIR__ . '/tests', | ||
__DIR__ . '/utils', | ||
]) | ||
->exclude(['ThirdParty']) | ||
->notName('#Foobar.php$#') | ||
->append([ | ||
__FILE__, | ||
__DIR__ . '/rector.php', | ||
__DIR__ . '/spark', | ||
]); | ||
|
||
$overrides = []; | ||
|
||
$options = [ | ||
'cacheFile' => 'build/.php-cs-fixer.cache', | ||
'finder' => $finder, | ||
]; | ||
|
||
// @todo change to `forLibrary()` when `header_comment` is enabled | ||
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Utils\PhpCsFixer; | ||
|
||
use Nexus\CsConfig\Ruleset\AbstractRuleset; | ||
|
||
/** | ||
* Defines the ruleset used for the CodeIgniter4 organization. | ||
* | ||
* @internal | ||
*/ | ||
final class CodeIgniter4 extends AbstractRuleset | ||
{ | ||
public function __construct() | ||
{ | ||
$this->name = 'CodeIgniter4 Revised Coding Standards'; | ||
|
||
$this->rules = []; | ||
|
||
$this->requiredPHPVersion = 70300; | ||
|
||
$this->autoActivateIsRiskyAllowed = true; | ||
} | ||
} |