1 | <?php |
||
17 | class Renderer |
||
18 | { |
||
19 | protected $namespace = 'window'; |
||
20 | |||
21 | protected $transformers = [ |
||
22 | ArrayTransformer::class, |
||
23 | BooleanTransformer::class, |
||
24 | NullTransformer::class, |
||
25 | NumericTransformer::class, |
||
26 | ObjectTransformer::class, |
||
27 | StringTransformer::class, |
||
28 | ]; |
||
29 | |||
30 | public function __construct(Repository $config) |
||
34 | |||
35 | /** |
||
36 | * @param array ...$arguments |
||
37 | * |
||
38 | * @return string |
||
39 | * |
||
40 | * @throws \Throwable |
||
41 | */ |
||
42 | public function render(...$arguments): string |
||
50 | |||
51 | /** |
||
52 | * @param $arguments |
||
53 | * |
||
54 | * @return mixed |
||
55 | */ |
||
56 | protected function normalizeArguments(array $arguments) |
||
72 | |||
73 | public function buildJavaScriptSyntax(array $variables): string |
||
83 | |||
84 | protected function buildNamespaceDeclaration(): string |
||
92 | |||
93 | /** |
||
94 | * @param string $key |
||
95 | * @param mixed $value |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | protected function buildVariableInitialization(string $key, $value) |
||
105 | |||
106 | /** |
||
107 | * @param mixed $value |
||
108 | * |
||
109 | * @return string |
||
110 | * |
||
111 | * @throws \Spatie\BladeJavaScript\Exceptions\Untransformable |
||
112 | */ |
||
113 | protected function optimizeValueForJavaScript($value): string |
||
117 | |||
118 | public function getAllTransformers(): Collection |
||
124 | |||
125 | /** |
||
126 | * @param mixed $value |
||
127 | * |
||
128 | * @return \Spatie\BladeJavaScript\Transformers\Transformer |
||
129 | * |
||
130 | * @throws \Spatie\BladeJavaScript\Exceptions\Untransformable |
||
131 | */ |
||
132 | public function getTransformer($value): Transformer |
||
142 | } |
||
143 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: