We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * (c) Kitodo. Key to digital objects e.V. <[email protected]> |
||
5 | * |
||
6 | * This file is part of the Kitodo and TYPO3 projects. |
||
7 | * |
||
8 | * @license GNU General Public License version 3 or later. |
||
9 | * For the full copyright and license information, please read the |
||
10 | * LICENSE.txt file that was distributed with this source code. |
||
11 | */ |
||
12 | |||
13 | namespace Kitodo\Dlf\ViewHelpers; |
||
14 | |||
15 | use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; |
||
16 | use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; |
||
17 | |||
18 | /** |
||
19 | * Checks if the given subject is an array. |
||
20 | */ |
||
21 | class IsArrayViewHelper extends AbstractViewHelper |
||
22 | { |
||
23 | public function initializeArguments() |
||
24 | { |
||
25 | parent::initializeArguments(); |
||
26 | $this->registerArgument('subject', 'string', 'The subject'); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @return bool |
||
31 | */ |
||
32 | public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
||
33 | { |
||
34 | $subject = $arguments['subject']; |
||
35 | if ($subject === null) { |
||
36 | $subject = $renderChildrenClosure(); |
||
37 | } |
||
38 | |||
39 | return \is_array($subject); |
||
0 ignored issues
–
show
|
|||
40 | } |
||
41 | } |
||
42 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: