webimpress / coding-standard

Webimpress Coding Standard for PHP_CodeSniffer
BSD 2-Clause "Simplified" License
13 stars 7 forks source link

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

Closed Xakki closed 1 year ago

Xakki commented 1 year ago

Case like

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

@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!