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 150
Zeile 2... Zeile 2...
2
 
2
 
Zeile 3... Zeile 3...
3
declare(strict_types=1);
3
declare(strict_types=1);
Zeile 4... Zeile -...
4
 
-
 
5
namespace Doctrine\Common\Lexer;
-
 
6
 
-
 
7
use ArrayAccess;
4
 
Zeile 8... Zeile 5...
8
use Doctrine\Deprecations\Deprecation;
5
namespace Doctrine\Common\Lexer;
Zeile 9... Zeile 6...
9
use ReturnTypeWillChange;
6
 
10
use UnitEnum;
7
use UnitEnum;
11
 
8
 
12
use function in_array;
-
 
13
 
9
use function in_array;
14
/**
10
 
15
 * @template T of UnitEnum|string|int
11
/**
16
 * @template V of string|int
12
 * @template T of UnitEnum|string|int
17
 * @implements ArrayAccess<string,mixed>
13
 * @template V of string|int
18
 */
14
 */
19
final class Token implements ArrayAccess
15
final class Token
20
{
16
{
21
    /**
17
    /**
22
     * The string value of the token in the input string
18
     * The string value of the token in the input string
Zeile 23... Zeile 19...
23
     *
19
     *
24
     * @readonly
20
     * @readonly
25
     * @var V
21
     * @var V
26
     */
22
     */
Zeile 36... Zeile 32...
36
 
32
 
37
    /**
33
    /**
38
     * The position of the token in the input string
34
     * The position of the token in the input string
39
     *
35
     *
40
     * @readonly
-
 
41
     * @var int
36
     * @readonly
42
     */
37
     */
Zeile 43... Zeile 38...
43
    public $position;
38
    public int $position;
44
 
39
 
45
    /**
40
    /**
46
     * @param V      $value
41
     * @param V      $value
47
     * @param T|null $type
42
     * @param T|null $type
48
     */
43
     */
49
    public function __construct($value, $type, int $position)
44
    public function __construct(string|int $value, $type, int $position)
50
    {
45
    {
51
        $this->value    = $value;
46
        $this->value    = $value;
52
        $this->type     = $type;
47
        $this->type     = $type;
Zeile 56... Zeile 51...
56
    /** @param T ...$types */
51
    /** @param T ...$types */
57
    public function isA(...$types): bool
52
    public function isA(...$types): bool
58
    {
53
    {
59
        return in_array($this->type, $types, true);
54
        return in_array($this->type, $types, true);
60
    }
55
    }
61
 
-
 
62
    /**
-
 
63
     * @deprecated Use the value, type or position property instead
-
 
64
     * {@inheritDoc}
-
 
65
     */
-
 
66
    public function offsetExists($offset): bool
-
 
67
    {
-
 
68
        Deprecation::trigger(
-
 
69
            'doctrine/lexer',
-
 
70
            'https://github.com/doctrine/lexer/pull/79',
-
 
71
            'Accessing %s properties via ArrayAccess is deprecated, use the value, type or position property instead',
-
 
72
            self::class
-
 
73
        );
-
 
74
 
-
 
75
        return in_array($offset, ['value', 'type', 'position'], true);
-
 
76
    }
-
 
77
 
-
 
78
    /**
-
 
79
     * @deprecated Use the value, type or position property instead
-
 
80
     * {@inheritDoc}
-
 
81
     *
-
 
82
     * @param O $offset
-
 
83
     *
-
 
84
     * @return mixed
-
 
85
     * @psalm-return (
-
 
86
     *     O is 'value'
-
 
87
     *     ? V
-
 
88
     *     : (
-
 
89
     *         O is 'type'
-
 
90
     *         ? T|null
-
 
91
     *         : (
-
 
92
     *             O is 'position'
-
 
93
     *             ? int
-
 
94
     *             : mixed
-
 
95
     *         )
-
 
96
     *     )
-
 
97
     * )
-
 
98
     *
-
 
99
     * @template O of array-key
-
 
100
     */
-
 
101
    #[ReturnTypeWillChange]
-
 
102
    public function offsetGet($offset)
-
 
103
    {
-
 
104
        Deprecation::trigger(
-
 
105
            'doctrine/lexer',
-
 
106
            'https://github.com/doctrine/lexer/pull/79',
-
 
107
            'Accessing %s properties via ArrayAccess is deprecated, use the value, type or position property instead',
-
 
108
            self::class
-
 
109
        );
-
 
110
 
-
 
111
        return $this->$offset;
-
 
112
    }
-
 
113
 
-
 
114
    /**
-
 
115
     * @deprecated no replacement planned
-
 
116
     * {@inheritDoc}
-
 
117
     */
-
 
118
    public function offsetSet($offset, $value): void
-
 
119
    {
-
 
120
        Deprecation::trigger(
-
 
121
            'doctrine/lexer',
-
 
122
            'https://github.com/doctrine/lexer/pull/79',
-
 
123
            'Setting %s properties via ArrayAccess is deprecated',
-
 
124
            self::class
-
 
125
        );
-
 
126
 
-
 
127
        $this->$offset = $value;
-
 
128
    }
-
 
129
 
-
 
130
    /**
-
 
131
     * @deprecated no replacement planned
-
 
132
     * {@inheritDoc}
-
 
133
     */
-
 
134
    public function offsetUnset($offset): void
-
 
135
    {
-
 
136
        Deprecation::trigger(
-
 
137
            'doctrine/lexer',
-
 
138
            'https://github.com/doctrine/lexer/pull/79',
-
 
139
            'Setting %s properties via ArrayAccess is deprecated',
-
 
140
            self::class
-
 
141
        );
-
 
142
 
-
 
143
        $this->$offset = null;
-
 
144
    }
-
 
145
}
56
}