[PHP-DEV] [Pre-RFC] Idea: named parameter lists

Henrik Skov <[email protected]>
Newsgroups gmane.comp.php.devel
Message-ID <[email protected]>
Hi list !

Just got an idea:

params COOKIE_PARAMS {
     time() + 3600,      // Duration - NOTE: any expression is allowed 
here except pure variables
     '/',                          // Path
     '',                            // Can't remember what this is...
     (! IS_DEV),            // secure — set true once served over HTTPS 
(production)
     TRUE,                    // httpOnly
     'Lax',                     // Lax|Strict
}

Instead of this: (I am using Swoole)

         $response->cookie(
             self::COOKIE_NAME,
             $token,
             time() + 3600,
             '/',
             '',
             (! IS_DEV),     // secure — set true once served over HTTPS
             TRUE,           // httpOnly
             'Lax',
         );

we could do:

         $response->cookie(
             self::COOKIE_NAME,
             $token,
             :::COOKIE_PARAMS
         );

I know it is kind of similar to the spread operator but not quite.

What do you guys think ?



/Henrik

-- 



Med venlig hilsen

Henrik Skov
/HSK Consulting/
Blegdamsvej 128B, 4
DK-2100 Copenhagen O
Tel.: +45 27 62 83 01
Email: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.