Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120790 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 32240 invoked from network); 12 Jul 2023 03:25:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Jul 2023 03:25:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 067D31804D0 for ; Tue, 11 Jul 2023 20:25:58 -0700 (PDT) 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,FREEMAIL_FROM, HTML_FONT_LOW_CONTRAST,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 11 Jul 2023 20:25:54 -0700 (PDT) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-3fb4146e8fcso1451455e9.0 for ; Tue, 11 Jul 2023 20:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689132353; x=1691724353; h=mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=/r1PC0I27YioqLnl965gQEy95kNFFTLI4l/JTq3Fag8=; b=WAj7ff5BiTgJn0vs9qtU7ZenORPiGrYOCR+Bjaxfevunm+WATV7Tro2d96Xzhpe/sW 321RzmF1Bad2nCURLNjiG71fhZuXYjpIwDnPAt9Wy7YBrUmfO+qX/T0VnU41QnLN2R9a 5IY6tsIfoqV+UYGLzJufXTirfa/6356Fv7AjBsb6iC0Uzx+C0KeHL8K6ObQLq/mdxOLe 01PiWCx4KM4BRw2HNm2Cgk2gYSp/7tk+5buaJszZkOVZgurNiNL0ybCLY/xJytpknlpi cmlg6gM0phmtJSA1/xbhkYFILnjqKNABVk7B75FyTXDWa8gBKzghwxptKLtgEBDRDlLj hSyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689132353; x=1691724353; h=mime-version:subject:references:in-reply-to:message-id:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/r1PC0I27YioqLnl965gQEy95kNFFTLI4l/JTq3Fag8=; b=Hhy84X/Xsx9YXbrHhRtjDuAgInTyq0QPnJt5HmC+3THVDPrVz1mQGo6YpC5bvVicWh +MLueLfne1ChNV87lHWoXA10D/vjXuh2AC/L6k2C7CARjIbOt901dwBuo2uaaIRongDz SFRr+9hf97z9ZFU+TI0XWOS5jAMPI+b1xF3eNtp9AOZGR82FLmjn8AYWPfWwHA2cKsQ5 2Wcizj0poeBysDL5ZmsT2q6Poky1b+NdgdycOjsGIcwzNVWYQmcc1Xw7nyIqV1tg0vw5 puVhzdfRpreYmUNWMls64gqAX3mvOxqdAd8XkHrO4UBMuoVmUH8fWy3lXJ+BI7V7wYh1 5qIA== X-Gm-Message-State: ABy/qLbtRMR2p5O4HSdjfJF8AsPoCGqJGt/FIGCVvEiWYwN2FFYKSHfM bESKS/0f7kf/Bt8J8awF1/+4eq4wX3A= X-Google-Smtp-Source: APBJJlEUyxPXR82BM9tuR4tZJxtp/kGIBNrREpavam7GC7Ua7iAJ1wqZ2pMm5Q0TArBPgsiEf10W+w== X-Received: by 2002:a1c:4c04:0:b0:3fc:180:6463 with SMTP id z4-20020a1c4c04000000b003fc01806463mr408862wmf.7.1689132352557; Tue, 11 Jul 2023 20:25:52 -0700 (PDT) Received: from [2a01:cb14:b3d:e00::ffff:ffff] ([2a01:cb14:b3d:e00:e91a:4938:a0c7:3f48]) by smtp.gmail.com with ESMTPSA id z21-20020a7bc7d5000000b003fbd04ecdc6sm14641450wmk.5.2023.07.11.20.25.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2023 20:25:52 -0700 (PDT) Date: Wed, 12 Jul 2023 05:25:46 +0200 To: internals@lists.php.net Message-ID: <906b41e4-dcbd-4a03-9d10-33723ce1c708@Spark> In-Reply-To: <29da91e9-d649-49c5-a415-46a84d22d531@Spark> References: <29da91e9-d649-49c5-a415-46a84d22d531@Spark> X-Readdle-Message-ID: 906b41e4-dcbd-4a03-9d10-33723ce1c708@Spark MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="64ae1d3f_4ccc316d_24c1" Subject: Reflection*::hasAttribute() From: robin.chalas@gmail.com (Robin Chalas) --64ae1d3f_4ccc316d_24c1 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi internals, It is common attributes to be used as markers. Just like a marker interfa= ce with no methods, such attributes don=E2=80=99t have any parameter. Examples from Symfony: - =23=5BIgnore=5D indicating that a property should be skipped in a seria= lization contextl - =23=5BExclude=5D telling the dependency injection container that a give= n class should be skipped from automatic service registration =46rom Doctrine ORM: - =23=5BId=5D to tell which property of en entity class should be mapped = as primary key Those are meant to opt in/out some behavior through detection only. But w= ith the current API, such code needs to call =60getAttributes()=60 while = it doesn't care about the returned ReflectionAttribute instances. Hence I=E2=80=99m wondering if we could add a =60hasAttribute()=60 method= to the reflectors that are targetable by attributes. Does that make sense=3F If it does, do I need to open an R=46C for that feature or is a pull requ= est be enough=3F Anyway, I=E2=80=99d be happy to work on the implementation as a first con= tribution to PHP. Looking forward to your feedback. Thanks. Robin Robin Chalas Principal Engineer =40Les-Tilleuls.coop 03 66 72 43 94 robin=40les-tilleuls.coop 82 Rue Winston Churchill - 59160 Lomme --64ae1d3f_4ccc316d_24c1--