Skip to content

Commit 0c26acb

Browse files
committed
Ignore if a user uses concats. Fixes #63
1 parent fce0f6c commit 0c26acb

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/Tests/Tests/epv_test_validate_php_functions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ private function validateMethodCalls(Node $node) {
385385
{
386386
$name = $this->getMethodName($node);
387387
}
388-
else if (isset($node->expr) && $node->expr instanceof Node\Expr\MethodCall && !($node->expr->name instanceof Variable) && !($node->expr->name instanceof PropertyFetch))
388+
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))
389389
{
390390
$name = (string)$node->expr->name;
391391
}

tests/epv_test_validate_php_functions_test.php

+12
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ public function test_usage_of_var_test() {
140140
$tester->validateFile($file);
141141
}
142142

143+
public function test_usage_of_var_test2() {
144+
$output = $this->getOutputMock();
145+
$output->expects($this->exactly(0))
146+
->method('addMessage')
147+
;
148+
149+
$file = $this->getLoader()->loadFile('tests/testFiles/var_test2.php');
150+
151+
$tester = new \Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions(false, $output, '/a/b/', 'epv/test', false, '/a/');
152+
$tester->validateFile($file);
153+
}
154+
143155
private function getLoader()
144156
{
145157
return $file = new \Phpbb\Epv\Files\FileLoader(new \Phpbb\Epv\Tests\Mock\Output(), false, '.', '.');

tests/testFiles/var_test2.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace tests\testFiles;
4+
5+
class var_test2
6+
{
7+
8+
public function __construct()
9+
{
10+
$name = 'test';
11+
$result = $this->{'validate_' . $name}();
12+
}
13+
}

0 commit comments

Comments
 (0)