Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124765 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 513FE1A00B7 for ; Mon, 5 Aug 2024 13:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722863390; bh=/IWEGQk+E8u3vI6itAkDDnFMdqXIPQ622DauLe81ujs=; h=References:In-Reply-To:From:Date:Subject:To:From; b=IlSUyLOExlCod2Y3kLae4vTJqDwRIc/kX89rikaCzaqIt5TskfNoZRPSmCqss2M6h 8zUPwawK+dWcKuEj0gJ1pU5lSzOVll5ikyAA2SBncaxoDVbqUI7T3ccYJEqTNkNw7U ESU/D09Pbrzhxjq8jzgdVae3TL/ifIWad82TkzT7+eMjgyB+CoCEqRepG8yoJ2hLLL +iju8YlrKHupjCp93BeYMS/Z2GyOAXmha3hX9lvUhxWUp1F/PPK22dRwifQKcR9VmK s4LemwxXCg0vOdZS1gJVgACWx51Eu97zX2Z49N0T2nqLShM57/JNZlRUxe8folMA2I +Pjee9xbddocg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 86E6A180341 for ; Mon, 5 Aug 2024 13:09:49 +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 autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 ; Mon, 5 Aug 2024 13:09:49 +0000 (UTC) Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-7a1d42da3f7so647322385a.2 for ; Mon, 05 Aug 2024 06:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722863287; x=1723468087; 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=/IWEGQk+E8u3vI6itAkDDnFMdqXIPQ622DauLe81ujs=; b=F660xmhtnUD/9BEIThFQSWLNaZO/F8j6/P/p7P/Y0t7CzmaUet01j+6m/5Dqwz1DQC //uR0ELd4wy/iq2+oIOMQ79kbP1SugmHVhnxOIIf6ELiuib1jAy8R2sVXtNbdzbUSm9q Tpp0A1+ZrMps/MeHGNJZf+mB3ouCOxrdXot0xQ9Y9s+G51UrpK9Emh5bYDl9V/PbGFYu 5QEXRNIyPQk1gDyle+yXraEY8NpcDdYibfqAyeb1O6gmV/Dx9WvO8iyKVFtSifpcvKDW s+7XyHaj5Ih4EyPS+r+EhPb7sGBLgWl1fWjTTLOlyWAV6uWGH/IVR5dMrfubAv3z4NXK zy8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722863287; x=1723468087; 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=/IWEGQk+E8u3vI6itAkDDnFMdqXIPQ622DauLe81ujs=; b=cpa05UeFChrQ+GZPbFkxQRiaSkhUQh1V+PjUxWmTC02Bll/jchQhwB6bkDJnyqlxpc XUy1/aLo7NMvfoY5BEXKP/48ctM+KUTqkR5dft0fOs0VWmxjIqXTDdNYQ4oC3wOLuC4/ O3XTtzwQqttmgbVsBdScJsW0jzVvTsJCP0w50ybxBiXaTBs9SqlOSDlBRbnAqyaUcWmV Psqv7PxXOXwMpAf60/++mI71VgDuZSelgNbyLwe0C/Q6tvS5+GBaRhC46aLgNEk3qsFu EFLwSMhX8glT9rNQ05tNp/a1xowMjbF6Xi8Lzmg/ozy36OdJTIaKZB6boAqTN/qksnU8 HjMA== X-Gm-Message-State: AOJu0Yx8AR3bJGFEVvf8U7DVKo6IoE2CAZ4YmSUgkxd81+86SyYXgAe2 v6pH/lo29fA8Jsl7+s2e83C8xZp6uCMfQp1ENqHfDgrGe7TjwmpwiBx1/VmkqYgxCxz+ZRdFfjF 0NEgcCSlhvn2RDlK34KeUl+Gno5s74VF4Cmpd1A== X-Google-Smtp-Source: AGHT+IG39P8lmSPUblYsRE4ySqR7dkYqUKBpSntqjE4NABr9QSu/cmVbKTs6ha/NJ1y48MpOvCBKOl5DuC6JSXe6wWc= X-Received: by 2002:a05:6214:3381:b0:6b9:299b:94ba with SMTP id 6a1803df08f44-6bb983fc070mr140496596d6.46.1722863287429; Mon, 05 Aug 2024 06:08:07 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <1a88918e-e808-d778-45e1-53797660e093@php.net> <3563cf9b-8eab-4c82-b525-a5d2f9a767bb@varteg.nz> <38920A4B-790D-48C7-B2F6-C49D3F506232@rwec.co.uk> <0824789d-0e36-4628-85c1-4b8d9b7f86af@varteg.nz> <2244a37f-8c51-448d-8a56-329ff32e6470@bastelstu.be> <0e1a21ddef3c7da17a3539b92d5f442763f4b1f8.camel@ageofdream.com> <5f1da5195e2aea7ec41e95ff4354f50b1717d3cf.camel@ageofdream.com> <599a445530357d080cb59c9443cacd5cfd5da82f.camel@ageofdream.com> <896ef99559e4e71d8f1c3abc47415b37ae325e55.camel@ageofdream.com> In-Reply-To: <896ef99559e4e71d8f1c3abc47415b37ae325e55.camel@ageofdream.com> Date: Mon, 5 Aug 2024 15:07:56 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC] Add Directive to Make All Namespaced Function Calls Global To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) On Mon, Aug 5, 2024 at 2:27=E2=80=AFPM Nick Lockheart wrote: > > > > I'm not sure your proposal solves the mocking problem. If the engine > > is to interpret all non-fq calls as global or local, how would a > > library include your file while switching this configuration, when it > > is implemented as some directive in the file? > > I'm not sure I understand this question. Consider this example: > Also, how would only singular functions be mocked when there is no > > fallback to the global scope for the rest of the functions used > > within the file? That would necessitate mocking all functions, even > > the unmodified ones. > > If a developer needed to override built-in functions (in a specific > file) with local ones, and still use some built-in functions, they > would then need to use the fully-qualified `\function();` to call the > built-in. Well, ok. But then we're back to prefixing global calls, which defeats the purpose of the proposal. I think it's much preferable to look for a different, more robust mocking solution that also works for unnamespaced code and fully qualified calls. Ilija