Skip to content

Commit e65d562

Browse files
authored
Exclude "must be overriden" from adding return never (#133)
* Exclude "must be overriden" from adding return never * Remove NodeDumper
1 parent d486902 commit e65d562

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

visitor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,11 @@ static function (Node $node): bool {
10141014
}
10151015
// If a first level statement is exit/die, it's return type never.
10161016
if ($stmt->expr instanceof Exit_) {
1017+
if ($stmt->expr->expr instanceof String_) {
1018+
if (strpos($stmt->expr->expr->value, 'must be overridden') !== false) {
1019+
return '';
1020+
}
1021+
}
10171022
return 'never';
10181023
}
10191024
if (!($stmt->expr instanceof FuncCall) || !($stmt->expr->name instanceof Name)) {

wordpress-stubs.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,7 +4312,6 @@ public function __call($name, $arguments)
43124312
*
43134313
* @since 3.1.0
43144314
* @abstract
4315-
* @phpstan-return never
43164315
*/
43174316
public function ajax_user_can()
43184317
{
@@ -4324,7 +4323,6 @@ public function ajax_user_can()
43244323
*
43254324
* @since 3.1.0
43264325
* @abstract
4327-
* @phpstan-return never
43284326
*/
43294327
public function prepare_items()
43304328
{
@@ -4571,7 +4569,6 @@ protected function pagination($which)
45714569
* @abstract
45724570
*
45734571
* @return array
4574-
* @phpstan-return never
45754572
*/
45764573
public function get_columns()
45774574
{
@@ -54724,7 +54721,6 @@ class WP_Widget
5472454721
* @param array $args Display arguments including 'before_title', 'after_title',
5472554722
* 'before_widget', and 'after_widget'.
5472654723
* @param array $instance The settings for the particular instance of the widget.
54727-
* @phpstan-return never
5472854724
*/
5472954725
public function widget($args, $instance)
5473054726
{

0 commit comments

Comments
 (0)