Skip to content

Commit

Permalink
Merge pull request #34 from spaze/spaze/optional-parentheses
Browse files Browse the repository at this point in the history
Make parentheses optional in disallowed calls definition
  • Loading branch information
spaze authored Sep 29, 2020
2 parents fce3aa4 + 6ed9a88 commit 935a645
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/DisallowedCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DisallowedCall
*/
public function __construct(string $call, ?string $message, array $allowIn, array $allowParamsInAllowed, array $allowParamsAnywhere)
{
$this->call = $call;
$this->call = (substr($call, -2) === '()' ? $call : $call . '()');
$this->message = $message;
$this->allowIn = $allowIn;
$this->allowParamsInAllowed = $allowParamsInAllowed;
Expand Down
2 changes: 1 addition & 1 deletion tests/FunctionCallsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function getRule(): Rule
]
],
[
'function' => 'printf()',
'function' => 'printf',
'allowIn' => [
'src/disallowed-allowed/*.php',
'src/*-allow/*.*',
Expand Down
2 changes: 1 addition & 1 deletion tests/MethodCallsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function getRule(): Rule
],
],
[
'method' => 'Traits\TestTrait::x()',
'method' => 'Traits\TestTrait::x',
'message' => 'method TestTrait::x() is dangerous',
'allowIn' => [
'src/disallowed-allowed/*.php',
Expand Down
2 changes: 1 addition & 1 deletion tests/StaticCallsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function getRule(): Rule
'allowParamsInAllowed' => [],
],
[
'method' => 'Fiction\Pulp\Royale::withoutCheese()',
'method' => 'Fiction\Pulp\Royale::withoutCheese',
'message' => 'a Quarter Pounder without Cheese?',
'allowIn' => [
'src/disallowed-allowed/*.php',
Expand Down

0 comments on commit 935a645

Please sign in to comment.