Welcome Guest, Not a member yet? Register   Sign In
source code says Request::getMethod() is deprecated, what to use?
#7

(This post was last modified: 07-19-2021, 12:45 AM by CCAldo.)

But if you're not using a paramater you still got this error.

Also it seems that some users would be triggered to uses a non-CodeIgniter function instead.
And that would not be the way to handle this case.

Made some adjustments:

PHP Code:
/**
 * Get the request method.
 *
 * @param boolean $upper Whether to return in upper or lower case.
 *
 * @return string
 *
 * The $upper functionality will be removed and this will revert to its PSR-7 equivalent
 *
 * @codeCoverageIgnore
 */
 
public function getMethod(bool $upper false): string
 
{
    if (count(func_get_args()) > 0) {
 
        $warn 'The $upper functionality will be removed and this will revert to its PSR-7 equivalent';
 
        trigger_error($warnE_USER_DEPRECATED);
 
    }
 
    return ($upper) ? strtoupper($this->method) : strtolower($this->method);
 } 


And this trows this when using the $upper-param (in development environments) 
[Image: nkrQxHw.png]

Seems a better way?
Reply


Messages In This Thread
RE: source code says Request::getMethod() is deprecated, what to use? - by CCAldo - 07-19-2021, 12:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB