Skip to content

Commit

Permalink
#26 - add OperatorSpacingSniff (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baakoma authored Sep 6, 2021
1 parent b896c7b commit 02df56d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Configuration/Defaults/CommonAdditionalRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Blumilk\Codestyle\Fixers\BinaryOperatorSpacesFixer;
use Blumilk\Codestyle\Fixers\DoubleQuoteFixer;
use Blumilk\Codestyle\Fixers\NoSpacesAfterFunctionNameFixer;
use PHP_CodeSniffer\Standards\PSR12\Sniffs\Operators\OperatorSpacingSniff;
use PhpCsFixer\Fixer\CastNotation\CastSpacesFixer;
use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
use PhpCsFixer\Fixer\FunctionNotation\UseArrowFunctionsFixer;
Expand Down Expand Up @@ -44,6 +45,7 @@ class CommonAdditionalRules extends Rules implements AdditionalRules
],
],
NoExtraBlankLinesFixer::class => null,
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
"arrays",
Expand Down
11 changes: 11 additions & 0 deletions tests/codestyle/fixtures/operatorSpacing/actual.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$a=1+2;

$b=$a===3;

$c=$a<5;

$d=!$c;
11 changes: 11 additions & 0 deletions tests/codestyle/fixtures/operatorSpacing/expected.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$a = 1 + 2;

$b = $a === 3;

$c = $a < 5;

$d = !$c;
5 changes: 5 additions & 0 deletions tests/unit/AdditionalRulesConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Blumilk\Codestyle\Fixers\BinaryOperatorSpacesFixer;
use Blumilk\Codestyle\Fixers\DoubleQuoteFixer;
use Blumilk\Codestyle\Fixers\NoSpacesAfterFunctionNameFixer;
use PHP_CodeSniffer\Standards\PSR12\Sniffs\Operators\OperatorSpacingSniff;
use PhpCsFixer\Fixer\Alias\NoMixedEchoPrintFixer;
use PhpCsFixer\Fixer\CastNotation\CastSpacesFixer;
use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
Expand Down Expand Up @@ -53,6 +54,7 @@ public function testAdditionalRulesConfiguration(): void
],
],
NoExtraBlankLinesFixer::class => null,
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
"arrays",
Expand Down Expand Up @@ -99,6 +101,7 @@ public function testFilteringAdditionalRulesConfiguration(): void
],
],
NoExtraBlankLinesFixer::class => null,
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
"arrays",
Expand Down Expand Up @@ -142,6 +145,7 @@ public function testExtendingAdditionalRulesConfiguration(): void
],
],
NoExtraBlankLinesFixer::class => null,
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
"arrays",
Expand Down Expand Up @@ -193,6 +197,7 @@ public function testExtendingWithOptionsAdditionalRulesConfiguration(): void
],
],
NoExtraBlankLinesFixer::class => null,
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
"arrays",
Expand Down

0 comments on commit 02df56d

Please sign in to comment.