Skip to content

Commit

Permalink
Forbid backticks operator (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
asispts committed Nov 10, 2023
1 parent 3409b41 commit f735764
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ptscs/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<exclude name="Ptscs.PSR12.FileHeader.SpacingAfterBlock" />
</rule>

<rule ref="Generic.PHP.BacktickOperator" />

<!--++++++++++++++++++++++++++++++++++++
Additional rules
++++++++++++++++++++++++++++++++++++-->
Expand Down
17 changes: 17 additions & 0 deletions tests/Sniffs/Generic/BacktickOperatorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);

namespace Ptscs\Tests\Sniffs\Generic;

use Iterator;
use Ptscs\Tests\SniffTestCase;
use Ptscs\Tests\Utils\ErrorData;

final class BacktickOperatorTest extends SniffTestCase
{
public static function provideTestData(): Iterator
{
yield [
[new ErrorData(3, 'Generic.PHP.BacktickOperator.Found')],
];
}
}
3 changes: 3 additions & 0 deletions tests/Sniffs/Generic/_data/BacktickOperator.php.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php declare(strict_types=1);

echo `ls -la`;
3 changes: 3 additions & 0 deletions tests/Sniffs/Generic/_data/BacktickOperator.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php declare(strict_types=1);

echo `ls -la`;

0 comments on commit f735764

Please sign in to comment.