Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeliot-Tm committed May 21, 2024
1 parent a3053e3 commit 0486abc
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 19 deletions.
6 changes: 3 additions & 3 deletions functions/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function cs_fixer_get_baseline(): array
$path = cs_fixer_get_baseline_file_path();

return file_exists($path)
? json_decode(file_get_contents($path), true, 512, JSON_THROW_ON_ERROR)
? json_decode(file_get_contents($path), true, 512, \JSON_THROW_ON_ERROR)
: [];
}

Expand Down Expand Up @@ -50,7 +50,7 @@ function cs_fixer_get_config_hash(PhpCsFixer\Config $config): int

ksort($data);

return crc32(json_encode($data, JSON_THROW_ON_ERROR));
return crc32(json_encode($data, \JSON_THROW_ON_ERROR));
}

/**
Expand All @@ -65,5 +65,5 @@ function cs_fixer_put_baseline(array $hashes, PhpCsFixer\Config $config): void
'hashes' => $hashes,
];
$path = cs_fixer_get_baseline_file_path();
file_put_contents($path, json_encode($baseline, JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT));
file_put_contents($path, json_encode($baseline, \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT));
}
2 changes: 1 addition & 1 deletion src/Model/BaselineContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public function jsonSerialize(): array

return $baseline;
}
}
}
2 changes: 1 addition & 1 deletion src/Model/BaselineFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public function getLockedFilesCount(): int
{
return $this->content->getHashesCount();
}
}
}
2 changes: 1 addition & 1 deletion src/Model/FileHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public function jsonSerialize(): array
{
return ['hash' => $this->hash];
}
}
}
3 changes: 1 addition & 2 deletions src/Service/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

final class Builder
{

private ConfigHashCalculator $configHashCalculator;
private FileCacheCalculator $fileCacheCalculator;

Expand All @@ -32,4 +31,4 @@ public function create(string $path, Config $config, Finder $finder): BaselineFi

return new BaselineFile($path, $content);
}
}
}
5 changes: 2 additions & 3 deletions src/Service/ConfigHashCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ final class ConfigHashCalculator
{
public function calculate(Config $config): int
{

$rules = $config->getRules();
sort($rules);

Expand All @@ -19,6 +18,6 @@ public function calculate(Config $config): int

ksort($data);

return crc32(json_encode($data, JSON_THROW_ON_ERROR));
return crc32(json_encode($data, \JSON_THROW_ON_ERROR));
}
}
}
2 changes: 1 addition & 1 deletion src/Service/FileCacheCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ public function calculate(\SplFileInfo $file): string
{
return crc32(file_get_contents($file->getPathname()));
}
}
}
2 changes: 1 addition & 1 deletion src/Service/FileComparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public function isInBaseLine(BaselineContent $content, \SplFileInfo $file): bool

return $hash && $hash === $this->fileCacheCalculator->calculate($file);
}
}
}
2 changes: 1 addition & 1 deletion src/Service/FilterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public function createFilter(string $path, Config $config): \Closure
return !$isSameConfig || $comparator->isInBaseLine($baseline, $file);
};
}
}
}
4 changes: 2 additions & 2 deletions src/Service/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class Reader
public function read(string $path): BaselineFile
{
$json = file_exists($path)
? json_decode(file_get_contents($path), true, 512, JSON_THROW_ON_ERROR)
? json_decode(file_get_contents($path), true, 512, \JSON_THROW_ON_ERROR)
: [];

$content = new BaselineContent();
Expand All @@ -25,4 +25,4 @@ public function read(string $path): BaselineFile

return new BaselineFile($path, $content);
}
}
}
4 changes: 2 additions & 2 deletions src/Service/Saver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ final class Saver
{
public function save(BaselineFile $baseline): void
{
file_put_contents($baseline->getPath(), json_encode($baseline, JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT));
file_put_contents($baseline->getPath(), json_encode($baseline, \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT));
}
}
}
2 changes: 1 addition & 1 deletion tests/Unit/Model/FileHashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public function testGetters(): void
self::assertSame($path, $fileHash->getPath());
self::assertSame(['hash' => $hash], $fileHash->jsonSerialize());
}
}
}

0 comments on commit 0486abc

Please sign in to comment.