Skip to content

Commit

Permalink
add php-cs-fixer rule "single_line_empty_body" (qossmic#1217)
Browse files Browse the repository at this point in the history
  • Loading branch information
gennadigennadigennadi authored Jun 6, 2023
1 parent e96628d commit fd635ed
Show file tree
Hide file tree
Showing 80 changed files with 80 additions and 202 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'array_indentation' => true,
'single_line_empty_body' => true,
'global_namespace_import' => [
'import_constants' => true,
'import_functions' => true,
Expand Down
4 changes: 1 addition & 3 deletions src/Contract/Analyser/PostProcessEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
*/
final class PostProcessEvent extends Event
{
public function __construct(private AnalysisResult $result)
{
}
public function __construct(private AnalysisResult $result) {}

public function getResult(): AnalysisResult
{
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/Analyser/ProcessEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public function __construct(
public readonly TokenReferenceInterface $dependentReference,
public readonly array $dependentLayers,
private AnalysisResult $result = new AnalysisResult()
) {
}
) {}

public function getResult(): AnalysisResult
{
Expand Down
4 changes: 1 addition & 3 deletions src/Contract/Ast/AstFileAnalysedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@
*/
final class AstFileAnalysedEvent extends Event
{
public function __construct(public readonly string $file)
{
}
public function __construct(public readonly string $file) {}
}
3 changes: 1 addition & 2 deletions src/Contract/Ast/AstFileSyntaxErrorEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ final class AstFileSyntaxErrorEvent extends Event
public function __construct(
public readonly string $file,
public readonly string $syntaxError
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Contract/Ast/FileOccurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ final class FileOccurrence
public function __construct(
public readonly string $filepath,
public readonly int $line
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Contract/Ast/PostCreateAstMapEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@
/**
* Event triggered after the AST map of all files has been created.
*/
final class PostCreateAstMapEvent extends Event
{
}
final class PostCreateAstMapEvent extends Event {}
3 changes: 1 addition & 2 deletions src/Contract/Ast/PreCreateAstMapEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ final class PreCreateAstMapEvent extends Event
{
public function __construct(
public readonly int $expectedFileCount
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Contract/Config/Collector/BoolConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ final class BoolConfig extends CollectorConfig
/** @var array<CollectorConfig> */
private array $must = [];

private function __construct()
{
}
private function __construct() {}

/**
* @param array<CollectorConfig> $must
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/Config/Collector/ComposerConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ final class ComposerConfig extends CollectorConfig
private function __construct(
private readonly string $composerPath,
private readonly string $composerLockPath,
) {
}
) {}

/**
* @param list<string> $packages
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/Config/Collector/SuperGlobalConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ final class SuperGlobalConfig extends CollectorConfig
*/
private function __construct(
protected array $config,
) {
}
) {}

public static function create(string ...$config): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/Config/ConfigurableCollectorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ abstract class ConfigurableCollectorConfig extends CollectorConfig

final protected function __construct(
protected string $config,
) {
}
) {}

public static function create(string $config): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/Config/Formatter/CodeclimateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ private function __construct(
private CodeclimateLevelEnum $failure,
private CodeclimateLevelEnum $skipped,
private CodeclimateLevelEnum $uncovered,
) {
}
) {}

public static function create(
CodeclimateLevelEnum $failure = CodeclimateLevelEnum::BLOCKER,
Expand Down
4 changes: 1 addition & 3 deletions src/Contract/Config/Formatter/GraphvizConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ final class GraphvizConfig implements FormatterConfigInterface
/** @var array<string, Layer[]> */
private array $groups = [];

private function __construct()
{
}
private function __construct() {}

public static function create(): self
{
Expand Down
4 changes: 1 addition & 3 deletions src/Contract/Dependency/PostEmitEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@
/**
* Event triggered after all the dependencies have been resolved.
*/
final class PostEmitEvent extends Event
{
}
final class PostEmitEvent extends Event {}
4 changes: 1 addition & 3 deletions src/Contract/Dependency/PostFlattenEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@
*
* This occurs when all dependencies caused by class inheritance have been resolved.
*/
final class PostFlattenEvent extends Event
{
}
final class PostFlattenEvent extends Event {}
3 changes: 1 addition & 2 deletions src/Contract/Dependency/PreEmitEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ final class PreEmitEvent extends Event
{
public function __construct(
public readonly string $emitterName
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Contract/Dependency/PreFlattenEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@
*
* This occurs when all dependencies caused by class inheritance have been resolved.
*/
final class PreFlattenEvent extends Event
{
}
final class PreFlattenEvent extends Event {}
4 changes: 1 addition & 3 deletions src/Contract/Layer/LayerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ final class LayerProvider
/**
* @param array<string, list<string>> $allowedLayers source layer -> target layers
*/
public function __construct(private readonly array $allowedLayers)
{
}
public function __construct(private readonly array $allowedLayers) {}

/**
* @return list<string>
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/OutputFormatter/OutputFormatterInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ public function __construct(
public readonly bool $reportSkipped,
public readonly bool $reportUncovered,
public readonly bool $failOnUncovered
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Contract/Result/Allowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public function __construct(
private readonly DependencyInterface $dependency,
private readonly string $dependerLayer,
private readonly string $dependentLayer
) {
}
) {}

public function getDependency(): DependencyInterface
{
Expand Down
4 changes: 1 addition & 3 deletions src/Contract/Result/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
*/
final class Error implements Stringable
{
public function __construct(private readonly string $message)
{
}
public function __construct(private readonly string $message) {}

public function __toString()
{
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/Result/OutputResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ private function __construct(
public readonly array $rules,
public readonly array $errors,
public readonly array $warnings
) {
}
) {}

public static function fromAnalysisResult(AnalysisResult $analysisResult): self
{
Expand Down
4 changes: 1 addition & 3 deletions src/Contract/Result/SkippedViolation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
*/
final class SkippedViolation implements CoveredRuleInterface
{
public function __construct(private readonly DependencyInterface $dependency, private readonly string $dependerLayer, private readonly string $dependentLayer)
{
}
public function __construct(private readonly DependencyInterface $dependency, private readonly string $dependerLayer, private readonly string $dependentLayer) {}

public function getDependency(): DependencyInterface
{
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/Result/Uncovered.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ final class Uncovered implements RuleInterface
public function __construct(
private readonly DependencyInterface $dependency,
public readonly string $layer
) {
}
) {}

public function getDependency(): DependencyInterface
{
Expand Down
3 changes: 1 addition & 2 deletions src/Contract/Result/Violation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function __construct(
private readonly string $dependerLayer,
private readonly string $dependentLayer,
private readonly ViolationCreatingInterface $violationCreatingRule
) {
}
) {}

public function getDependency(): DependencyInterface
{
Expand Down
4 changes: 1 addition & 3 deletions src/Contract/Result/Warning.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
*/
final class Warning implements Stringable
{
public function __construct(private readonly string $message)
{
}
public function __construct(private readonly string $message) {}

/**
* @param string[] $layerNames
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Analyser/DependencyLayersAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public function __construct(
private readonly TokenResolver $tokenResolver,
private readonly LayerResolverInterface $layerResolver,
private readonly EventDispatcherInterface $eventDispatcher
) {
}
) {}

/**
* @throws AnalyserException
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Analyser/EventHandler/DependsOnDisallowedLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
*/
class DependsOnDisallowedLayer implements ViolationCreatingInterface
{
public function __construct(private readonly EventHelper $eventHelper)
{
}
public function __construct(private readonly EventHelper $eventHelper) {}

public static function getSubscribedEvents()
{
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Analyser/EventHandler/DependsOnInternalToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
*/
class DependsOnInternalToken implements ViolationCreatingInterface
{
public function __construct(private readonly EventHelper $eventHelper)
{
}
public function __construct(private readonly EventHelper $eventHelper) {}

public static function getSubscribedEvents()
{
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Analyser/EventHandler/DependsOnPrivateLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
*/
class DependsOnPrivateLayer implements ViolationCreatingInterface
{
public function __construct(private readonly EventHelper $eventHelper)
{
}
public function __construct(private readonly EventHelper $eventHelper) {}

public static function getSubscribedEvents()
{
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Analyser/EventHandler/UncoveredDependentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
*/
class UncoveredDependentHandler implements EventSubscriberInterface
{
public function __construct(private readonly bool $ignoreUncoveredInternalClasses)
{
}
public function __construct(private readonly bool $ignoreUncoveredInternalClasses) {}

public function invoke(ProcessEvent $event): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
*/
class UnmatchedSkippedViolations implements EventSubscriberInterface
{
public function __construct(private readonly EventHelper $eventHelper)
{
}
public function __construct(private readonly EventHelper $eventHelper) {}

public function handleUnmatchedSkipped(PostProcessEvent $event): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Analyser/LayerDependenciesAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public function __construct(
private readonly TokenResolver $tokenResolver,
private readonly DependencyResolver $dependencyResolver,
private readonly LayerResolverInterface $layerResolver
) {
}
) {}

/**
* @return array<string, list<Uncovered>>
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Analyser/LayerForTokenAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public function __construct(
private readonly AstMapExtractor $astMapExtractor,
private readonly TokenResolver $tokenResolver,
private readonly LayerResolverInterface $layerResolver
) {
}
) {}

/**
* @return array<string, string[]>
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Analyser/RulesetUsageAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public function __construct(
private readonly DependencyResolver $dependencyResolver,
private readonly TokenResolver $tokenResolver,
private readonly array $layers
) {
}
) {}

/**
* @return array<string, array<string, int>>
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Ast/AstLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class AstLoader
public function __construct(
private readonly ParserInterface $parser,
private readonly EventDispatcherInterface $eventDispatcher
) {
}
) {}

/**
* @param list<string> $files
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Ast/AstMap/AstInherit.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public function __construct(
public readonly FileOccurrence $fileOccurrence,
public readonly AstInheritType $type,
private readonly array $path = []
) {
}
) {}

/**
* @return AstInherit[]
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Ast/AstMap/ClassLike/ClassLikeToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

final class ClassLikeToken implements TokenInterface
{
private function __construct(private readonly string $className)
{
}
private function __construct(private readonly string $className) {}

public static function fromFQCN(string $className): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Ast/AstMap/DependencyToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ public function __construct(
public readonly TokenInterface $token,
public readonly FileOccurrence $fileOccurrence,
public readonly DependencyType $type
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Core/Ast/AstMap/Function/FunctionReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
private readonly FunctionToken $functionName,
public readonly array $dependencies = [],
private readonly ?FileReference $fileReference = null
) {
}
) {}

public function withFileReference(FileReference $astFileReference): self
{
Expand Down
Loading

0 comments on commit fd635ed

Please sign in to comment.