Welcome Guest, Not a member yet? Register   Sign In
Erroneous Deprecated Annotation
#1

(This post was last modified: 04-30-2023, 05:50 PM by donpwinston.)

There is an erroneous "@deprecated" annotation in system/HTTP/Request.php. I've posted this before and the person who looked at it didn't want to accept the fact that is wrong. The deprecated annotation signals that the entire method is deprecated. This is not true. It should be removed. I know it is trivial but it messes up my DevSense extension in VSCode which flags the getMethod() function as deprecated. It is annoying. The engineer at DevSense says the proper way to deprecate a parameter of a function is use "#[Deprecated]" above the "@param bool $upper" annotation. Don't ask me to do a pull request. I do not write code unless I'm paid. If anyone else would like the experience of performing a pull request and hasn't done very many of them before, or none at all then you are welcome to do it for me.

PHP Code:
/**
    * Get the request method.
    *
    * @param bool $upper Whether to return in upper or lower case.
    *
    * @deprecated The $upper functionality will be removed and this will revert to its PSR-7 equivalent
    *
    * @codeCoverageIgnore
    */
    public function getMethod(bool $upper false): string
    
{
        return ($upper) ? strtoupper($this->method) : strtolower($this->method);
    
Simpler is always better
Reply


Messages In This Thread
Erroneous Deprecated Annotation - by donpwinston - 04-30-2023, 01:24 PM
RE: Erroneous Deprecated Annotation - by iRedds - 04-30-2023, 09:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB