Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127885 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 68F441A00BC for ; Fri, 4 Jul 2025 22:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751666419; bh=CKBiLpJpvGaMNefFA3KtG6i8zJtxSuy/XFXnqJ0s2C4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mYFt4osR9AYlaT3vfdhFabigcDPTygRsKvshJQSH2XG0FXOjQ+Bpagmjj7+vKw88H iqtuvoyJM8A8fp8DMW5W4sXRp3tvhTgy07Tc3gs+txsB/oUtphpH+AQm5hDelvKfsf mD8t7ETeVQgWXDA91T+hPaHSP6mDUNXImty3QJD+Y3SEFyGfPDXlnwp7lrDh2dfeQN VVD2/AIXH1FaD/V0mvY+LEcy4nuUoCE8/EghdCOOpXVXPO9TTXcGds2z3J4MXmeYPF NW6GBjpUkPSYXI52pRbAPJBKDmeoXYAs1H9bKvoUckVox3kAYnNyXpkidZjBxYYO5b 3KkE+BjRcfNlQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7E435180047 for ; Fri, 4 Jul 2025 22:00:18 +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=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (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 ; Fri, 4 Jul 2025 22:00:18 +0000 (UTC) Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-7115e32802bso9360497b3.1 for ; Fri, 04 Jul 2025 15:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751666529; x=1752271329; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CKBiLpJpvGaMNefFA3KtG6i8zJtxSuy/XFXnqJ0s2C4=; b=MtCg8hdUH+3p4JNCwZnTYO9QQ5ufpXdYjbg/UfbE/OHHUGxqHvzVD8nixe8EmGfK6N biuFuMFwL8mtrHF2xmJiNymSICy7Qxk++uQ6cJ8qgXagbFdfPIi7/y/2PzvzKlE4iHmt xHXIaoMawvBOkHqmAb+fY7QMolAS539vDGODPalDlqDEju3dDwm/+nKOVjfYSpwgra0N uhyXFkGF7VRQhCs8aIbZj8vjhNh1LlFpCqi37s8F05VRJGS9weAfhrTWZOLZjXMgHvXN 62T+fnAcwYqiFBHcq6f0hWfc+ZPVDgAVfqtNo2ErTYSwppgFtOc/Lwc1D+GCMBA/Ehn9 tbYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751666529; x=1752271329; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CKBiLpJpvGaMNefFA3KtG6i8zJtxSuy/XFXnqJ0s2C4=; b=os7uHka92yt47wcBbH7DFTUpUMx6FoboUiEbzKn3Qal4ct4ujpbtxZwAFJclRIx7mI okr7axfSG8+9YWa3MKLeMcjbQ5YWsdUvR+MD9u1CFq+z2XShdJWY/rpih5PrtJlMfdmF CXcOA+fYpufyiETRsvVVF+grFiCJwxi6NikJRJPTWY75oDtb5NisoJHHlZH6b6S6e/UG qkjgvjutV5ifOa/FzgIfoYQLp8IG/fc4XHL/ojzBcc34nGl0KyF6/Ws4IdoPjiChHnTv jzCXD0UXdaKID55i2VV3Cpz3xosH7N877v352lfB7zEpSad1j6ZK6JhHGDxeQzDXTDfa S76g== X-Gm-Message-State: AOJu0YzeL5DSgoYjwLxfy1ZvQ1rUKSY5OdK55lSjXxfZqzGllJFcM5Ea RIhGIrsHVIilhhXoz8hPRiTHkvn+IFV6AZahOmQ01kwUlKOJ54qCrGTxKXCYyrFpy3D4PSAZIEG s4DJIsBSD0smKtHZCWdIRul4pOFmCp7IqIpki X-Gm-Gg: ASbGncuBTQQtuJPPWrfuV+Lqt9IfEdDU0koXOKIeEmTj5/Ki2fRoaIIq4uT8s7kxS8O IcFXVpzRbbZO6/y5CMms0cqVJaYWYDvqg966ofWTAjg8SQlLtcdrLXDt6WpVyQ3parZtDr/ZQgo ytNMU9m+3D1Mt5ijU5cgrgqr3xOZnG6vQm/L7zBjjlPzfVQq99HI+yxMOPb/kED0sTX6XvYNk5M OQ= X-Google-Smtp-Source: AGHT+IGRNcvkNVOUjP92Cwgup3euL6Al4PL8UO0VUL26DGh//0AjW0OveOIp68RKYLt0XEig0/iXlbX171G4zDiawgY= X-Received: by 2002:a05:690c:dc1:b0:70e:73ae:766c with SMTP id 00721157ae682-7166b6be7b4mr45336647b3.22.1751666529400; Fri, 04 Jul 2025 15:02:09 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 4 Jul 2025 15:01:37 -0700 X-Gm-Features: Ac12FXz3oUr9CIE3FdYQ5gGXueYP61g-dsHUiGZqfODgNHL8XWazcEgRJX3xDQI Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] #[\DelayedTargetValidation] attribute To: =?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?= Cc: php internals Content-Type: multipart/alternative; boundary="0000000000003ffb4e063921a58f" From: daniel.e.scherzer@gmail.com (Daniel Scherzer) --0000000000003ffb4e063921a58f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jun 22, 2025 at 10:24=E2=80=AFPM Alexandru P=C4=83tr=C4=83nescu wrote: > Hi Daniel, internals, > > On Wed, Jun 18, 2025, 02:29 Daniel Scherzer > wrote: > >> Hi internals, >> >> I'd like to start the discussion for a new RFC about adding a >> `#[\DelayedTargetValidation]` attribute. >> >> > How about completely disabling errors caused by a bad target at compile > time? > And just ignore the attribute, that can be validated at runtime if needed= . > IDEs and static code analysis would show the problem and that might be > enough. > > -- > Alex > If you mean to always disable those errors, that is exactly what I responded to above - https://news-web.php.net/php.internals/127734. Basically, internal attributes are not pure metadata but also trigger engine behavior, while userland attributes are metadata (and the attributes don't even need to exist to be used!). Thus, there is a benefit to compile time errors, since otherwise you don't know that the engine behavior isn't being triggered. This attribute completely disables errors caused by a bad target at compile time *whenever the new #[\DelayedTargetValidation] is applied*. This gives the best of both worlds * you get errors if you misuse an internal attribute * you can suppress those errors intentionally if you have a reason (e.g. forward compatibility), and just delay the validation until runtime Since I proposed this RFC, a proposal to support `#[\Override]` on properties has been discussed (https://news-web.php.net/php.internals/12783= 1), highlighting the benefits of this #[\DelayedTargetValidation] attribute. E.g. if we add it in 8.5, then when a later version adds #[\Override], a library can apply #[\Override] to properties without *requiring* a newer version of PHP. -Daniel --0000000000003ffb4e063921a58f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Jun 22, 2025 at 10:24=E2=80=AFPM = Alexandru P=C4=83tr=C4=83nescu <dr= ealecs@gmail.com> wrote:
Hi Daniel, internals,

On Wed, Jun 18, 2025, 02:29 Daniel Scherzer &= lt;daniel.= e.scherzer@gmail.com> wrote:
Hi internals,

I'= ;d like to start the discussion for a new RFC about adding a `#[\DelayedTar= getValidation]` attribute.


How about compl= etely disabling errors caused by a bad target at compile time?
And just ignore the attribute, that can be validated at runtime = if needed.
IDEs and static code analysis would show = the problem and that might be enough.

--=C2=A0
Alex
=


If you mean to always disable those erro= rs, that is exactly what I responded to above -=C2=A0https://news-web.php.net/php.internals/= 127734. Basically, internal attributes are not pure metadata but also t= rigger engine behavior, while userland attributes are metadata (and the att= ributes don't even need to exist to be used!). Thus, there is a benefit= to compile time errors, since otherwise you don't know that the engine= behavior isn't being triggered.

This attribut= e completely disables errors caused by a bad target at compile time *whenev= er the new #[\DelayedTargetValidation] is applied*. This gives the best of = both worlds

* you get errors if you misuse an inte= rnal attribute
* you can suppress those errors intentionally if y= ou have a reason (e.g. forward compatibility), and just delay the validatio= n until runtime

Since I proposed this RFC, a propo= sal to support `#[\Override]` on properties has been discussed (https://news-web.php.net/php= .internals/127831), highlighting the benefits of this #[\DelayedTargetV= alidation] attribute. E.g. if we add it in 8.5, then when a later version a= dds #[\Override], a library can apply #[\Override] to properties without *r= equiring* a newer version of PHP.

-Daniel=C2=A0
--0000000000003ffb4e063921a58f--