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

fix: Union return type (PHP 8.2) - Functions\ReturnTypeSniff #182

Merged
merged 4 commits into from
Mar 6, 2023

Conversation

Xakki
Copy link
Contributor

@Xakki Xakki commented Mar 1, 2023

Case like

    public function insert(array $data): bool|mysqli_result
    {
        if (empty($data)) {
            return false;
        }
        return new mysqli_result;
    }

Fix for php8.2 if u have union type return 
```
    public function insert(array $data): bool|mysqli_result
    {
        if (empty($data)) {
            return false;
        }
        return new mysqli_result;
    }
```
@michalbundyra michalbundyra added the bug Something isn't working label Mar 2, 2023
@michalbundyra michalbundyra added this to the 1.2.5 milestone Mar 2, 2023
@michalbundyra michalbundyra modified the milestones: 1.2.5, 1.3.0 Mar 6, 2023
@michalbundyra michalbundyra changed the title Fix for php8.2 if u have union type return fix: Union return type (PHP 8.2) - Functions\ReturnTypeSniff Mar 6, 2023
@michalbundyra
Copy link
Member

@Xakki I have changed logic a bit, and added the case you mentioned in the PR description to unit tests.
It should be a bit more generic now.

I will release this in 1.3.0 today. If you find any other issues please create new issue/PR. Thanks for reporting!

@michalbundyra michalbundyra merged commit eb64f30 into webimpress:master Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants