Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120949 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78070 invoked from network); 29 Aug 2023 16:36:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Aug 2023 16:36:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B9A6F1804DF for ; Tue, 29 Aug 2023 09:36:46 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, 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=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (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, 29 Aug 2023 09:36:43 -0700 (PDT) Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3a9a6a7a824so2354317b6e.1 for ; Tue, 29 Aug 2023 09:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693327002; x=1693931802; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3i7NsLDleDiG5Tlyz1K7LoYascei8ddHLm6A/VyiI98=; b=ajfqXEoJjN6D9mgGbaSN88rzjYq0QGzO+7Tpbd6GmXd/9nVM/tCdo4UCtyioC20Dju 91OQk90PtcOl8Ey3SDKBYfg2Z7tCc7zZoOOvigHLVDLnBXMwnXYKRbniZjlPPshtTY5b cPap5Ae9c2jj1ZLzYSRxih6xlCvvp1V9LjrUm4labS4xPEaOsd6c26kjggBLwbWy0Ioi D9USQsrrfnpQXWFmYJxlpNONC5tI03GbapuWy/gr0kl4/OnLPe8R+A+m6XYl0H6RV71N srwqlSkBUnZWS5UGMX2iuBOC2Th5qMM3GVrGDyEN9/HQ0oVkk+4s2YMwCzbkm4Z7UmGw JG8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693327002; x=1693931802; h=content-transfer-encoding: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=3i7NsLDleDiG5Tlyz1K7LoYascei8ddHLm6A/VyiI98=; b=ZnW1Pj66IK5pE5O3eF/KR5iTGvTGxSEa6FP4sor7n1TP1iJGFEkbotPp5JuXtTI5Xy eImtyZkc8oh5PxEqgD3CXgXWtvbyRJCjbGquyg6alGeHjNh3WmfDL7gzBgIbYXzoQefS tRW0K2+VUP1IGNkkThnx72Dc0J2Y7QhveC70Kzyta47IdMHuxPApumAgS/wq2RXih+nk six3JULfce81orCjuNw6gpJxF5LVKQZqqwMNu1NaUvaUJqw8etVnJGW2FBBnkDAiKtsy 4eZQpUbqv3uOJOGEzXC0eBJGYVOULMl5DPoWfsV9plsEJ01po1++315BPBpP0rT75/T7 K/qw== X-Gm-Message-State: AOJu0YxmAYbU0nRDFfef65yGhwBUnsajle8g6M0QKzYBOFANVuYi/J2y +m021PUCKRkRjUcvuDNz5KW/ps7yClZYiFUGhozV3CfLhZc= X-Google-Smtp-Source: AGHT+IG6e8a0L3nSRkYwvoQiQ+rEqOuj+179c078F60qkRS7o50+B0YRcCIJstTSVI2GVs96+gkVZvB0UrA+ygy+erg= X-Received: by 2002:a05:6808:180e:b0:3a7:7a9:dd16 with SMTP id bh14-20020a056808180e00b003a707a9dd16mr2055127oib.26.1693327002453; Tue, 29 Aug 2023 09:36:42 -0700 (PDT) MIME-Version: 1.0 References: <4406C50C-18FF-4F20-BA7B-206E86610CCC@sakiot.com> <245BD1CC-7D54-4CBE-9640-5C8FF5225617@gmail.com> <5B8A7736-9A2A-47E1-B410-4D734DC75EBE@gmail.com> In-Reply-To: <5B8A7736-9A2A-47E1-B410-4D734DC75EBE@gmail.com> Date: Tue, 29 Aug 2023 18:36:06 +0200 Message-ID: To: Claude Pache Cc: Saki Takamachi , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Apply strict_types to internal functions From: divinity76@gmail.com (Hans Henrik Bergan) maybe we could do a declare(internal_strict_types=3D1); on a per-file basis just like the existing userland strict_types? (name is up for bikeshedding ofc) On Tue, 29 Aug 2023 at 17:49, Claude Pache wrote: > > > > > Le 29 ao=C3=BBt 2023 =C3=A0 15:19, Saki Takamachi a = =C3=A9crit : > > > >> Hi, > >> > >> The larger issue is that higher-order functions do not inherit the `st= rict_types` mode from its calling code, and this is not specific to interna= l functions. > >> > >> If you intend to change that for internal functions (with proper depre= cation period, of course), you might consider making such a behaviour also = possible for userland functions (probably using some opt-in); so that futur= e higher-order internal functions do not become impossible to polyfill. > >> > >> =E2=80=94Claude > > > > Hi, thank you for confirming. > > > > If you simply put the problem you pointed out in the code, would it be = something like this? > > https://gist.github.com/SakiTakamachi/8292dbfe92a2029a6c7b506b12296b7d > > > > Admittedly, I don't think this is intuitive either. > > That might not be intuitive to you, but it follows directly from the spec= ified semantics: whether a function is called in `strict_types` mode or not= , depends only on where the function is called. I personally doubt that the= re is an easy way to adjust the rule in order to make it both =E2=80=9Cintu= itive=E2=80=9D and simple. > > > > > [...] > > > > When considering the inheritance of strict_types, I think that it shoul= d be an attribute that can be set in =E2=80=9Cphp.ini" instead of being spe= cified for each file. > > > > What do you think? > > Beware that there are many third-party packages that have not opted for `= strict_types=3D1`; if you enable that mode globally, you might make those p= ackages malfunction. > > As I have just checked, among the packages I=E2=80=99ve installed via com= poser, there are more packages that do not use `strict_types=3D1`, than pac= kages that use it. Among those that don=E2=80=99t use `strict_types`, the f= ollowing ones are fairly common: > > google/apiclient > league/oauth2-client > michelf/php-markdown > microsoft/microsoft-graph > phpmailer/phpmailer > phpoffice/phpspreadsheet > phpseclib/phpseclib > > =E2=80=94Claude > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >