Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong nullability information when returning "void" #887

Closed
jakubmisek opened this issue Dec 13, 2020 · 1 comment
Closed

wrong nullability information when returning "void" #887

jakubmisek opened this issue Dec 13, 2020 · 1 comment
Assignees
Labels
Projects
Milestone

Comments

@jakubmisek
Copy link
Member

te following function is emitted with the wrong Nullable attribute,

class Test
{
    final function multidimensional( $root, $keys ) { // <-- wrong nullability attribute
        if (empty($root)) return; // void
        return [1,2,3];
    }

    function multidimensional_get( $root, $keys, $default = null ) {
		$result = $this->multidimensional( $root, $keys ); // does not expect to return null
		return isset( $result ) ? $result['node'] : $default; // isset() evaluated to TRUE always
	}
    
}

echo (new Test)->multidimensional_get(false, false, "ok");
@jakubmisek jakubmisek added this to the 1.0.0 milestone Dec 13, 2020
@jakubmisek jakubmisek added this to To do in WordPress via automation Dec 13, 2020
@jakubmisek jakubmisek self-assigned this Dec 13, 2020
jakubmisek added a commit that referenced this issue Dec 13, 2020
@jakubmisek
Copy link
Member Author

fixed in 895b5f8

WordPress automation moved this from To do to Done Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
WordPress
  
Done
Development

No branches or pull requests

1 participant