Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116420 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21883 invoked from network); 16 Nov 2021 16:34:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Nov 2021 16:34:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7C9911804C6 for ; Tue, 16 Nov 2021 09:29: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=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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 09:29:19 -0800 (PST) Received: by mail-ot1-f52.google.com with SMTP id x43-20020a056830246b00b00570d09d34ebso21279599otr.2 for ; Tue, 16 Nov 2021 09:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1Mzcievcd6xxxjH1pJz+9Z8X0ByEBooACB6K6R7aFjI=; b=j+MOrD8d3+7GS8FtbIF0RGTaqY+vXC4qeWH0VAdm8sBuweUtcSr89pAiG/6aDfr6WP 3ha5dY/RET2epS+YG6tkX5O+KBpPDMD+hssgVwGWNM5f+kZjvD+3dnXVjZYZ05rHVRDs Prcqre6RqqFdJPchYRyXBsbx+C/IUibAvU8laNMRr5ClhIxvXBNRi0xMrrVhVYVzEIrq as7LPsYJu8bL1Dr5IzZJK9fENUg3bpiYuuXcGqxSIids8sSoqA/IsHNgUbToj58z68OK VSLI8qEFJexf4W35Vr8ikY8S5xMIOHNQ0G33pQUlQX4SltCmbj3r0tDsg75hlmOF/6tV 7UIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1Mzcievcd6xxxjH1pJz+9Z8X0ByEBooACB6K6R7aFjI=; b=S4YWZxZWTpr+jH/zMX3IZWzQ1HWyAwdGBcVub/nlsntSwPeQRDSWrEU5k8/NNjS46m uUn5NdtF4ezpNMziYGW27WvljZhGdJ8OqeJvNAsk1U1XlE5q3zZl0LOgendHz4NtdheE 27Vd8oMOgRH7z1vmj66sgIgCXqusjNTrgk9XsHVCq52IL+/dZ7PjUIB1+x0HaSzPOfXc wr0zdhrOPHvN8pvQgFbKgHrL9zIyP36Cq2i4pJYXfcTKGxqrs8C8mC47y4fq0vAveW1J cxLHOdFJNq6ng7M92kWK5ZhQsZCTCIaKkMqjDXrA06NWBblsJTKf/0XGFE/vq88lmZa0 1MJg== X-Gm-Message-State: AOAM5339ORSr3Wihg5yKfqA3nkuhnXMZIsoA98Jo6Ll5IkwaM5dQLyQI 5Iry5s+Y4lc5iES0CygCBLLbnWMiywrcdvRW70r7AWWCGq/ul2Lo X-Google-Smtp-Source: ABdhPJxo9HZ7hlLBrPzyGAHsKqsMoGjqwvBbW9/q+g68Sz818mH1X7o/YIzwBR/hPn8mhonaH9Y8xB3D8LakjonHNM8= X-Received: by 2002:a05:6830:4119:: with SMTP id w25mr7430294ott.98.1637083758162; Tue, 16 Nov 2021 09:29:18 -0800 (PST) MIME-Version: 1.0 References: <05aa01d7db0e$783fa120$68bee360$@webkr.de> In-Reply-To: <05aa01d7db0e$783fa120$68bee360$@webkr.de> Date: Tue, 16 Nov 2021 18:29:06 +0100 Message-ID: To: =?UTF-8?B?QW5kcsOpIEjDpG5zZWw=?= Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000df751c05d0eb43c8" Subject: Re: [PHP-DEV] Is there an RFC/discussion for ::class being a specific type? From: ocramius@gmail.com (Marco Pivetta) --000000000000df751c05d0eb43c8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey Andr=C3=A9, On Tue, Nov 16, 2021 at 6:22 PM Andr=C3=A9 H=C3=A4nsel wro= te: > It is common (with DI systems for example) and to my knowledge not > particularly discouraged to have function parameters that are supposed to > accept something like Foo::class, which currently is a string. > > It seems logical to ask for a special type that can hold class names, so > that parameters that can accept a class name can be type hinted more > specifically than just (any) "string". > > Regardless of whether or not such a proposal would be accepted or decline= d > (for complexity reasons maybe) I couldn't even find any such proposal. Ha= s > this really never been asked? > In `vimeo/psalm` and `phpstan/phpstan`, there is a pseudo-type called `class-string`. This `class-string` type is kinda problematic though, because `Foo::class` does **not** autoload `Foo` (by design), and therefore a custom runtime type would be a bit too "optimistic" about its values, as it would not verify anything. Greets, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --000000000000df751c05d0eb43c8--