Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Wrapping #390

Merged
merged 1 commit into from
Nov 8, 2021
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
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
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