Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130484 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 6F4091A00BC for ; Sun, 29 Mar 2026 22:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1774824687; bh=Q4FnRY4Kmf/EP4V7PapHaDfIf0vX1clNcmAe3uT9qZw=; h=Date:Subject:To:References:From:In-Reply-To:From; b=it9VfEhwXV+IHrp1u/Teqg3jX+/seWXkgyMQMHaormxuwH+Dy4m85QlFLZro8kMUI NLbqK4kDGp6dxeJ2Kj0u0abZmFv5+cFyJLiVG3HdMs6w2tMexTg6/+UKoEDsqw7u4M IdhZXidB+J1FkJ7TfhpkfZF6dPhG8rgrjk95s4VhW3vdiC9Km5yAYFpFjGnjcgMca6 dSb8OSMBLMOaMMbFw5UCqvEkLYmkz5whfpcKYW2kya4od1q5K4eqdNIpG9F4RaimUW sllruz5jTk/nEWefMyBZ/D7TivBK01wEDBmiQy8g0xFU5c0S07sWBd92rKxLB/W6TK I94W8DVs+wOmw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 28B86180068 for ; Sun, 29 Mar 2026 22:51:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-108-mta105.mxroute.com (mail-108-mta105.mxroute.com [136.175.108.105]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 29 Mar 2026 22:51:25 +0000 (UTC) Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta105.mxroute.com (ZoneMTA) with ESMTPSA id 19d3bcb667b00032bf.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 29 Mar 2026 22:51:19 +0000 X-Zone-Loop: c6ce0bcd753001d17832a28bd3836f8766741886d80f X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sandfox.me; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:To: Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Iays2vrB4/LfKKpLTBw8ubbRKPlpqEYq3cffb+GaCdM=; b=b5T1iNuW7Wc4eXwUGiEu5GctZw Lg3GsPyZNwHnJthXUQ1RUXQvca/pOF3SGbiZ9M2TDmFwvR/D4UYZtvE0NGvOcbtkcm86DKn6jsX+z vn6BNjR8WItb92pyOKkXNXl+Ps3H6qiS36A0GE+BWDWvqD2zFSlEBeN0CIRcdYXas1SSq9eIOSvlU Djd505EzUV6yCYg27/X4MitsDJANxdwFPj3GvmrO7MBLyckU+sl/Mhv07LdXICPAB6MSDxmpxKgXC x8v+YSYcCZllbXclVloYltdYJ1/DjmOvFrM4nK3fDLQ1a0W09AaStu1gQd0g2QbLsU3NR2e1Pl7hL gvAiw4oA==; Message-ID: <5ce1f5a3-1ad5-4cc7-8c6e-93170af28ef4@sandfox.me> Date: Mon, 30 Mar 2026 01:51:16 +0300 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] RFC proposal: Invokable interface To: internals@lists.php.net References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Id: sandfox@sandfox.me From: sandfox@sandfox.me (Anton Smirnov) Hi! On 30/03/2026 00:42, Osama Aldemeery wrote: > It follows the Stringable pattern: auto-implemented for any class > defining __invoke(), explicitly implementable with enforcement, and > covariant to callable in return type checks. Stringable is just a normal interface that can be used directly as any other regular interface, it's just also applied magically. Invokable cannot be a regular interface because the signature for __invoke is not fixed, so it's a "weird" interface with magic behavior like Throwable and Iterable. What is common about these weird interfaces is that they can't be directly implemented by user. I don't feel like breaking this rule is a good idea for something with no clear benefits. Second thing is that magic methods are not supposed to be used directly, so having __invoke is just an implementation detail, the consumer code should not check for that, that's a code smell. Anton