1 | <?php |
||
13 | trait ResolveExpressionTrait |
||
14 | { |
||
15 | /** |
||
16 | * @param FuncCall $funcCall |
||
17 | * @param Context $context |
||
18 | * @return string|bool |
||
19 | * @throws \PHPSA\Exception\RuntimeException |
||
20 | */ |
||
21 | 7 | public function resolveFunctionName(FuncCall $funcCall, Context $context) |
|
22 | { |
||
23 | 7 | $funcNameCompiledExpression = $context->getExpressionCompiler()->compile($funcCall->name); |
|
|
|||
24 | |||
25 | 7 | if ($funcNameCompiledExpression->isString() && $funcNameCompiledExpression->isCorrectValue()) { |
|
26 | 7 | return $funcNameCompiledExpression->getValue(); |
|
27 | } else if (!$funcNameCompiledExpression->isCallable()) { |
||
28 | $context->debug( |
||
29 | 'Unexpected function name type ' . $funcNameCompiledExpression->getType(), |
||
30 | $funcCall->name |
||
31 | ); |
||
32 | } |
||
33 | |||
34 | return false; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @param \PhpParser\Node[] $nodes |
||
39 | * @return \PhpParser\Node\Stmt\Return_ |
||
40 | */ |
||
41 | protected function findReturnStatement(array $nodes) |
||
49 | |||
50 | /** |
||
51 | * For the code above |
||
52 | * Я атеист, но когда я начинал это писать, только Бог и я понимали, что я делаю |
||
53 | * Сейчас остался только Бог |
||
54 | */ |
||
55 | |||
56 | /** |
||
57 | * @param Node $node |
||
58 | * @return \Generator |
||
59 | */ |
||
60 | protected function traverseNode(Node $node) |
||
78 | |||
79 | /** |
||
80 | * @param array $nodes |
||
81 | * @return \Generator |
||
82 | */ |
||
83 | protected function traverseArray(array $nodes) |
||
97 | } |
||
98 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.