Conditions | 5 |
Paths | 7 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5.2742 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 17 | public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false) |
|
24 | { |
||
25 | 17 | if (!$block instanceof TableCell) { |
|
26 | throw new \InvalidArgumentException('Incompatible block type: '.get_class($block)); |
||
27 | } |
||
28 | |||
29 | 17 | $attrs = []; |
|
30 | 17 | foreach ($block->getData('attributes', []) as $key => $value) { |
|
31 | $attrs[$key] = Xml::escape($value, true); |
||
32 | } |
||
33 | |||
34 | 17 | if ($block->align) { |
|
35 | 4 | $attrs['style'] = (isset($attrs['style']) ? $attrs['style'] . ' ' : '') . 'text-align: ' . $block->align; |
|
36 | } |
||
37 | |||
38 | 17 | return new HtmlElement($block->type, $attrs, $htmlRenderer->renderInlines($block->children())); |
|
|
|||
39 | } |
||
40 | } |
||
41 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: