Skip to content

Commit

Permalink
Merge pull request #390 from ergebnis/fix/wrapping
Browse files Browse the repository at this point in the history
Fix: Wrapping
  • Loading branch information
localheinz authored Nov 8, 2021
2 parents 5433f83 + f50f947 commit 1687e7f
Show file tree
Hide file tree
Showing 23 changed files with 100 additions and 50 deletions.
12 changes: 8 additions & 4 deletions src/Classes/FinalRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ final class FinalRule implements Rule
/**
* @param string[] $classesNotRequiredToBeAbstractOrFinal
*/
public function __construct(bool $allowAbstractClasses, array $classesNotRequiredToBeAbstractOrFinal)
{
public function __construct(
bool $allowAbstractClasses,
array $classesNotRequiredToBeAbstractOrFinal
) {
$this->allowAbstractClasses = $allowAbstractClasses;
$this->classesNotRequiredToBeAbstractOrFinal = \array_map(static function (string $classNotRequiredToBeAbstractOrFinal): string {
return $classNotRequiredToBeAbstractOrFinal;
Expand All @@ -65,8 +67,10 @@ public function getNodeType(): string
return Node\Stmt\Class_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\Class_) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Classes/NoExtendsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public function getNodeType(): string
return Node\Stmt\Class_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\Class_) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Classes/PHPUnit/Framework/TestCaseWithSuffixRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ public function getNodeType(): string
return Node\Stmt\Class_::class;
}

public function processNode(Node $node, Analyser\Scope $scope): array
{
public function processNode(
Node $node,
Analyser\Scope $scope
): array {
if (!$node instanceof Node\Stmt\Class_) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Closures/NoNullableReturnTypeDeclarationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getNodeType(): string
return Node\Expr\Closure::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Expr\Closure) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Closures/NoParameterWithNullDefaultValueRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getNodeType(): string
return Node\Expr\Closure::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Expr\Closure) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Closures/NoParameterWithNullableTypeDeclarationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getNodeType(): string
return Node\Expr\Closure::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Expr\Closure) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Expressions/NoCompactRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getNodeType(): string
return Node\Expr\FuncCall::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Expr\FuncCall) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Expressions/NoEmptyRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public function getNodeType(): string
return Node\Expr\Empty_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
return [
'Language construct empty() should not be used.',
];
Expand Down
6 changes: 4 additions & 2 deletions src/Expressions/NoErrorSuppressionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public function getNodeType(): string
return Node\Expr\ErrorSuppress::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
return [
'Error suppression via "@" should not be used.',
];
Expand Down
6 changes: 4 additions & 2 deletions src/Expressions/NoEvalRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public function getNodeType(): string
return Node\Expr\Eval_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
return [
'Language construct eval() should not be used.',
];
Expand Down
6 changes: 4 additions & 2 deletions src/Expressions/NoIssetRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public function getNodeType(): string
return Node\Expr\Isset_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
return [
'Language construct isset() should not be used.',
];
Expand Down
6 changes: 4 additions & 2 deletions src/Files/DeclareStrictTypesRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public function getNodeType(): string
return FileNode::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof FileNode) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Functions/NoNullableReturnTypeDeclarationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getNodeType(): string
return Node\Stmt\Function_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\Function_) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Functions/NoParameterWithNullDefaultValueRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getNodeType(): string
return Node\Stmt\Function_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\Function_) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Functions/NoParameterWithNullableTypeDeclarationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getNodeType(): string
return Node\Stmt\Function_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\Function_) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Methods/FinalInAbstractClassRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public function getNodeType(): string
return Node\Stmt\ClassMethod::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\ClassMethod) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Methods/NoConstructorParameterWithDefaultValueRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public function getNodeType(): string
return Node\Stmt\ClassMethod::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\ClassMethod) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Methods/NoNullableReturnTypeDeclarationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public function getNodeType(): string
return Node\Stmt\ClassMethod::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\ClassMethod) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
12 changes: 8 additions & 4 deletions src/Methods/NoParameterWithContainerTypeDeclarationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ final class NoParameterWithContainerTypeDeclarationRule implements Rule
/**
* @param array<int, string> $interfacesImplementedByContainers
*/
public function __construct(Reflection\ReflectionProvider $reflectionProvider, array $interfacesImplementedByContainers)
{
public function __construct(
Reflection\ReflectionProvider $reflectionProvider,
array $interfacesImplementedByContainers
) {
$this->reflectionProvider = $reflectionProvider;
$this->interfacesImplementedByContainers = \array_filter(
\array_map(static function (string $interfaceImplementedByContainers): string {
Expand All @@ -52,8 +54,10 @@ public function getNodeType(): string
return Node\Stmt\ClassMethod::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\ClassMethod) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Methods/NoParameterWithNullDefaultValueRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public function getNodeType(): string
return Node\Stmt\ClassMethod::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\ClassMethod) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Methods/NoParameterWithNullableTypeDeclarationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public function getNodeType(): string
return Node\Stmt\ClassMethod::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\ClassMethod) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Methods/PrivateInFinalClassRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public function getNodeType(): string
return Node\Stmt\ClassMethod::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
if (!$node instanceof Node\Stmt\ClassMethod) {
throw new ShouldNotHappenException(\sprintf(
'Expected node to be instance of "%s", but got instance of "%s" instead.',
Expand Down
6 changes: 4 additions & 2 deletions src/Statements/NoSwitchRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public function getNodeType(): string
return Node\Stmt\Switch_::class;
}

public function processNode(Node $node, Scope $scope): array
{
public function processNode(
Node $node,
Scope $scope
): array {
return [
'Control structures using switch should not be used.',
];
Expand Down

0 comments on commit 1687e7f

Please sign in to comment.