Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/Tests/Tests/epv_test_validate_php_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,8 @@ private function validateMethodCalls(Node $node) {
}
else if (isset($node->expr)
&& $node->expr instanceof Node\Expr\MethodCall
&& !($node->expr->name instanceof Variable
|| $node->expr->name instanceof PropertyFetch
|| $node->expr->name instanceof Concat
|| $node->expr->name instanceof Node\Scalar\Encapsed
|| $node->expr->name instanceof Node\Expr\Ternary
&& ($node->expr->name instanceof Node\Identifier
|| $node->expr->name instanceof Node\Name
)
)
{
Expand Down
12 changes: 12 additions & 0 deletions tests/epv_test_validate_php_functions_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ public function test_usage_variable() {
$tester->validateFile($file);
}

public function test_usage_dynamic_method_name_in_assignment() {
$output = $this->getOutputMock();
$output->expects(self::exactly(0))
->method('addMessage')
;

$file = $this->getLoader()->loadFile('tests/testFiles/dynamic_method_call.php');

$tester = new epv_test_validate_php_functions(false, $output, '/a/b/', 'epv/test', false, '/a/');
$tester->validateFile($file);
}

private function getLoader()
{
return new FileLoader(new Output(), false, '.', '.');
Expand Down
17 changes: 17 additions & 0 deletions tests/testFiles/dynamic_method_call.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* @package phpBB Extension - Test
*/

namespace epv\test;

class dynamic_method_call
{
public function run($methods, $step)
{
$removed = $this->store->{$methods[$step]}(self::DELETE_STEP);
$other = $this->store->{$methods['a']}();
$named = $this->store->delete_step();
return $removed;
}
}
Loading