Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Commit

Permalink
Open bracket is allowed (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickl88 authored and nutama committed Dec 5, 2017
1 parent 82e2aba commit 8cd7528
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Sniff/CurlySniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public function process(File $file, int $stack_ptr): void
if ($stack_ptr > 1) {
$before = $file->get($stack_ptr - 1);

if ($before->type !== Token::T_WHITESPACE || $before->chars !== ' ') {
if ($before->type !== Token::T_OPENBRACKET &&
($before->type !== Token::T_WHITESPACE || $before->chars !== ' ')
) {
$file->addViolation(
self::class,
'There must be one space before a curly bracket.',
Expand Down
1 change: 1 addition & 0 deletions test/Sniff/fixtures/curly.less
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@
.bad5 { color: #ffffff; }
.bad6
{ color: #ffffff; }
.function({ color: #ffffff; });

0 comments on commit 8cd7528

Please sign in to comment.