Skip to content

Commit

Permalink
Revert "Ruleset: there is need for extra line above control structure"
Browse files Browse the repository at this point in the history
This reverts commit 310e6eb.
  • Loading branch information
f3l1x committed Dec 6, 2024
1 parent 08cd9fd commit 10e6b8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 2 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@
</properties>
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing">
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeControlStructure" />
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeFirstControlStructure" />
<properties>
<property name="controlStructures" type="array">
<element value="if"/>
Expand Down
2 changes: 0 additions & 2 deletions tests/Sets/base/2-bad/Foobar.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function __construct()
*/
public function isBaz($value): bool
{

if (is_bool($value)) {
return true;
}
Expand Down Expand Up @@ -78,7 +77,6 @@ protected function getForEach(): array
{
$result = [];


foreach ($this->foo as $foo) {
if (strlen($foo) === self::FOO_LENGTH) {
continue;
Expand Down
16 changes: 6 additions & 10 deletions tests/Sets/base/2-bad/snapshot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
<checkstyle version="%A%">
<file name="Foobar.php">
<error line="46" column="12" severity="error" message="Method \Tests\Base\Foobar::isBaz() does not have native type hint for its parameter $value but it should be possible to add it based on @param annotation &quot;mixed&quot;." source="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
<error line="47" column="5" severity="error" message="Expected 0 blank lines after opening function brace; 1 found" source="Squiz.WhiteSpace.FunctionOpeningBraceSpace.SpacingAfter"/>
<error line="49" column="9" severity="error" message="Expected 0 lines before &quot;if&quot;, found 1." source="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeFirstControlStructure"/>
<error line="80" column="1" severity="error" message="Functions must not contain multiple empty lines in a row; found 2 empty lines" source="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"/>
<error line="82" column="9" severity="error" message="Expected 1 line before &quot;foreach&quot;, found 2." source="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeControlStructure"/>
<error line="128" column="9" severity="error" message="Unused variable $class1." source="SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable"/>
<error line="128" column="19" severity="error" message="Class \Tests\Fixtures\DummyClass should not be referenced via a fully qualified name, but via a use statement." source="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName"/>
<error line="130" column="9" severity="error" message="Unused variable $class2." source="SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable"/>
<error line="130" column="19" severity="error" message="Partial use statements are not allowed, but referencing Fixtures\DummyClass found." source="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.PartialUse"/>
<error line="132" column="9" severity="error" message="Unused variable $class3." source="SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable"/>
<error line="132" column="19" severity="error" message="Partial use statements are not allowed, but referencing FixturesAlias\DummyClass found." source="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.PartialUse"/>
<error line="126" column="9" severity="error" message="Unused variable $class1." source="SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable"/>
<error line="126" column="19" severity="error" message="Class \Tests\Fixtures\DummyClass should not be referenced via a fully qualified name, but via a use statement." source="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName"/>
<error line="128" column="9" severity="error" message="Unused variable $class2." source="SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable"/>
<error line="128" column="19" severity="error" message="Partial use statements are not allowed, but referencing Fixtures\DummyClass found." source="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.PartialUse"/>
<error line="130" column="9" severity="error" message="Unused variable $class3." source="SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable"/>
<error line="130" column="19" severity="error" message="Partial use statements are not allowed, but referencing FixturesAlias\DummyClass found." source="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.PartialUse"/>
</file>
<file name="TFoo.php">
<error line="12" column="15" severity="error" message="Property \Tests\Base\TFoo::$foobar does not have native type hint for its value but it should be possible to add it based on @var annotation &quot;mixed&quot;." source="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
Expand Down

0 comments on commit 10e6b8c

Please sign in to comment.