Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 621
Zeile 1... Zeile 1...
1
<?php declare(strict_types=1);
1
<?php declare(strict_types=1);
2
/*
2
/*
3
 * This file is part of the Recursion Context package.
3
 * This file is part of sebastian/recursion-context.
4
 *
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
6
 *
7
 * For the full copyright and license information, please view the LICENSE
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
8
 * file that was distributed with this source code.
9
 */
9
 */
10
namespace SebastianBergmann\RecursionContext;
10
namespace SebastianBergmann\RecursionContext;
Zeile 11... Zeile 11...
11
 
11
 
12
use const PHP_INT_MAX;
12
use const PHP_INT_MAX;
-
 
13
use const PHP_INT_MIN;
13
use const PHP_INT_MIN;
14
use function array_key_exists;
14
use function array_pop;
15
use function array_pop;
15
use function array_slice;
16
use function array_slice;
16
use function count;
17
use function count;
17
use function is_array;
18
use function is_array;
Zeile 126... Zeile 127...
126
        }
127
        }
Zeile 127... Zeile 128...
127
 
128
 
128
        $key            = count($this->arrays);
129
        $key            = count($this->arrays);
Zeile 129... Zeile 130...
129
        $this->arrays[] = &$array;
130
        $this->arrays[] = &$array;
130
 
131
 
131
        if (!isset($array[PHP_INT_MAX]) && !isset($array[PHP_INT_MAX - 1])) {
132
        if (!array_key_exists(PHP_INT_MAX, $array) && !array_key_exists(PHP_INT_MAX - 1, $array)) {
132
            $array[] = $key;
133
            $array[] = $key;
-
 
134
            $array[] = $this->objects;
-
 
135
        } else { /* cover the improbable case too */
-
 
136
            /* Note that array_slice (used in containsArray) will return the
-
 
137
             * last two values added *not necessarily* the highest integer
133
            $array[] = $this->objects;
138
             * keys in the array, so the order of these writes to $array
134
        } else { /* cover the improbable case too */
139
             * is important, but the actual keys used is not. */
135
            do {
140
            do {
Zeile 136... Zeile 141...
136
                $key = random_int(PHP_INT_MIN, PHP_INT_MAX);
141
                $key = random_int(PHP_INT_MIN, PHP_INT_MAX);
Zeile 137... Zeile 142...
137
            } while (isset($array[$key]));
142
            } while (array_key_exists($key, $array));
138
 
143
 
139
            $array[$key] = $key;
144
            $array[$key] = $key;
Zeile 140... Zeile 145...
140
 
145
 
141
            do {
146
            do {
Zeile 142... Zeile 147...
142
                $key = random_int(PHP_INT_MIN, PHP_INT_MAX);
147
                $key = random_int(PHP_INT_MIN, PHP_INT_MAX);