Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"php": "^7.2",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4 || ^0.5",
"slevomat/coding-standard": "^5.0",
"squizlabs/php_codesniffer": "^3.3.2"
"squizlabs/php_codesniffer": "^3.4"
},
"require-dev": {
"ext-mbstring": "*",
Expand Down
8 changes: 8 additions & 0 deletions src/Libero/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
</rule>
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="spacingBeforeFirst" value="0"/>
<property name="spacingAfterLast" value="0"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
Expand Down
52 changes: 52 additions & 0 deletions tests/cases/classes/method-spacing
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---DESCRIPTION---
Methods must not have unnecessary whitespace
---FILENAME---
Foo.php
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

abstract class Foo
{

public function bar() : void
{

$baz = 'qux';

}


abstract public function quux() : void;
public function quuz() : void
{

}

}

---FIXED---
<?php

declare(strict_types=1);

namespace Vendor;

abstract class Foo
{
public function bar() : void
{
$baz = 'qux';
}

abstract public function quux() : void;

public function quuz() : void
{
}
}

---
27 changes: 27 additions & 0 deletions tests/cases/closures/spacing
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---DESCRIPTION---
Closures must not have unnecessary whitespace
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

$foo = function () : void {

$baz = 'qux';

};

---FIXED---
<?php

declare(strict_types=1);

namespace Vendor;

$foo = function () : void {
$baz = 'qux';
};

---
2 changes: 2 additions & 0 deletions tests/cases/functions/nested
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ function foo() : void

---MESSAGES---
9:5 Squiz.PHP.InnerFunctions.NotAllowed
---IGNORE-MESSAGES---
11:5 Squiz.WhiteSpace.FunctionSpacing.After
---
48 changes: 48 additions & 0 deletions tests/cases/functions/spacing
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---DESCRIPTION---
Functions must not have unnecessary whitespace
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

function foo() : void
{

$bar = 'baz';

}


function qux() : void
{


}
function quux() : void
{

}

---FIXED---
<?php

declare(strict_types=1);

namespace Vendor;

function foo() : void
{
$bar = 'baz';
}

function qux() : void
{
}

function quux() : void
{
}

---
39 changes: 39 additions & 0 deletions tests/cases/interfaces/method-spacing
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---DESCRIPTION---
Methods must not have unnecessary whitespace
---FILENAME---
Foo.php
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

interface Foo
{

public function bar() : void;


public function quux() : void;
public function quuz() : void;

}

---FIXED---
<?php

declare(strict_types=1);

namespace Vendor;

interface Foo
{
public function bar() : void;

public function quux() : void;

public function quuz() : void;
}

---
52 changes: 52 additions & 0 deletions tests/cases/trait/method-spacing
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---DESCRIPTION---
Methods must not have unnecessary whitespace
---FILENAME---
Foo.php
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

trait Foo
{

public function bar() : void
{

$baz = 'qux';

}


abstract public function quux() : void;
public function quuz() : void
{

}

}

---FIXED---
<?php

declare(strict_types=1);

namespace Vendor;

trait Foo
{
public function bar() : void
{
$baz = 'qux';
}

abstract public function quux() : void;

public function quuz() : void
{
}
}

---