Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 79 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
CSSRuleList | |
0.00% |
0 / 79 |
|
0.00% |
0 / 8 |
1056 | |
0.00% |
0 / 1 |
_getMissingProp | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
12 | |||
_setMissingProp | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
12 | |||
__get | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
__isset | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
offsetExists | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
offsetGet | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
90 | |||
offsetSet | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
30 | |||
offsetUnset | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
30 |
1 | <?php |
2 | |
3 | // AUTOMATICALLY GENERATED. DO NOT EDIT. |
4 | // Use `composer build` to regenerate. |
5 | |
6 | namespace Wikimedia\IDLeDOM\Helper; |
7 | |
8 | trait CSSRuleList { |
9 | |
10 | // Underscore is used to avoid conflicts with DOM-reserved names |
11 | // phpcs:disable PSR2.Methods.MethodDeclaration.Underscore |
12 | // phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName |
13 | |
14 | /** |
15 | * Handle an attempt to get a non-existing property on this |
16 | * object. The default implementation raises an exception |
17 | * but the implementor can choose a different behavior: |
18 | * return null (like JavaScript), dynamically create the |
19 | * property, etc. |
20 | * @param string $prop the name of the property requested |
21 | * @return mixed |
22 | */ |
23 | protected function _getMissingProp( string $prop ) { |
24 | $trace = debug_backtrace(); |
25 | while ( |
26 | count( $trace ) > 0 && |
27 | $trace[0]['function'] !== "__get" |
28 | ) { |
29 | array_shift( $trace ); |
30 | } |
31 | trigger_error( |
32 | 'Undefined property' . |
33 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop . |
34 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
35 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
36 | E_USER_NOTICE |
37 | ); |
38 | return null; |
39 | } |
40 | |
41 | /** |
42 | * Handle an attempt to set a non-existing property on this |
43 | * object. The default implementation raises an exception |
44 | * but the implementor can choose a different behavior: |
45 | * ignore the operation (like JavaScript), dynamically create |
46 | * the property, etc. |
47 | * @param string $prop the name of the property requested |
48 | * @param mixed $value the value to set |
49 | */ |
50 | protected function _setMissingProp( string $prop, $value ): void { |
51 | $trace = debug_backtrace(); |
52 | while ( |
53 | count( $trace ) > 0 && |
54 | $trace[0]['function'] !== "__set" |
55 | ) { |
56 | array_shift( $trace ); |
57 | } |
58 | trigger_error( |
59 | 'Undefined property' . |
60 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop . |
61 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
62 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
63 | E_USER_NOTICE |
64 | ); |
65 | } |
66 | |
67 | // phpcs:enable |
68 | |
69 | /** |
70 | * @param string $name |
71 | * @return mixed |
72 | */ |
73 | public function __get( string $name ) { |
74 | '@phan-var \Wikimedia\IDLeDOM\CSSRuleList $this'; |
75 | // @var \Wikimedia\IDLeDOM\CSSRuleList $this |
76 | switch ( $name ) { |
77 | case "length": |
78 | return $this->getLength(); |
79 | default: |
80 | break; |
81 | } |
82 | '@phan-var \Wikimedia\IDLeDOM\Helper\CSSRuleList $this'; |
83 | // @var \Wikimedia\IDLeDOM\Helper\CSSRuleList $this |
84 | return $this->_getMissingProp( $name ); |
85 | } |
86 | |
87 | /** |
88 | * @param string $name |
89 | * @return bool |
90 | */ |
91 | public function __isset( string $name ): bool { |
92 | '@phan-var \Wikimedia\IDLeDOM\CSSRuleList $this'; |
93 | // @var \Wikimedia\IDLeDOM\CSSRuleList $this |
94 | switch ( $name ) { |
95 | case "length": |
96 | return true; |
97 | default: |
98 | break; |
99 | } |
100 | return false; |
101 | } |
102 | |
103 | /** |
104 | * @param mixed $offset |
105 | * @return bool |
106 | */ |
107 | public function offsetExists( $offset ): bool { |
108 | return $this->offsetGet( $offset ) !== null; |
109 | } |
110 | |
111 | /** |
112 | * @param mixed $offset |
113 | * @return mixed |
114 | */ |
115 | #[\ReturnTypeWillChange] |
116 | public function offsetGet( $offset ) { |
117 | '@phan-var \Wikimedia\IDLeDOM\CSSRuleList $this'; |
118 | // @var \Wikimedia\IDLeDOM\CSSRuleList $this |
119 | if ( is_numeric( $offset ) ) { |
120 | return $this->item( $offset ); |
121 | } elseif ( is_string( $offset ) ) { |
122 | /* Fall through */ |
123 | } |
124 | $trace = debug_backtrace(); |
125 | while ( |
126 | count( $trace ) > 0 && |
127 | $trace[0]['function'] !== "offsetGet" && |
128 | $trace[0]['function'] !== "offsetExists" |
129 | ) { |
130 | array_shift( $trace ); |
131 | } |
132 | while ( |
133 | count( $trace ) > 1 && ( |
134 | $trace[1]['function'] === "offsetGet" || |
135 | $trace[1]['function'] === "offsetExists" |
136 | ) ) { |
137 | array_shift( $trace ); |
138 | } |
139 | trigger_error( |
140 | 'Undefined property' . |
141 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
142 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
143 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
144 | E_USER_NOTICE |
145 | ); |
146 | return null; |
147 | } |
148 | |
149 | /** |
150 | * @param mixed $offset |
151 | * @param mixed $value |
152 | */ |
153 | public function offsetSet( $offset, $value ): void { |
154 | '@phan-var \Wikimedia\IDLeDOM\CSSRuleList $this'; |
155 | // @var \Wikimedia\IDLeDOM\CSSRuleList $this |
156 | if ( is_numeric( $offset ) ) { |
157 | /* Fall through */ |
158 | } elseif ( is_string( $offset ) ) { |
159 | /* Fall through */ |
160 | } |
161 | $trace = debug_backtrace(); |
162 | while ( |
163 | count( $trace ) > 0 && |
164 | $trace[0]['function'] !== "offsetSet" |
165 | ) { |
166 | array_shift( $trace ); |
167 | } |
168 | trigger_error( |
169 | 'Undefined property' . |
170 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
171 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
172 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
173 | E_USER_NOTICE |
174 | ); |
175 | } |
176 | |
177 | /** |
178 | * @param mixed $offset |
179 | */ |
180 | public function offsetUnset( $offset ): void { |
181 | '@phan-var \Wikimedia\IDLeDOM\CSSRuleList $this'; |
182 | // @var \Wikimedia\IDLeDOM\CSSRuleList $this |
183 | if ( is_numeric( $offset ) ) { |
184 | /* Fall through */ |
185 | } elseif ( is_string( $offset ) ) { |
186 | /* Fall through */ |
187 | } |
188 | $trace = debug_backtrace(); |
189 | while ( |
190 | count( $trace ) > 0 && |
191 | $trace[0]['function'] !== "offsetUnset" |
192 | ) { |
193 | array_shift( $trace ); |
194 | } |
195 | trigger_error( |
196 | 'Undefined property' . |
197 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
198 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
199 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
200 | E_USER_NOTICE |
201 | ); |
202 | } |
203 | |
204 | } |