[Pre-RFC] Idea: named parameter lists

From: Date: Tue, 18 Aug 2026 09:12:13 +0000
Subject: [Pre-RFC] Idea: named parameter lists
Groups: php.internals 
Request: Send a blank email to internals+get-132247@lists.php.net to get a copy of this message
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: henry.wood.dk@gmail.com

« previous php.internals (#132247) next »