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: 2 additions & 0 deletions src/Libero/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
</rule>

<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.PHP.BacktickOperator"/>
<rule ref="Generic.PHP.LowerCaseType"/>
Expand Down Expand Up @@ -43,6 +44,7 @@
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing"/>
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
Expand Down
31 changes: 31 additions & 0 deletions tests/cases/php/short-arrays
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---DESCRIPTION---
Short arrays must be used
---CONTENTS---
<?php

declare(strict_types=1);

$foo = array('bar');

$baz = array(
'qux',
);

$quux = function (array $quuz = array()) {
};

---FIXED---
<?php

declare(strict_types=1);

$foo = ['bar'];

$baz = [
'qux',
];

$quux = function (array $quuz = []) {
};

---
23 changes: 23 additions & 0 deletions tests/cases/php/short-list
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---DESCRIPTION---
Short list must be used
---CONTENTS---
<?php

declare(strict_types=1);

list($foo, $bar) = [$baz, $qux];

foreach ($quux as list('quuz' => $corge, 'grault' => $plugh)) {
}

---FIXED---
<?php

declare(strict_types=1);

[$foo, $bar] = [$baz, $qux];

foreach ($quux as ['quuz' => $corge, 'grault' => $plugh]) {
}

---