Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116422 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 27702 invoked from network); 16 Nov 2021 17:36:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Nov 2021 17:36:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4C60F1804BD for ; Tue, 16 Nov 2021 10:31:01 -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=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 78.46.0.0/15 X-Spam-Virus: No X-Envelope-From: Received: from mail.webkr.de (mail.webkr.de [78.47.173.34]) (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 ; Tue, 16 Nov 2021 10:31:00 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id F17481A0B90 for ; Tue, 16 Nov 2021 19:30:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=webkr.de; s=dkim; t=1637087459; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=mrjWeRby0dn69pZuH2oWgMlEATiVLPMEdoDCsRtzzs8=; b=OpcrzAEVs8Sf11UGR1maopzM84Cy9Scr3fbuF3P32YbPYe7hnGvAcRddRP9dgOzZg0tNpB 9w0FHz72G6IJSctxKUljQuILfpwuSNWTlBkajcv1GYY67zam42sn6yyb+2uZJFRPgnhHXY wGjZt7XCngkugjlmvcg57hHeW07fnyA= To: "'PHP internals'" References: <05aa01d7db0e$783fa120$68bee360$@webkr.de> In-Reply-To: Date: Tue, 16 Nov 2021 19:30:56 +0100 Message-ID: <05b601d7db18$18d59eb0$4a80dc10$@webkr.de> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thread-Index: AQDN7TLyGmj2Zq2FISL/3aZhCLG6MAFUGEWNrg+zvUA= Content-Language: de X-Last-TLS-Session-Version: TLSv1 Subject: RE: [PHP-DEV] Is there an RFC/discussion for ::class being a specific type? From: andre@webkr.de (=?UTF-8?Q?Andr=C3=A9_H=C3=A4nsel?=) Maybe I'm missing something but now that you said it's kind of a macro, = I think it would actually be pretty easy to implement, at least when not = taking backwards compatibility or performance into account: class ClassName { private $name; function __construct(string $name) { $this->name =3D $name; } function__toString() { return $name; } } Then make the preprocessor convert Foo::class into `new = ClassName(Foo::class)`. Done. Now you can type hint a function like = this: class DiContainer { function get(ClassName $klass) { // ... } }