Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123674 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 01C981A009C for ; Wed, 19 Jun 2024 12:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1718798742; bh=w7UXcuVBz2VhrwnRLv1C8wTpYuBdeSkxchLc7c3Rde8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TFnlR+5aYlkHTzo55HFqIvhRd90NlJ7SFekYYSXwMy+y+bFJBsgn3qWbuKPx3m0kj ppIcLBgna4+g3USvx9q3fcVeo2KoJjO4KLxSfNY4zGfML8fLixnc6EvsKdH2AMSSiT EfInqRsOMWWL3YS36scdKTilfaK195cVJrAdmxRi+j7D1JDjial/EFEHVSNOoMgIqX A71CcJpTh73M3wFicyxT01MjJmW/oMPnzHTAbwLFR6fJ7vkf2hoGRT1nr08Dn5FcYP mkH8rlnB9skdZbvc5qoUY8yUV74m/f84Nq2+l/NtqGRk5t1eNihh8uFx6jwk941J4n GSXaWztAUx77A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3E88318005C for ; Wed, 19 Jun 2024 12:05:42 +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, 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=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) (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 ; Wed, 19 Jun 2024 12:05:41 +0000 (UTC) Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-e0272692096so1655924276.1 for ; Wed, 19 Jun 2024 05:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718798668; x=1719403468; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=w7UXcuVBz2VhrwnRLv1C8wTpYuBdeSkxchLc7c3Rde8=; b=XahhoqIZ8Mt+W+hyhL2w2zFDZ5UT4kpT77iR3wV38BQYERTLmUx+A9tzni0MOZXjqm IVFiYTbmw8GtgqWI364IwutMs+BZC7gW/MtObJnGcjoGt4j5GY2HNkJ4zfLo0sRJKJT4 Z0YwtiiPo4NMK2JRzqfBeAoc9m88wItiZb1280CKCd08pmtqQu1f3rfS3H2yBqiycnwg wj2fSNxAmwOkUKh+je83GeGe52n8Mrb82rVSVvPH4H3OOdGoYQ8KH2OT98L/y5Yi354S V4RyrmduP2xftSgokGcHnmX5CM9p+pci6fFJbC4eFvEFXuGMAliXpVuwkcEocYjGXyHE BQIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718798668; x=1719403468; 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=w7UXcuVBz2VhrwnRLv1C8wTpYuBdeSkxchLc7c3Rde8=; b=tu79w4rIm+Jxj1MmxKlUQWFCwm7qiCvEciLh3f7VLcCAhHytv/EL4wrt1H2XC8rVyD qKkBh4vuX8Cbb6P0wVICCyJScGTj4suuZmBhgdW9ouhzwCFi+rDvRjrQp2I9zV6Rwn4G mJgZa8MYV5W37y8J9mX3EPD3E1eMjIDM1q/Ojc0vTLAymqiF91aOpJWKEmjsImLMViM+ 2j31dXGr8OPxSiGrsRWCC2fa6yefKs1OI/UuWHrqCG3zcz1Yy+gt4bsB+Y9NQNPoEtNJ 2lg2Kj/sesD2St0yxhixb0euM0jiE7BJ24LwuyM6GIB8QVaovLY80JyhIl4lo3FBa9XF VwfA== X-Forwarded-Encrypted: i=1; AJvYcCXfQa/raP52N/wrqlPK9rvX5L4YU0ocZzl/xVTdwLQUnXdQptQkZjZd4tUXpUmovEgsx84VEf3jzCluMVX18m0Vb8Cl0pnPjg== X-Gm-Message-State: AOJu0Yxsc2+xmqOUz2Gyl7iR0oDkIQZXGMfTT+T/O86DGdiyEFoJolXD SI+xCAFypRERn0rewqUWmsuw7yco07DCL7rRMFvaiispp7j6bkjZESLo6vLFO3Ia/CQ96TBQ0KC xH93giGerm9cD1jl5b+ZJaQEOq090BlB3AGo= X-Google-Smtp-Source: AGHT+IEZ5nxTsczDWiXXyg5m4e5Wv+CirOa2V+tV/mgeBE/1wLQuqZdVh1m7FbEyBgMLuEx/RQUdphqu33ia6fC2bhc= X-Received: by 2002:a25:2f52:0:b0:dff:2c8b:1759 with SMTP id 3f1490d57ef6-e02be201b43mr2508696276.50.1718798667982; Wed, 19 Jun 2024 05:04:27 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 19 Jun 2024 14:04:16 +0200 Message-ID: Subject: Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion" To: David Gebler Cc: Robert Landers , internals Content-Type: multipart/alternative; boundary="0000000000000bb203061b3d007f" From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --0000000000000bb203061b3d007f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi David, Robert, wt., 18 cze 2024 o 23:12 David Gebler napisa=C5=82(= a): > ... > If I were to support any change to how this feature works for PHP 9, I > think it would be providing a mechanism to enable it for all files at onc= e, > maybe either via a .ini setting such as strict_types_default=3D1 or a new > declare which applies to all files included or autoloaded from that point > on, i.e. a declare that could be used as the first line of an entrypoint > script to make all files in a project have strict typing mode > enabled/disabled (unless a particular file overrides for its own scope wi= th > its own declare). > > Changing the name to anything other than what it is now, with or without > flipping the value, just seems like a major BC headache for no gain. > I share a similar opinion here. I'd also rather see a proposal that enables setting the declares outside of PHP files as this is mostly the same line for every file in most codebases I work with. # name it `.phpdeclare` in the execution directory or places where certain PHP files are read by the PHP interpreter, whatever ```ini # Global default directives [*.php] strict_types =3D 1 ticks =3D 0 encoding =3D UTF-8 # Directives for specific directories [src/*.php] strict_types =3D 1 [tests/*.php] strict_types =3D 0 # Directives for specific files [scripts/setup.php] strict_types =3D 1 ticks =3D 1 ``` Just an example, shoving some declares can be set using glob-like patterns or specific files. I see potential in this kind of declaring these directives for future extensions. This is something I'd love to consider instead of just renaming things we already have. Cheers, Micha=C5=82 Marcin Brzuchalski --0000000000000bb203061b3d007f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi David, Robert,

wt., 18 cze 2024 o 23:12= =C2=A0David Gebler <davidgebler= @gmail.com> napisa=C5=82(a):
...
If = I were to support any change to how this feature works for PHP 9, I think i= t would be providing a mechanism to enable it for all files at once, maybe = either via a .ini setting such as strict_types_default=3D1 or a new declare= which applies to all files included or autoloaded from that point on, i.e.= a declare that could be used as the first line of an entrypoint script to = make all files in a project have strict typing mode enabled/disabled (unles= s a particular file overrides for its own scope with its own declare).

Changing the name to anythin= g other than what it is now, with or without flipping the value, just seems= like a major BC headache for no gain.

I share a similar opinion here.
I'd also rather see a= proposal that enables setting the declares outside of PHP files as this is= mostly the same line for every file in most codebases I work with.

# name it `.phpdeclare` in the execution directory or pla= ces where certain PHP files are read by the PHP interpreter, whatever
=
```ini
# Global default directives
[*.php]
strict_types =3D= 1
ticks =3D 0
encoding =3D UTF-8

# Directives for specific di= rectories
[src/*.php]
strict_types =3D 1

[tests/*.php]
stri= ct_types =3D 0

# Directives for specific files
[scripts/setup.php= ]
strict_types =3D 1
ticks =3D 1
```

Just an example, shoving some declares can be set using glob-like patterns= or specific files.
I see potential in this kind of declaring the= se directives for future extensions.
This is something I'd lo= ve to consider instead of just renaming things we already have.
<= br>
Cheers,
Micha=C5=82 Marcin Brzuchalski
<= /div> --0000000000000bb203061b3d007f--