Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/CSSStyleDeclaration.php

raw
1 <?php
2
3 // AUTOMATICALLY GENERATED. DO NOT EDIT.
4 // Use `composer build` to regenerate.
5
6 namespace Wikimedia\IDLeDOM\Helper;
7
8 trait CSSStyleDeclaration {
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\CSSStyleDeclaration $this';
75 // @var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this
76 switch ( $name ) {
77 case "cssText":
78 return $this->getCssText();
79 case "length":
80 return $this->getLength();
81 case "parentRule":
82 return $this->getParentRule();
83 case "cssFloat":
84 return $this->getCssFloat();
85 default:
86 break;
87 }
88 '@phan-var \Wikimedia\IDLeDOM\Helper\CSSStyleDeclaration $this';
89 // @var \Wikimedia\IDLeDOM\Helper\CSSStyleDeclaration $this
90 return $this->_getMissingProp( $name );
91 }
92
93 /**
94 * @param string $name
95 * @return bool
96 */
97 public function __isset( string $name ): bool {
98 '@phan-var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this';
99 // @var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this
100 switch ( $name ) {
101 case "cssText":
102 return true;
103 case "length":
104 return true;
105 case "parentRule":
106 return $this->getParentRule() !== null;
107 case "cssFloat":
108 return true;
109 default:
110 break;
111 }
112 return false;
113 }
114
115 /**
116 * @param string $name
117 * @param mixed $value
118 */
119 public function __set( string $name, $value ): void {
120 '@phan-var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this';
121 // @var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this
122 switch ( $name ) {
123 case "cssText":
124 $this->setCssText( $value );
125 return;
126 case "cssFloat":
127 $this->setCssFloat( $value );
128 return;
129 default:
130 break;
131 }
132 '@phan-var \Wikimedia\IDLeDOM\Helper\CSSStyleDeclaration $this';
133 // @var \Wikimedia\IDLeDOM\Helper\CSSStyleDeclaration $this
134 $this->_setMissingProp( $name, $value );
135 }
136
137 /**
138 * @param string $name
139 */
140 public function __unset( string $name ): void {
141 '@phan-var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this';
142 // @var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this
143 switch ( $name ) {
144 case "cssText":
145 break;
146 case "length":
147 break;
148 case "parentRule":
149 break;
150 case "cssFloat":
151 break;
152 default:
153 return;
154 }
155 $trace = debug_backtrace();
156 while (
157 count( $trace ) > 0 &&
158 $trace[0]['function'] !== "__unset"
159 ) {
160 array_shift( $trace );
161 }
162 trigger_error(
163 'Undefined property' .
164 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
165 ' in ' . ( $trace[0]['file'] ?? '' ) .
166 ' on line ' . ( $trace[0]['line'] ?? '' ),
167 E_USER_NOTICE
168 );
169 }
170
171 /**
172 * @param mixed $offset
173 * @return bool
174 */
175 public function offsetExists( $offset ): bool {
176 return $this->offsetGet( $offset ) !== null;
177 }
178
179 /**
180 * @param mixed $offset
181 * @return mixed
182 */
183 #[\ReturnTypeWillChange]
184 public function offsetGet( $offset ) {
185 '@phan-var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this';
186 // @var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this
187 if ( is_numeric( $offset ) ) {
188 return $this->item( $offset );
189 } elseif ( is_string( $offset ) ) {
190 /* Fall through */
191 }
192 $trace = debug_backtrace();
193 while (
194 count( $trace ) > 0 &&
195 $trace[0]['function'] !== "offsetGet" &&
196 $trace[0]['function'] !== "offsetExists"
197 ) {
198 array_shift( $trace );
199 }
200 while (
201 count( $trace ) > 1 && (
202 $trace[1]['function'] === "offsetGet" ||
203 $trace[1]['function'] === "offsetExists"
204 ) ) {
205 array_shift( $trace );
206 }
207 trigger_error(
208 'Undefined property' .
209 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
210 ' in ' . ( $trace[0]['file'] ?? '' ) .
211 ' on line ' . ( $trace[0]['line'] ?? '' ),
212 E_USER_NOTICE
213 );
214 return null;
215 }
216
217 /**
218 * @param mixed $offset
219 * @param mixed $value
220 */
221 public function offsetSet( $offset, $value ): void {
222 '@phan-var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this';
223 // @var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this
224 if ( is_numeric( $offset ) ) {
225 /* Fall through */
226 } elseif ( is_string( $offset ) ) {
227 /* Fall through */
228 }
229 $trace = debug_backtrace();
230 while (
231 count( $trace ) > 0 &&
232 $trace[0]['function'] !== "offsetSet"
233 ) {
234 array_shift( $trace );
235 }
236 trigger_error(
237 'Undefined property' .
238 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
239 ' in ' . ( $trace[0]['file'] ?? '' ) .
240 ' on line ' . ( $trace[0]['line'] ?? '' ),
241 E_USER_NOTICE
242 );
243 }
244
245 /**
246 * @param mixed $offset
247 */
248 public function offsetUnset( $offset ): void {
249 '@phan-var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this';
250 // @var \Wikimedia\IDLeDOM\CSSStyleDeclaration $this
251 if ( is_numeric( $offset ) ) {
252 /* Fall through */
253 } elseif ( is_string( $offset ) ) {
254 /* Fall through */
255 }
256 $trace = debug_backtrace();
257 while (
258 count( $trace ) > 0 &&
259 $trace[0]['function'] !== "offsetUnset"
260 ) {
261 array_shift( $trace );
262 }
263 trigger_error(
264 'Undefined property' .
265 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
266 ' in ' . ( $trace[0]['file'] ?? '' ) .
267 ' on line ' . ( $trace[0]['line'] ?? '' ),
268 E_USER_NOTICE
269 );
270 }
271
272 }