Skip to content

Commit

Permalink
Force camelCase variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Jul 1, 2019
1 parent 0434b7a commit 7ddc10d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/Doctrine/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@
</rule>
<!-- Forbid global functions -->
<rule ref="Squiz.Functions.GlobalFunction"/>
<!-- Force camelCase variables -->
<rule ref="Squiz.NamingConventions.ValidVariableName">
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
</rule>
<!-- Forbid `AND` and `OR`, require `&&` and `||` -->
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
<!-- Forbid `global` -->
Expand Down
3 changes: 2 additions & 1 deletion tests/expected_report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ tests/input/forbidden-functions.php 6 0
tests/input/inline_type_hint_assertions.php 6 0
tests/input/LowCaseTypes.php 2 0
tests/input/namespaces-spacing.php 7 0
tests/input/NamingCamelCase.php 7 0
tests/input/new_with_parentheses.php 18 0
tests/input/not_spacing.php 8 0
tests/input/null_coalesce_operator.php 3 0
Expand All @@ -35,7 +36,7 @@ tests/input/UnusedVariables.php 1 0
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
A TOTAL OF 264 ERRORS AND 0 WARNINGS WERE FOUND IN 31 FILES
A TOTAL OF 271 ERRORS AND 0 WARNINGS WERE FOUND IN 32 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 216 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Expand Down
22 changes: 22 additions & 0 deletions tests/fixed/NamingCamelCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace Example;

class NamingCamelCase
{
/** @var mixed */
public $A;

/** @var mixed */
protected $B;

/** @var mixed */
private $C;

public function fcn(string $A) : void
{
$Test = $A;
}
}
22 changes: 22 additions & 0 deletions tests/input/NamingCamelCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace Example;

class NamingCamelCase
{
/** @var mixed */
public $A;

/** @var mixed */
protected $B;

/** @var mixed */
private $C;

public function fcn(string $A) : void
{
$Test = $A;
}
}

0 comments on commit 7ddc10d

Please sign in to comment.