• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FluidTYPO3 / vhs / 27192659298

30 Apr 2026 09:50AM UTC coverage: 72.022%. Remained the same
27192659298

push

github

web-flow
[TASK] Replace non-canonical cast names (boolean) and (integer) with (bool) and (int) (#1968)

The non-canonical cast names (boolean) and (integer) are deprecated as of PHP 8.5
https://www.php.net/manual/de/migration85.deprecated.php

100 of 129 new or added lines in 53 files covered. (77.52%)

5648 of 7842 relevant lines covered (72.02%)

19.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

16.13
/Classes/ViewHelpers/Iterator/ForViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Iterator;
3

4
/*
5
 * This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
12

13
/**
14
 * Repeats rendering of children with a typical for loop: starting at
15
 * index $from it will loop until the index has reached $to.
16
 */
17
class ForViewHelper extends AbstractLoopViewHelper
18
{
19
    public function initializeArguments(): void
20
    {
21
        parent::initializeArguments();
7✔
22
        $this->registerArgument('to', 'integer', 'Number that the index needs to reach before stopping', true);
7✔
23
        $this->registerArgument('from', 'integer', 'Starting number for the index', false, 0);
7✔
24
        $this->registerArgument(
7✔
25
            'step',
7✔
26
            'integer',
7✔
27
            'Stepping number that the index is increased by after each loop',
7✔
28
            false,
7✔
29
            1
7✔
30
        );
7✔
31
    }
32

33
    /**
34
     * @return mixed
35
     */
36
    public static function renderStatic(
37
        array $arguments,
38
        \Closure $renderChildrenClosure,
39
        RenderingContextInterface $renderingContext
40
    ) {
41
        /** @var int|string $to */
42
        $to = $arguments['to'];
×
43
        /** @var int|string $from */
44
        $from = $arguments['from'];
×
45
        /** @var int|string $step */
46
        $step = $arguments['step'];
×
47
        /** @var string|null $iteration */
48
        $iteration = $arguments['iteration'];
×
49
        $content = '';
×
50
        $variableProvider = $renderingContext->getVariableProvider();
×
51

NEW
52
        $to = (int) $to;
×
NEW
53
        $from = (int) $from;
×
NEW
54
        $step = (int) $step;
×
55

56
        if (0 === $step) {
×
57
            throw new \RuntimeException('"step" may not be 0.', 1383267698);
×
58
        }
59
        if ($from < $to && 0 > $step) {
×
60
            throw new \RuntimeException('"step" must be greater than 0 if "from" is smaller than "to".', 1383268407);
×
61
        }
62
        if ($from > $to && 0 < $step) {
×
63
            throw new \RuntimeException('"step" must be smaller than 0 if "from" is greater than "to".', 1383268415);
×
64
        }
65

66
        if ($iteration !== null && $variableProvider->exists($iteration)) {
×
67
            $backupVariable = $variableProvider->get($iteration);
×
68
            $variableProvider->remove($iteration);
×
69
        }
70

71
        if ($from === $to) {
×
72
            $content = static::renderIteration(
×
73
                $from,
×
74
                $from,
×
75
                $to,
×
76
                $step,
×
77
                $iteration,
×
78
                $renderingContext,
×
79
                $renderChildrenClosure
×
80
            );
×
81
        } elseif ($from < $to) {
×
82
            for ($i = $from; $i <= $to; $i += $step) {
×
83
                $content .= static::renderIteration(
×
84
                    $i,
×
85
                    $from,
×
86
                    $to,
×
87
                    $step,
×
88
                    $iteration,
×
89
                    $renderingContext,
×
90
                    $renderChildrenClosure
×
91
                );
×
92
            }
93
        } else {
94
            for ($i = $from; $i >= $to; $i += $step) {
×
95
                $content .= static::renderIteration(
×
96
                    $i,
×
97
                    $from,
×
98
                    $to,
×
99
                    $step,
×
100
                    $iteration,
×
101
                    $renderingContext,
×
102
                    $renderChildrenClosure
×
103
                );
×
104
            }
105
        }
106

107
        if ($iteration !== null && isset($backupVariable)) {
×
108
            $variableProvider->add($iteration, $backupVariable);
×
109
        }
110

111
        return $content;
×
112
    }
113
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc