Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122970 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 qa.php.net (Postfix) with ESMTPS id A60BE1A009C for ; Fri, 5 Apr 2024 13:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712325575; bh=LApNKgU5iJqEO/aLQUgQcbpduYdIDVIrBRy5ZwMGKlg=; h=References:In-Reply-To:From:Date:Subject:To:From; b=e44HFCWIHUHyqa6Zy9y9m5/FWNLI2xD27b5S6gzZyUlv5O22N42YipHa3fMR5Tas8 0rNpWY5+sMJua8HjU4FwGbtLvZDIpanuMSBbA2WO140nBF3kbUn7787E3KqjHKMBAp H/LiRDhol+XPDkTQlAsAyGFHmfD8gADxVQwumMySumT0/DIKjiYVz48Reyoz4yJf+4 JmodYZyo8L5eaYtlwEe9bJCwIl6KhdtkoBeu/LKb/wIrs4k1ueezn2Pdxy1yMQFsf/ CTqcD+8O646vXaYYQNcAiJfRPxX37eZ/IHwHr3myjETPfaykQ8/gaiQCbh2y7LICNq gRHqpEtzamAZQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 567AF180816 for ; Fri, 5 Apr 2024 13:59:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) 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_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) (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, 5 Apr 2024 13:59:33 +0000 (UTC) Received: by mail-ua1-f41.google.com with SMTP id a1e0cc1a2514c-7e04e70c372so785095241.0 for ; Fri, 05 Apr 2024 06:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712325543; x=1712930343; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LApNKgU5iJqEO/aLQUgQcbpduYdIDVIrBRy5ZwMGKlg=; b=fbuGg3+urKC2PcIaG1HHmSpQn0uPnDJ4zSJw/uJXYkh5d4AM6kqPrKHwY8gvwMpErL vbFBYGDMTfY/BWS6dAN+2hwmSy0giRL8J4VrMZNQMSzJi9BosBidN0eHpKwE6651sfvB EFDLeCkW9uGqK7sianUdtDJa9UH3VHb5RBnoVA9HD8UGFspb9RcSqK3wIK96dYYt9BSU oDNPcK4zoEcAtr7vgXcD/yZejyi2aGX10U4BhZYC4ov/NQah2ixvEIcIYlo/TulOSNZb hUhaJ7b39+2A+yeRxk4n354YduBGYkigt46vk0+BT5PVu+mSA4RljR3jpHDFGoCSd1xz HIkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712325543; x=1712930343; h=content-transfer-encoding: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=LApNKgU5iJqEO/aLQUgQcbpduYdIDVIrBRy5ZwMGKlg=; b=DX1GbEwRKPt7kYd/uYz6QuB48jXBKu2Z9PerAqnyUPG3MB6vjrLeINJpiXXukQsG5K 8LcYOyhb3MtdAAqSlk4rlI3aK/vXNDZ9Eh/19OKpWGf+/dfglrUDcZunXg/MCNqQNcem XcYKa671sINVbk0wyO2dUQofFtyefGIM5shtZ2TVSUkNuUVYjSKNlZuF4iKL9ajjzLu0 Ts2sXXp79BuoGaZG0tfopenBeUpQZNMjfXbmwjmvLluTz7CwaMyJ7I5qBreRoT4C/ETR PVoZTzbIInABybRT1/iYQRlUFkupd3efAdnju0x9yQ5lgv+8X9wJSULoCTqL4FL1OMiA l/zw== X-Gm-Message-State: AOJu0YzK1AG6rv6yZ1hetLIhoG4mLvAZ/16SZw8Ae3rUT9HjspY/Jdgy qIXmq9tU+V2HDvZOhY72MaNoINxN4jo7GTHUHiv55CZBXm+lMIJ+pvfM9OuuY5v+/Xtim31E+0K qrykotdFj3lvRM5Tu6mypucrxaINivydOqpu5xkEt X-Google-Smtp-Source: AGHT+IHhEFyMkWVjHvgLW6dF/kNcnZZCrDrCViPhNEVSeq2QtBIcBZ5EMs/eCuR6tTmBWzRx6AR/ckq1+64ZoEfJy/0= X-Received: by 2002:a05:6102:3051:b0:479:e476:ba41 with SMTP id w17-20020a056102305100b00479e476ba41mr502867vsa.16.1712325543339; Fri, 05 Apr 2024 06:59:03 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 5 Apr 2024 15:58:52 +0200 Message-ID: Subject: Re: [PHP-DEV] Proposal: retrieve line, filename and if user defined for ReflectionAttribute To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Joel On Fri, Apr 5, 2024 at 3:10=E2=80=AFPM Joel Wurtz wro= te: > > Like a lot of libraries, we offer the possibility to configure behaviors = with Attributes. However in some cases it's wrongly configured by the user = and this wrong configuration cannot be detected on the attribute constructo= r but afterwards. > > In this case we may want to pinpoint which attribute (in which file and a= t which line) cause this bad configuration. Since there was no method to re= trieve those information in the ReflectionAttribute I proposed a PR https:/= /github.com/php/php-src/pull/13889 to add those informations. > > I do believe this will allow better DX for end user when correctly used, I would propose negating and renaming isUserDefined() to isInternal(), since we already have several such methods. As hinted in the PR, I believe the implementation is wrong, or rather doesn't do what you would expect it to do. I'm also wondering whether it may be more useful to expose the attribute class as getClass(), without instantiating the attribute itself. This would allow you to check for isInternal() there, along with all the other class reflection information. Ilija