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 2 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
3 changes: 3 additions & 0 deletions src/Libero/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
</rule>
<rule ref="Squiz.Classes.ClassFileName"/>
<rule ref="Squiz.PHP.InnerFunctions"/>
<rule ref="Squiz.Strings.DoubleQuoteUsage">
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do with feedback. I find them simpler to read/write, but it's limited what you can do and behaviour is odd sometimes (https://stackoverflow.com/a/43437427).

</rule>
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
Expand Down
2 changes: 1 addition & 1 deletion tests/RulesetTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function cases() : iterable
if (empty($parts['contents'])) {
throw new LogicException("Couldn't find contents in {$file->getRelativePathname()}");
} elseif (empty(select_keys($parts, $keys))) {
throw new LogicException("Expected one of ".implode(', ', $keys)." in {$file->getRelativePathname()}");
throw new LogicException('Expected one of '.implode(', ', $keys)." in {$file->getRelativePathname()}");
}

try {
Expand Down
23 changes: 23 additions & 0 deletions tests/cases/php/string-quotes
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---DESCRIPTION---
Double quotes must not be used for strings unless required
---CONTENTS---
<?php

declare(strict_types=1);

$foo = "bar";
$baz = "qux {$quux}";
$quuz = "'";
$corge = "\n";

---FIXED---
<?php

declare(strict_types=1);

$foo = 'bar';
$baz = "qux {$quux}";
$quuz = "'";
$corge = "\n";

---