Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129531 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 B48DC1A00BC for ; Wed, 3 Dec 2025 21:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764796450; bh=J8St4HSFV5LOmYTIObFdbRn3SJVlrsTRKzo6Oq25LHs=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=AsX4wtkWC5ED6Q9/9lMaLPD4AOsI5w0zlVsI7J8/RkTOItMGxiWvRHu14qcGfhde/ GIajf4WYEmpBG7FxgIUEHNHQsIeIoFECISY007Wq0+dR5d/0qt98ztC0L9i4DBkDNK AnvSAQWCkWxRV36rTx10eZJcmv8qXy4DmpyRL0AIBY3yvlgrgQ613qCZ9/3zJlfZgE yjF7mqhTxOdU9a0pn2D1IVK/el9mvxFBro3ozB6wyWcrlapefLuUkiKghMnb9r9EBf IjRh07D3BqWWM6UcnXY692OGUeeGWQy0IJItfcw6Keb1GDPvYOtWxNjflVW8lzqnqD txgmF4K53pFig== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9E89318033A for ; Wed, 3 Dec 2025 21:14:09 +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 premium76-5.web-hosting.com (premium76-5.web-hosting.com [162.213.255.108]) (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 ; Wed, 3 Dec 2025 21:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pmjones.io; s=default; h=To:References:Message-Id:Content-Transfer-Encoding:Cc:Date: In-Reply-To:From:Subject:Mime-Version:Content-Type:Sender:Reply-To: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=J8St4HSFV5LOmYTIObFdbRn3SJVlrsTRKzo6Oq25LHs=; b=HNT8Ndpg1yV1WP/f42JCFDY1EF /8eTofK4Vtk5vmfrjSyvXDXsLoFuvqhyS0wgrrcrPJTIS7vX81HHP0guY46R+r30qYqtOZJHY4W/i 69cGw8H5R8wli5bUzzrCXj6xBC2E8oKzWmkBYTPKOAreCWbG38o8aI7nvlORoJrMBMe9n8M9IahOM VZD6nNJ8zgsBaDNLI0igCoiSH58kBnT9ZDxxr51cPIPTQh4jyWtwE3Z44Vc3VWJmJzO/++hY1rQUz MaU9ZJsJTLNndvY54s4yMGq5y56IVpeVfEM7KTEaW8HQNISG6w4vX2BUAlO5XjZ9ThVOMwTPjIRpN Xqhj/K1w==; Received: from 107-223-28-39.lightspeed.nsvltn.sbcglobal.net ([107.223.28.39]:50920 helo=smtpclient.apple) by premium76.web-hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vQuAj-0000000FsK9-47fb; Wed, 03 Dec 2025 16:14:02 -0500 Content-Type: text/plain; charset=utf-8 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [PHP-DEV] [RFC] Type Aliases In-Reply-To: <4ba0f7ca-815f-47d8-a6bf-43abe2aff842@app.fastmail.com> Date: Wed, 3 Dec 2025 15:13:50 -0600 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <14FB7636-3FCC-4E24-AA2F-C52A0708F3E2@pmjones.io> References: <87e9d1bf-e407-45c1-9fad-d8759405ab8b@app.fastmail.com> <45C95FE8-B0FB-4A22-9460-477533527F41@pmjones.io> <4ba0f7ca-815f-47d8-a6bf-43abe2aff842@app.fastmail.com> To: Rob Landers X-Mailer: Apple Mail (2.3826.700.81) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - premium76.web-hosting.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pmjones.io X-Get-Message-Sender-Via: premium76.web-hosting.com: authenticated_id: pmjones@pmjones.io X-Authenticated-Sender: premium76.web-hosting.com: pmjones@pmjones.io X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched X-Rspamd-Queue-Id: 1vQuAj-0000000FsK9-47fb From: pmjones@pmjones.io ("Paul M. Jones") > On Dec 3, 2025, at 15:09, Rob Landers wrote: >=20 > On Wed, Dec 3, 2025, at 22:04, Paul M. Jones wrote: >>=20 >>=20 >> Hi Rob, >>=20 >> (We've been using a lot of PHPStan type aliasing lately in the = Star-Interop work, so this topic is timely.) >>=20 >> Is there some possibility of making the aliases more classlike so = they can be autoloaded? A la: >>=20 >> namespace Foo; >> type number { as int|float; } >>=20 >> Then elsewhere: >>=20 >> use Foo\number; >> function sum(number $a, number $b): number { return $a + $b; } >>=20 >> Let me know if I've missed something fundamental. >>=20 >>=20 >> -- pmj >=20 >=20 > They fundamentally cannot be autoloaded because autoloading happens at = runtime, not compile time. At least, with the current autoloader. = Autoloading type aliases would need to have a fundamentally different = type of autoloading that doesn=E2=80=99t exist today. Got it; thanks for the clarification. -- pmj