Skip to content

Commit

Permalink
Add support for --fix option to sniff command
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers authored Dec 7, 2024
1 parent b1a5a79 commit 1da2568
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/system/console/WinterSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class WinterSniff extends BaseScaffoldCommand
{?--c|config= : Path to a custom PHPCS configuration XML file}
{?--p|plugin= : Checks the coding style of a plugin}
{?--e|no-warnings : Ignore warnings and only show errors}
{--fix : Automatically fix detected errors where able by use of the phpcbf command}
{?--s|summary : Display a summary of the results}
';

Expand All @@ -48,6 +49,7 @@ class WinterSniff extends BaseScaffoldCommand

protected $replaces = [
'winter:phpcs',
'sniff',
];


Expand Down Expand Up @@ -203,10 +205,11 @@ public function getPluginIdentifier($identifier = null): string
*/
protected function findPhpCsExecutable(): ?string
{
$binFile = $this->option('fix') ? 'phpcbf' : 'phpcs';
return (new ExecutableFinder())
->find(
'phpcs',
base_path('vendor/bin/phpcs'),
$binFile,
base_path("vendor/bin/$binFile"),
[
base_path('vendor'),
]
Expand Down

0 comments on commit 1da2568

Please sign in to comment.