-
Notifications
You must be signed in to change notification settings - Fork 0
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 #24 from kynx/cs-fixer
Added --cs-fix option to run phpcbf on changed files
- Loading branch information
Showing
27 changed files
with
1,144 additions
and
673 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kynx\Laminas\FormShape\CodingStandards; | ||
|
||
interface FixerInterface | ||
{ | ||
public function getName(): string; | ||
|
||
public function addFile(string $path): void; | ||
|
||
public function fix(): void; | ||
} |
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,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kynx\Laminas\FormShape\CodingStandards; | ||
|
||
use Kynx\Laminas\FormShape\CodingStandards\FixerInterface; | ||
|
||
use function array_map; | ||
use function basename; | ||
use function escapeshellarg; | ||
use function escapeshellcmd; | ||
use function implode; | ||
use function passthru; | ||
|
||
final class PhpCodeSnifferFixer implements FixerInterface | ||
{ | ||
private array $paths = []; | ||
|
||
public function __construct(private string $phpCbf) | ||
{ | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return basename($this->phpCbf); | ||
} | ||
|
||
public function addFile(string $path): void | ||
{ | ||
$this->paths[] = $path; | ||
} | ||
|
||
public function fix(): void | ||
{ | ||
$paths = array_map(static fn (string $path): string => escapeshellarg($path), $this->paths); | ||
passthru(escapeshellcmd($this->phpCbf) . ' ' . implode(' ', $paths)); | ||
} | ||
} |
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
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,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kynx\Laminas\FormShape\Writer; | ||
|
||
use Kynx\Laminas\FormShape\InputFilter\ImportType; | ||
use Psalm\Type\Union; | ||
use ReflectionClass; | ||
|
||
interface CodeGeneratorInterface | ||
{ | ||
/** | ||
* @param array<ImportType> $importTypes | ||
*/ | ||
public function generate( | ||
ReflectionClass $reflection, | ||
Union $type, | ||
array $importTypes, | ||
string $contents, | ||
bool $replaceGetDataReturn = false | ||
): GeneratedCode; | ||
} |
Oops, something went wrong.