Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128229 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 AD5A71A00BC for ; Fri, 25 Jul 2025 16:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753461172; bh=XGo2yiEEpwfvA/yLFkHUIdXvcxb9Wwu/5FzXJQBtvb4=; h=From:Date:Subject:To:From; b=SjohAX17foy+qE50/fK4X3w59TSYEqnooRo3m2F/sG1KLAzsAgEUmkCGmAXqkMDln wOaI8Kndy+s5Zbch7hSIQEDhNTPdW0i03ii0mEr4ZWtV3E9qsztPZqG36NdeKDCAoQ jpkdKrCz3kT6QJUi0Pv0py7xcDW2V+ytEZCB/uOnnX/UdGJPyrG/qSIOIXCYzCLZZp 3KclB4m3Y46imIwg3bSwQmijo0zVgVlxDy2Q0UOA8hnJJXksxYytbsiXVqc2v9HKRW EZ9AWO+nL2tEVeNngTA9PjQBdyN2VeRlRk8fwZHo1K5AnKCAi/4jCIW+HCASAAb5pP tQyW7HxP/ZBkg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7E3CD1801D5 for ; Fri, 25 Jul 2025 16:32:51 +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=-1.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,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-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (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, 25 Jul 2025 16:32:51 +0000 (UTC) Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-e740a09eae0so2233857276.1 for ; Fri, 25 Jul 2025 09:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753461274; x=1754066074; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=XGo2yiEEpwfvA/yLFkHUIdXvcxb9Wwu/5FzXJQBtvb4=; b=Dw6sWfz2vnyq97hiHW1U0np2YPVMD0Mg7tuS741bm39AIDM/6ama3epO09tLQADokh OeVet0BvF6e1TMkHufopiBFyA0HgCk216eWBDPOq4gyDsHsYoDN+rWmOzUs6oWiWjqnS nouPk5yWDG8RAlrL2NTCR26ZYmukxQ+jcKxv9pMZETFAPGRiFsH8ugsDlVNpK7QRrQaP RqDQGayZoptSBPASDGw/+ARaM2TowPyMzg9kQmqQCzvrwyZoSl+d97JP9iKfTr1IKDlf XH35pydvKOw5z9nRAQVsjBOMi3DxkpgepT5ZHPk3B9IaTU3j1xvtyw5aJlpvlRflFVOH 8YCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753461274; x=1754066074; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XGo2yiEEpwfvA/yLFkHUIdXvcxb9Wwu/5FzXJQBtvb4=; b=GrKzclRDuxZWFk0bMZKUsMNTTnISmXSmuSsI9wP/xJB4eUbmrlpTKXg3uF3ZfhKBen wzxKHW3rFsK3Q+s/ZGKW7z365NmxKTiO+eUSgRT4m4bASirxqJcWPIHOTI5zJONbd4TF nj5E9BkbdoP1kkwuGnHsbZJBLCikjU58D4Y63OUb7/LXSrEnJOGud5UXSnU+cF6mZlmE L1No+KGQnRxf4zvoQN1IL0HuBLhu98axDY5leZ8oL84++hkS2gQQhhvfAt7JPlcyNUbn /OkIXGHu2fLDFURQQXeW1MOla/WnVcXBPZKBoXIiC82b/JGqv/8aeeRlr6AJXojRNYpG vHUQ== X-Gm-Message-State: AOJu0Ywhvg6sZXidzszR8qn31cGmInROUfNdqRGEJb8sHi9wbMsGCtzN VUDcc3lJx9RDE3/5zVCwMLKFegE8j82bOO66yGtfe55y7ejTe1DWT0lbjdsDnLrmgEDnZ6DTQKp dWxVSKelFrHu1RPDCO31+rx9Jmn7Wvaqmgabs X-Gm-Gg: ASbGnct9NMTm7w+3+5l1T9uMzun/tNOTtXueFK1IN3lEe9YM7MwwT/5cRlRwKvepCHH JhoPddditXRyZSbd4aTEcgS7RYjqbHS00w7w22gPL9rdAVUBeKuf3uJ+w79VEVc34Zw6dQ81By7 A0C/nm47vghiMnSncQ/VBqgnrVPklKa6tFSGq5bReT08hppDZsf67EIW8QxJBaMHGNA0yrW/kEZ p1g2411jHTLr0A6otxF6n2wgTfFtAJPQyR1/Bs= X-Google-Smtp-Source: AGHT+IHytFtteCt0+kaRYimwt+MSWnruBdXnWdWgySHeH4ZggH4GDNOaa40BPjfbJhRkNOdPHNF4LN1h7NEblA8B2/Y= X-Received: by 2002:a05:690c:22c1:b0:70d:f420:7ab4 with SMTP id 00721157ae682-719e34466d4mr31469907b3.29.1753461274247; Fri, 25 Jul 2025 09:34:34 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 25 Jul 2025 09:33:58 -0700 X-Gm-Features: Ac12FXwiedSocdkeoAGNk6IeXuwSiqRBg-PQkenk_NmrWDXRqHdg8AoXr5aOLQY Message-ID: Subject: [PHP-DEV] Validating #[\Attribute] targets To: php internals Content-Type: multipart/alternative; boundary="000000000000610949063ac384ba" From: daniel.e.scherzer@gmail.com (Daniel Scherzer) --000000000000610949063ac384ba Content-Type: text/plain; charset="UTF-8" Hi internals, The #[\Attribute] attribute is used to mark classes as being usable as attributes. It currently does not trigger any error if added to a trait, interface, enum, or abstract class. However, if any of those *were* used as an attribute, calling ReflectionAttribute::newInstance() would fail; if you are not going to call ReflectionAttribute::newInstance(), then you don't really need to mark the trait/interface/enum/abstract class as an attribute. I have proposed https://github.com/php/php-src/pull/19154 to add validation to the #[Attribute] attribute, and it was suggested that I post here on the mailing list in case there were any objections. So, are there? -Daniel --000000000000610949063ac384ba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi internals,

The #[\Attribute] attribu= te is used to mark classes as being usable as attributes. It currently does= not trigger any error if added to a trait, interface, enum, or abstract cl= ass. However, if any of those *were* used as an attribute, calling Reflecti= onAttribute::newInstance() would fail; if you are not going to call Reflect= ionAttribute::newInstance(), then you don't really need to mark the tra= it/interface/enum/abstract class as an attribute.

= I have proposed=C2=A0= https://github.com/php/php-src/pull/19154 to add validation to the #[At= tribute] attribute, and it was suggested that I post here on the mailing li= st in case there were any objections. So, are there?

-Daniel
--000000000000610949063ac384ba--