From 391696bc839b82a440e39f5813b631c16c54c087 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sat, 16 Sep 2017 13:28:33 -0400 Subject: [PATCH] Use a blacklist, not a whitelist --- src/Psalm/Checker/Statements/Expression/CallChecker.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Checker/Statements/Expression/CallChecker.php b/src/Psalm/Checker/Statements/Expression/CallChecker.php index 181e919aa..e9503f179 100644 --- a/src/Psalm/Checker/Statements/Expression/CallChecker.php +++ b/src/Psalm/Checker/Statements/Expression/CallChecker.php @@ -1704,8 +1704,12 @@ class CallChecker if ($function_param && $function_param->by_ref - && !($arg->value instanceof PhpParser\Node\Expr\Variable) - && !($arg->value instanceof PhpParser\Node\Expr\PropertyFetch) + && ($arg->value instanceof PhpParser\Node\Scalar + || $arg->value instanceof PhpParser\Node\Expr\ClassConstFetch + || $arg->value instanceof PhpParser\Node\Expr\ConstFetch + || $arg->value instanceof PhpParser\Node\Expr\FuncCall + || $arg->value instanceof PhpParser\Node\Expr\MethodCall + ) ) { if (IssueBuffer::accepts( new InvalidPassByReference(