Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120752 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91517 invoked from network); 5 Jul 2023 16:17:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Jul 2023 16:17:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E89981804DF for ; Wed, 5 Jul 2023 09:16:57 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (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 ; Wed, 5 Jul 2023 09:16:57 -0700 (PDT) Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-19674cab442so6065334fac.3 for ; Wed, 05 Jul 2023 09:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688573817; x=1691165817; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=b9YKAA0Uh4P10003HBLrXMSCFSiAUFemXP55r294yvs=; b=TtbFMOvvloTL0ns70n22vWdzpDh8CQgBPZCh6SRza5IPYDI5scxeFFe/B1rbs+WFiO 6PmQ987lKkVjZ0rRQPo/tVvQoTXroS+d/SD95/g0Nhs0KUOvNi4LRFAmodjQipzWjBY/ amzyXdwIEtXoDGwYA2IVRvW4YiFuZU7RDHdqw9jWsrLpcvx4ewKJ0otzz12rcbtnB6Me ySxd0LsYpmmvQ7BFhfiyemWGG890G+DFeWo5eB/VBe5D5XG9mQN3cOCfjWDOtDEq5Umg O2PqLHio37pEjcMoUGkYFncaqqH04b5Q+ePYSsDQePH6KU4T/M4gwKOXavgdPbNQwgYb AgcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688573817; x=1691165817; 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=b9YKAA0Uh4P10003HBLrXMSCFSiAUFemXP55r294yvs=; b=OsiF/mFdRvrdm7huNO/KDyhUa7jH062iuOncHCjSRzy0YWHbDp+OjdSMWed2fQwBIW aaSiDa/IEr/ZANmFBoZtd28u24xwrBQxGaL6KeM+UK4fR4wObKAxiZKgJlRin+CY+hyX VrMgmxH9Y95+yrtbEm2l/epl+GcYmyLOR5IYi8e6JiObfvMmxa7rNKJQbRPdIzM6kcQa U4QJY/WrrkAqhi/A6JzArEn60m73R/dcgdGTcvDfFIWN/Ncp0DNm7w4Os6D0x4YUa3b+ OLeu7lHtvlb+yhCiG3EoIDOEpww1mJpJinHoc0o0AAdSVcfY707vYmmpPKQajnDBWMV8 GHkw== X-Gm-Message-State: ABy/qLY6wp8CBTiE9g1+WADSkkit8Q9YdCCtmfAR8XPpU5diEVCpydE0 q6tCs93UNzuiVURHi3EF34BZlJf3jKA20xiwx4M= X-Google-Smtp-Source: APBJJlFK8C1o15YDfFQbqGoZcWE7e5nNZMJsYgSC9lgNjSX5qpiPr7nse+mUGZVK96tcrUfj7g+kVA1p1Gq++4Rkqn8= X-Received: by 2002:a05:6870:1f94:b0:1b3:eec8:fa90 with SMTP id go20-20020a0568701f9400b001b3eec8fa90mr1284675oac.6.1688573816593; Wed, 05 Jul 2023 09:16:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 5 Jul 2023 18:16:45 +0200 Message-ID: To: Fabio Carpi Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="00000000000083e11a05ffbfbaf7" Subject: Re: [PHP-DEV] SomeClass::class error??? From: ocramius@gmail.com (Marco Pivetta) --00000000000083e11a05ffbfbaf7 Content-Type: text/plain; charset="UTF-8" Hey Fabio, On Wed, 5 Jul 2023 at 18:14, Fabio Carpi wrote: > I'm new here on the list... Hello everyone! > > I use ::class sometimes to check some classes, but it works with any > keyword, even if the class doesn't exist. > The IDE doesn't show the error, and I only detect the error when the > specific piece of code is running... > > echo foo::class; > See https://3v4l.org/8lL10 `::class` is effectively replaced with a string at compile time: Finding entry points Branch analysis from position: 0 1 jumps found. (Code = 62) Position 1 = -2 filename: /in/8lL10 function name: (null) number of ops: 2 compiled vars: none line #* E I O op fetch ext return operands ------------------------------------------------------------------------------------- 2 0 E > ECHO 'foo' 3 1 > RETURN 1 This is by design, since otherwise each `::class` lookup would result in autoloading, which would be disastrous for large maps of classes (like in service containers). Marco Pivetta https://mastodon.social/@ocramius https://ocramius.github.io/ --00000000000083e11a05ffbfbaf7--