Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions dev-tools/phpstan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,6 @@
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Output/ErrorOutput.php',
];
$ignoreErrors[] = [
'message' => '#^Offset int might not exist on array\\<1\\|2\\|3\\|4\\|5\\|6, array\\{symbol\\: string, format\\: string, description\\: string\\}\\>\\.$#',
'identifier' => 'offsetAccess.notFound',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Output/Progress/DotsOutput.php',
];
$ignoreErrors[] = [
'message' => '#^Offset string might not exist on array\\<string, class\\-string\\<PhpCsFixer\\\\Console\\\\Output\\\\Progress\\\\ProgressOutputInterface\\>\\>\\.$#',
'identifier' => 'offsetAccess.notFound',
Expand Down
8 changes: 4 additions & 4 deletions src/Console/Output/Progress/DotsOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class DotsOutput implements ProgressOutputInterface
*
* @var array<FileProcessed::STATUS_*, array{symbol: string, format: string, description: string}>
*/
private static array $eventStatusMap = [
private const EVENT_STATUS_MAP = [
FileProcessed::STATUS_NO_CHANGES => ['symbol' => '.', 'format' => '%s', 'description' => 'no changes'],
FileProcessed::STATUS_FIXED => ['symbol' => 'F', 'format' => '<fg=green>%s</fg=green>', 'description' => 'fixed'],
FileProcessed::STATUS_SKIPPED => ['symbol' => 'S', 'format' => '<fg=cyan>%s</fg=cyan>', 'description' => 'skipped (cached or empty file)'],
Expand Down Expand Up @@ -81,7 +81,7 @@ public function __wakeup(): void

public function onFixerFileProcessed(FileProcessed $event): void
{
$status = self::$eventStatusMap[$event->getStatus()];
$status = self::EVENT_STATUS_MAP[$event->getStatus()];
$this->getOutput()->write($this->getOutput()->isDecorated() ? \sprintf($status['format'], $status['symbol']) : $status['symbol']);

++$this->processedFiles;
Expand All @@ -108,9 +108,9 @@ public function printLegend(): void
{
$symbols = [];

foreach (self::$eventStatusMap as $status) {
foreach (self::EVENT_STATUS_MAP as $status) {
$symbol = $status['symbol'];
if ('' === $symbol || isset($symbols[$symbol])) {
if (isset($symbols[$symbol])) {
continue;
}

Expand Down
9 changes: 9 additions & 0 deletions src/Runner/Event/FileProcessed.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,27 @@ final class FileProcessed extends Event
public const STATUS_EXCEPTION = 5;
public const STATUS_LINT = 6;

/**
* @var self::STATUS_*
*/
private int $status;

private ?string $fileRelativePath;
private ?string $fileHash;

/**
* @param self::STATUS_* $status
*/
public function __construct(int $status, ?string $fileRelativePath = null, ?string $fileHash = null)
{
$this->status = $status;
$this->fileRelativePath = $fileRelativePath;
$this->fileHash = $fileHash;
}

/**
* @return self::STATUS_*
*/
public function getStatus(): int
{
return $this->status;
Expand Down
Loading