Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112206 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43703 invoked from network); 8 Nov 2020 15:31:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Nov 2020 15:31:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 701A91804B3 for ; Sun, 8 Nov 2020 06:53:19 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 8 Nov 2020 06:53:19 -0800 (PST) Received: by mail-io1-f47.google.com with SMTP id u21so7228824iol.12 for ; Sun, 08 Nov 2020 06:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aRmixTLpq4FtW4owCSbFuI97VT6rz3IVAFKuKShbZqk=; b=rh61fWXUyfg7ZWLqMLZOaGKQA2L9K9bW/zsg/8zt4atmZIdTPUtm42ENt90T6l1lJe +Zczq8AH8Z0BDNtczmvJdaYTN79JtIBcL5tUkGBhGt5lYAWip9/p0X2cp7pEHr/c0Yrk PzhiLaqhVsal618ZO2HUo7mI3yjVjty1PkAMZJAVtksniY/GbxKF93qeKa9/FmHjGMhe pk9NDFcLOm74qtV+dAnjuinV7Cx6PqIKB+P+8wC3F13QbGjDInBTxTgEnVkY8UH60Tzt idf0YDpKAEekyLvYZmEZv+DxEJIDC6pmdfcw7vsrp4jD/o9sGl4sCo0BARYtlkjR6yFJ Dkdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aRmixTLpq4FtW4owCSbFuI97VT6rz3IVAFKuKShbZqk=; b=fbMy32TmERYCuIhrIH0Sd0nb0PndB5GJopLRBUM/PWOeqwBKulJGqsgebk/hojSnHI nNGDi3ISM/L8cl0nEH+rHS4bpC1IYv62AQcQc3E6df5fWrgN5OmBrGfTaOsICbrcPW2c +NLDMq7WqD0SxjLoGFVx0QwSEIvKBoPMcKNW81bzI2irzjPvwCBNmCG5Ie4iA3upefmm usmPQDDSxuBtwg3dZD16c5XP1cv/P1/eW9QVLxS8fMkwxH2mdypKxLHEkdBEpFQpmsYV LDg9imxeR8cYuD//FpXQ2Hjv7BwbM/EA1Aqt3D4YYfvVlaWF34LaQJK9e9fpmNyxBJag uGZQ== X-Gm-Message-State: AOAM5323QcLC5DkifX3CVRw/s++j84yTr68s9FIAVUmFM7W/J8dAv10a 3J6DmkDDonQCKOQxKvC/4EGFlDhXX2QFnPLtELk= X-Google-Smtp-Source: ABdhPJwXhjovoOtnY/i5stoR5ZnX+hx5DL61NBOG6qDArsiAgQ6r7GBDEICUoP9SSZeZZwP8aTHRf65SH9q8UQDvV50= X-Received: by 2002:a02:bb93:: with SMTP id g19mr8379831jan.142.1604847197789; Sun, 08 Nov 2020 06:53:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 8 Nov 2020 15:53:08 +0100 Message-ID: To: Eugene Sidelnyk Cc: PHP Internals Content-Type: multipart/alternative; boundary="00000000000024a13005b3999b10" Subject: Re: [PHP-DEV] Union `&` operator From: ocramius@gmail.com (Marco Pivetta) --00000000000024a13005b3999b10 Content-Type: text/plain; charset="UTF-8" Hey Eugene, On Sat, Nov 7, 2020 at 4:13 PM Eugene Sidelnyk wrote: > ```php > function foo(A & B & E $object) { > // some work > > var_dump($object); > } > ``` > Fully support this for parameter, property and return types: already making good use of intersection types since a few years. As for when to allow them: as others have suggested in this thread, keep it simple for now, and only allow intersection of class/interface references. If you want to raise an RFC, special care has to be taken for the variance in inheritance semantics. Greets, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --00000000000024a13005b3999b10--