forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-12063.php
More file actions
38 lines (31 loc) · 837 Bytes
/
bug-12063.php
File metadata and controls
38 lines (31 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php declare(strict_types=1);
namespace Bug12063;
use BadFunctionCallException;
final class View
{
public function existingMethod(): void
{
}
}
final class TwigExtension
{
private View $viewFunctions;
public function __construct(View $viewFunctions)
{
$this->viewFunctions = $viewFunctions;
}
public function iterateFunctions(): void
{
$functionMappings = [
'i_exist' => 'existingMethod',
'i_dont_exist' => 'nonExistingMethod'
];
$functions = [];
foreach ($functionMappings as $nameFrom => $nameTo) {
$callable = [$this->viewFunctions, $nameTo];
if (!is_callable($callable)) {
throw new BadFunctionCallException("Function $nameTo does not exist in view functions");
}
}
}
}