Skip to content

Commit

Permalink
Use a single line spacing between class members and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
herndlm authored and ondrejmirtes committed Jun 2, 2022
1 parent a6a4df6 commit 86cf1e5
Show file tree
Hide file tree
Showing 20 changed files with 13 additions and 34 deletions.
18 changes: 11 additions & 7 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing">
<properties>
<property name="linesCountBetweenMembers" value="1"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing">
<properties>
<property name="minLinesCount" value="1"/>
<property name="maxLinesCount" value="1"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
Expand Down Expand Up @@ -124,13 +135,6 @@
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing"/>
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1" />
<property name="spacingBeforeFirst" value="1"/>
<property name="spacingAfterLast" value="1"/>
</properties>
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php</exclude-pattern>
</rule>
Expand Down
1 change: 0 additions & 1 deletion src/Node/ClassMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public function __construct(
{
}


public function getNode(): \PhpParser\Node\Stmt\ClassMethod
{
return $this->node;
Expand Down
1 change: 1 addition & 0 deletions src/Reflection/ParametersAcceptorSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ private static function hasTemplateOrLateResolvableType(Type $type): bool

return $has;
}

/**
* @param array<int|string, Type> $types
* @param ParametersAcceptor[] $parametersAcceptors
Expand Down
1 change: 1 addition & 0 deletions src/Rules/Methods/StaticMethodCallCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function __construct(
)
{
}

/**
* @param Name|Expr $class
* @return array{RuleError[], MethodReflection|null}
Expand Down
1 change: 0 additions & 1 deletion src/Rules/Operators/InvalidAssignVarRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public function processNode(Node $node, Scope $scope): array
return [];
}


private function containsNonAssignableExpression(Expr $expr): bool
{
if ($expr instanceof Expr\Variable) {
Expand Down
1 change: 0 additions & 1 deletion src/Type/Constant/ConstantIntegerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public function getValue(): int
return $this->value;
}


public function isSuperTypeOf(Type $type): TrinaryLogic
{
if ($type instanceof self) {
Expand Down
6 changes: 0 additions & 6 deletions src/Type/IntegerRangeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,16 @@ public function getMin(): ?int
return $this->min;
}


public function getMax(): ?int
{
return $this->max;
}


public function describe(VerbosityLevel $level): string
{
return sprintf('int<%s, %s>', $this->min ?? 'min', $this->max ?? 'max');
}


public function shift(int $amount): Type
{
if ($amount === 0) {
Expand Down Expand Up @@ -193,7 +190,6 @@ public function shift(int $amount): Type
return self::fromInterval($min, $max);
}


public function accepts(Type $type, bool $strictTypes): TrinaryLogic
{
if ($type instanceof parent) {
Expand All @@ -207,7 +203,6 @@ public function accepts(Type $type, bool $strictTypes): TrinaryLogic
return TrinaryLogic::createNo();
}


public function isSuperTypeOf(Type $type): TrinaryLogic
{
if ($type instanceof self || $type instanceof ConstantIntegerType) {
Expand Down Expand Up @@ -267,7 +262,6 @@ public function equals(Type $type): bool
return $type instanceof self && $this->min === $type->min && $this->max === $type->max;
}


public function generalize(GeneralizePrecision $precision): Type
{
return new parent();
Expand Down
1 change: 0 additions & 1 deletion src/Type/JustNullableTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function accepts(Type $type, bool $strictTypes): TrinaryLogic
return TrinaryLogic::createNo();
}


public function isSuperTypeOf(Type $type): TrinaryLogic
{
if ($type instanceof self) {
Expand Down
1 change: 0 additions & 1 deletion src/Type/ObjectWithoutClassType.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public function getSubtractedType(): ?Type
return $this->subtractedType;
}


public function traverse(callable $cb): Type
{
$subtractedType = $this->subtractedType !== null ? $cb($this->subtractedType) : null;
Expand Down
2 changes: 0 additions & 2 deletions src/Type/Php/FilterVarDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ public function getTypeFromFunctionCall(
return $type;
}


private function determineExactType(Type $in, int $filterValue): ?Type
{
if (($filterValue === $this->getConstant('FILTER_VALIDATE_BOOLEAN') && $in instanceof BooleanType)
Expand Down Expand Up @@ -208,7 +207,6 @@ private function getDefault(Node\Arg $expression, Scope $scope): ?Type
return null;
}


private function hasFlag(int $flag, ?Node\Arg $expression, Scope $scope): bool
{
if ($expression === null) {
Expand Down
1 change: 0 additions & 1 deletion src/Type/Php/IsArrayFunctionTypeSpecifyingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function __construct(private bool $explicitMixed)
{
}


public function isFunctionSupported(FunctionReflection $functionReflection, FuncCall $node, TypeSpecifierContext $context): bool
{
return strtolower($functionReflection->getName()) === 'is_array'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public function hasProperty(ClassReflection $classReflection, string $propertyNa
return $classReflection->getName() === 'SimpleXMLElement' || $classReflection->isSubclassOf('SimpleXMLElement');
}


public function getProperty(ClassReflection $classReflection, string $propertyName): PropertyReflection
{
return new SimpleXMLElementProperty($classReflection, new BenevolentUnionType([new ObjectType($classReflection->getName()), new NullType()]));
Expand Down
3 changes: 0 additions & 3 deletions tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6896,7 +6896,6 @@ public function dataWhileLoopVariables(): array
];
}


public function dataForLoopVariables(): array
{
return [
Expand Down Expand Up @@ -6933,8 +6932,6 @@ public function dataForLoopVariables(): array
];
}



/**
* @dataProvider dataLoopVariables
* @dataProvider dataForeachLoopVariables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public function testFormatErrors(
$this->assertSame(trim(Neon::encode(['parameters' => ['ignoreErrors' => $expected]], Neon::BLOCK)), trim($this->getOutputContent()), sprintf('%s: output do not match', $message));
}


public function testFormatErrorMessagesRegexEscape(): void
{
$formatter = new BaselineNeonErrorFormatter(new SimpleRelativePathHelper(self::DIRECTORY_PATH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public function testAssignNewOffsetToStubbedClass(): void
$this->analyse([__DIR__ . '/data/new-offset-stub.php'], []);
}


public function testRuleWithNullsafeVariant(): void
{
if (PHP_VERSION_ID < 80000) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ protected function shouldTreatPhpDocTypesAsCertain(): bool
return $this->treatPhpDocTypesAsCertain;
}


public function testRule(): void
{
$this->treatPhpDocTypesAsCertain = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ public function testFputCsv(): void
]);
}


public function testPutCsvWithStringable(): void
{
if (PHP_VERSION_ID < 80000) {
Expand Down
3 changes: 0 additions & 3 deletions tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,6 @@ public function testGenericsInferCollectionLevel8(): void
]);
}


public function testBug6904(): void
{
if (PHP_VERSION_ID < 80100) {
Expand All @@ -2432,7 +2431,6 @@ public function testBug6904(): void
$this->analyse([__DIR__ . '/data/bug-6904.php'], []);
}


public function testBug6917(): void
{
$this->checkThisOnly = false;
Expand Down Expand Up @@ -2469,7 +2467,6 @@ public function testUnresolvableParameter(): void
]);
}


public function testConditionalComplexTemplates(): void
{
$this->checkThisOnly = false;
Expand Down
1 change: 0 additions & 1 deletion tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ public function testBug6023(): void
$this->analyse([__DIR__ . '/data/bug-6023.php'], []);
}


public function testBug5065(): void
{
$this->checkExplicitMixed = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ public function testBug4808(): void
$this->analyse([__DIR__ . '/data/bug-4808.php'], []);
}


public function testBug5868(): void
{
if (PHP_VERSION_ID < 80000) {
Expand Down

0 comments on commit 86cf1e5

Please sign in to comment.