@@ -187,3 +187,202 @@ class WidgetBadNestedClassAlsoExtends extends WP_Widget {
187187 };
188188 }
189189}
190+
191+
192+ class WidgetOkayNoVisibilityMeansPublic extends WP_Widget {
193+ function widget ( $ args , $ instance ) {}
194+ function update ( $ new_instance , $ old_instance ) {}
195+ function form ( $ instance ) {}
196+ function WP_Widget ( $ id_base , $ name , $ widget_options = array (), $ control_options = array () ) {}
197+ function get_field_name ( $ field_name ) {}
198+ function get_field_id ( $ field_name ) {}
199+ function _register () {}
200+ function _set ( $ number ) {}
201+ function _get_display_callback () {}
202+ function _get_update_callback () {}
203+ function _get_form_callback () {}
204+ function is_preview () {}
205+ function display_callback ( $ args , $ widget_args = 1 ) {}
206+ function update_callback ( $ deprecated = 1 ) {}
207+ function form_callback ( $ widget_args = 1 ) {}
208+ function _register_one ( $ number = -1 ) {}
209+ function save_settings ( $ settings ) {}
210+ function get_settings () {}
211+ }
212+
213+ class WidgetWrongVisibility extends WP_Widget {
214+ // Not a method we're interested in. Should be ignored.
215+ private function custom_method ($ whatever , $ you , $ want = null ) {}
216+
217+ protected function widget ( $ args , $ instance ) {}
218+ private function update ( $ new_instance , $ old_instance ) {}
219+ protected function form ( $ instance ) {}
220+ private function WP_Widget ( $ id_base , $ name , $ widget_options = array (), $ control_options = array () ) {}
221+ protected function get_field_name ( $ field_name ) {}
222+ private function get_field_id ( $ field_name ) {}
223+ protected function _register () {}
224+ private function _set ( $ number ) {}
225+ protected function _get_display_callback () {}
226+ private function _get_update_callback () {}
227+ protected function _get_form_callback () {}
228+ private function is_preview () {}
229+ protected function display_callback ( $ args , $ widget_args = 1 ) {}
230+ private function update_callback ( $ deprecated = 1 ) {}
231+ protected function form_callback ( $ widget_args = 1 ) {}
232+ private function _register_one ( $ number = -1 ) {}
233+ protected function save_settings ( $ settings ) {}
234+ private function get_settings () {}
235+ }
236+
237+ class WidgetIncorrectReturnByRef extends WP_Widget {
238+ // Not a method we're interested in. Should be ignored.
239+ public function &custom_method ($ whatever , $ you , $ want = null ) {}
240+
241+ // Methods which are being checked.
242+ public function &widget ( $ args , $ instance ) {}
243+ public function &update ( $ new_instance , $ old_instance ) {}
244+ public function &form ( $ instance ) {}
245+ public function &WP_Widget ( $ id_base , $ name , $ widget_options = array (), $ control_options = array () ) {}
246+ public function &get_field_name ( $ field_name ) {}
247+ public function &get_field_id ( $ field_name ) {}
248+ public function &_register () {}
249+ public function &_set ( $ number ) {}
250+ public function &_get_display_callback () {}
251+ public function &_get_update_callback () {}
252+ public function &_get_form_callback () {}
253+ public function &is_preview () {}
254+ public function &display_callback ( $ args , $ widget_args = 1 ) {}
255+ public function &update_callback ( $ deprecated = 1 ) {}
256+ public function &form_callback ( $ widget_args = 1 ) {}
257+ public function &_register_one ( $ number = -1 ) {}
258+ public function &save_settings ( $ settings ) {}
259+ public function &get_settings () {}
260+ }
261+
262+ // Parameter name mismatches cause issues with PHP 8.0 named parameters.
263+ class WidgetBadParameterNameMismatch extends WP_Widget {
264+ public function widget ( $ arg , $ intance ) {}
265+ public function update ( $ new , $ old ) {}
266+ public function form ( $ inst ) {}
267+ public function WP_Widget ( $ base , $ widget_name , $ options = array (), $ controls = array () ) {}
268+ public function get_field_name ( $ field ) {}
269+ public function get_field_id ( $ field ) {}
270+ public function _set ( $ num ) {}
271+ public function display_callback ( $ arg , $ widgetArgs = 1 ) {}
272+ public function update_callback ( $ unused = 1 ) {}
273+ public function form_callback ( $ args = 1 ) {}
274+ public function _register_one ( $ nr = -1 ) {}
275+ public function save_settings ( $ setting ) {}
276+ }
277+
278+ class WidgetOkayParameterTypesAreContraVariantAndMixedIsCompatibleWithNoType extends WP_Widget {
279+ public function widget ( mixed $ args , mixed $ instance ) {}
280+ public function update ( mixed $ new_instance , mixed $ old_instance ) {}
281+ public function form ( mixed $ instance ) {}
282+ public function WP_Widget ( mixed $ id_base , mixed $ name , mixed $ widget_options = array (), mixed $ control_options = array () ) {}
283+ public function get_field_name ( mixed $ field_name ) {}
284+ public function get_field_id ( mixed $ field_name ) {}
285+ public function _set ( mixed $ number ) {}
286+ public function display_callback ( mixed $ args , mixed $ widget_args = 1 ) {}
287+ public function update_callback ( mixed $ deprecated = 1 ) {}
288+ public function form_callback ( mixed $ widget_args = 1 ) {}
289+ public function _register_one ( mixed $ number = -1 ) {}
290+ public function save_settings ( mixed $ settings ) {}
291+ }
292+
293+ class WidgetBadParameterTypesAreContraVariant extends WP_Widget {
294+ public function widget ( array $ args , array $ instance ) {}
295+ public function update ( array $ new_instance , array $ old_instance ) {}
296+ public function form ( array $ instance ) {}
297+ public function WP_Widget ( string $ id_base , string $ name , array $ widget_options = array (), array $ control_options = array () ) {}
298+ public function get_field_name ( string $ field_name ) {}
299+ public function get_field_id ( string $ field_name ) {}
300+ public function _set ( int $ number ) {}
301+ public function display_callback ( array $ args , int |array $ widget_args = 1 ) {}
302+ public function update_callback ( int $ deprecated = 1 ) {}
303+ public function form_callback ( int |array $ widget_args = 1 ) {}
304+ public function _register_one ( int $ number = -1 ) {}
305+ public function save_settings ( array $ settings ) {}
306+ }
307+
308+ class WidgetOkayReturnTypesAreCovariantAndTypeMatchesExpectation extends WP_Widget {
309+ public function widget ( $ args , $ instance ): void {}
310+ public function update ( $ new_instance , $ old_instance ) : array |false {}
311+ public function form ( $ instance ) : string {}
312+ public function WP_Widget ( $ id_base , $ name , $ widget_options = array (), $ control_options = array () ): void {}
313+ public function get_field_name ( $ field_name ) : string {}
314+ public function get_field_id ( $ field_name ) : string {}
315+ public function _register () : void {}
316+ public function _set ( $ number ): void {}
317+ public function _get_display_callback (): callable {}
318+ public function _get_update_callback () : callable {}
319+ public function _get_form_callback () : callable {}
320+ public function is_preview (): bool {}
321+ public function display_callback ( $ args , $ widget_args = 1 ): int |array {}
322+ public function update_callback ( $ deprecated = 1 ): void {}
323+ public function form_callback ( $ widget_args = 1 ): string |null {}
324+ public function _register_one ( $ number = -1 ) : void {}
325+ public function save_settings ( $ settings ): void {}
326+ public function get_settings (): array {}
327+ }
328+
329+ class WidgetOkayReturnTypesAreCovariantAndTypeMatchesExpectationToo extends WP_Widget {
330+ public function form ( $ instance ) : void {}
331+ public function display_callback ( $ args , $ widget_args = 1 ): int {}
332+ public function form_callback ( $ widget_args = 1 ): ?string {}
333+ }
334+
335+ class WidgetOkayReturnTypesAreCovariantAndTypeMatchesExpectationThree extends WP_Widget {
336+ public function display_callback ( $ args , $ widget_args = 1 ): array {}
337+ public function form_callback ( $ widget_args = 1 ): string {}
338+ }
339+
340+ class WidgetOkayReturnTypesAreCovariantAndTypeMatchesExpectationFour extends WP_Widget {
341+ public function form_callback ( $ widget_args = 1 ): null {}
342+ }
343+
344+ class WidgetOkayReturnTypesAreCovariantAndMixedWillAlwaysWork extends WP_Widget {
345+ public function widget ( $ args , $ instance ): mixed {}
346+ public function update ( $ new_instance , $ old_instance ) : mixed {}
347+ public function form ( $ instance ) : mixed {}
348+ public function WP_Widget ( $ id_base , $ name , $ widget_options = array (), $ control_options = array () ): mixed {}
349+ public function get_field_name ( $ field_name ) : mixed {}
350+ public function get_field_id ( $ field_name ) : mixed {}
351+ public function _register () : mixed {}
352+ public function _set ( $ number ): mixed {}
353+ public function _get_display_callback (): mixed {}
354+ public function _get_update_callback () : mixed {}
355+ public function _get_form_callback () : mixed {}
356+ public function is_preview (): mixed {}
357+ public function display_callback ( $ args , $ widget_args = 1 ): mixed {}
358+ public function update_callback ( $ deprecated = 1 ) : mixed {}
359+ public function form_callback ( $ widget_args = 1 ) : mixed {}
360+ public function _register_one ( $ number = -1 ) : mixed {}
361+ public function save_settings ( $ settings ) : mixed {}
362+ public function get_settings () : mixed {}
363+ }
364+
365+ class WidgetBadReturnTypeDoesNotMatchExpectation extends WP_Widget {
366+ // Not a method we're interested in. Should be ignored.
367+ public function custom_method ($ whatever , $ you , $ want = null ): never {}
368+
369+ // Methods which are being checked.
370+ public function widget ( $ args , $ instance ) : string {}
371+ public function update ( $ new_instance , $ old_instance ): void {}
372+ public function form ( $ instance ): int {}
373+ public function WP_Widget ( $ id_base , $ name , $ widget_options = array (), $ control_options = array () ): null {}
374+ public function get_field_name ( $ field_name ): false {}
375+ public function get_field_id ( $ field_name ): string |true {}
376+ public function _register () : bool {}
377+ public function _set ( $ number ) : int {}
378+ public function _get_display_callback () : ?callable {}
379+ public function _get_update_callback (): object {}
380+ public function _get_form_callback (): array {}
381+ public function is_preview (): float {}
382+ public function display_callback ( $ args , $ widget_args = 1 ): int |array |null {}
383+ public function update_callback ( $ deprecated = 1 ) : ?float {}
384+ public function form_callback ( $ widget_args = 1 ) : ?int {}
385+ public function _register_one ( $ number = -1 ) : never {}
386+ public function save_settings ( $ settings ) : ?bool {}
387+ public function get_settings () : iterable {}
388+ }
0 commit comments