webimpress/coding-standard

Error if `return` is `mixed` type: Function return type is not nullable, but function returns null here

Xakki opened this issue · 1 comments

Xakki commented

Mixed type is include null type

    /**
     * @param string $key
     * @return mixed
     */
    public function getStr(string $key): mixed
    {
        if (is_string($key)) {
            return $key;
        }
        elseif (is_array($key)) {
            return json_encode($key);
        }

        return null;
    }

@Xakki thanks, 1.3.1 released.