[PHP-DEV] readonly properties

2021-08-12 Thread Marc

Hi,

As 8.1 adds readonly properties I wonder which build-in properties 
should be defined readonly.


Currently I could find build-in readonly properties only on PDO and DOM.


Very incomplete list where readonly properties could make sense:

1. Enum properties:

enum Test:string {
    case TEST = 'test';
}

$case = TEST::TEST;
$refl = (new ReflectionObject($case))->getProperty('value');
var_dump($refl->isReadOnly());  // false
var_dump($refl->isPublic());  // true
$case->value = 'foo'; // Fatal error: Uncaught Error: Enum properties 
are immutable



2. DateInterval->days

$interval = (new DateTime())->diff(new DateTime());
var_dump($interval->days); // 0
$refl = (new ReflectionObject($interval))->getProperty('days');
var_dump($refl->isReadOnly()); // false
var_dump($refl->isPublic()); // true
$interval->days = 2;
var_dump($interval->days);  // 0


3. Exception properties

Exception properties are protected but does it really make sense to be 
able to modify an exception property after initialization?


I know this would be a BC break :(


Thanks for all the excellent work - Can't wait for 8.1 :)

Marc

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



[PHP-DEV] PHP 7.4.23RC1 is available for testing

2021-08-12 Thread Derick Rethans
PHP 7.4.23RC1 has just been released and can be downloaded from:



Or use the git tag: php-7.4.23RC1

Windows binaries are available at: 

Please test it carefully, and report any bugs in the bug system at
.

Hash values and PGP signatures can be found below or at
.

7.4.23 should be expected in 2 weeks, i.e. on August 26th, 2021.

Thank you, and happy testing!

Regards,
Derick Rethans


php-7.4.23RC1.tar.gz
SHA256 hash: 2a7af0727073667d23e1766bfd881f6bbb3c60b7173346d45e6c79e65db2d984
PGP signature:
-BEGIN PGP SIGNATURE-

iQIzBAABCgAdFiEEWlKIB4H3VWCL+BX8kQ3rRvU+oxIFAmESO00ACgkQkQ3rRvU+
oxKgtxAAqe7Gpe9ZygqxnK/Urher6riUkd5mCiMdVnjhyl+/6XOBtwQs0ULzdswa
5MaZXzuvdO2F0GA4uBYv5VFVG+tSW5K2sGjO/ocuWVwXpaXCQF/prlg4t46sP55R
TiG6Rnj+I1u3noNKNPldi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tCWaYvasd3rx6WIugwOJfdLe+093j8Iwdw1MbuVQUJl2oPT+uUUztXw3V
nQzEo3Yu5zFHXoKkfRwm3JybqHwL7c/I6Za34HPkk8KTSlUWN1szSd5u8QW9jgvq
9Yqef8WYOGg7Lw+vLrbNzL4ooGQZfH7AnQCYYl0WuWRANP0cWug=
=AQNo
-END PGP SIGNATURE-


-- 
PHP 7.4 Release Manager
Host of PHP Internals News: https://phpinternals.news
Like Xdebug? Consider supporting me: https://xdebug.org/support
https://derickrethans.nl | https://xdebug.org | https://dram.io
twitter: @derickr and @xdebug

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



Re: [PHP-DEV] Re: [RFC] Nullable intersection types

2021-08-12 Thread Nicolas Grekas
> On 11/08/2021 13:09, Nicolas Grekas wrote:
> >
> > On 10/08/2021 13:39, Nicolas Grekas wrote:
> > > I will wait if I don't have the choice, but as many others
> > reported, the
> > > experience with 7.0 missing nullability was a pain.
> >
> > Apologies if you already did and I've forgotten, but could you please
> > expand on what "pain" you are referring to here?
> >
> >
> > I personally did not experience that pain because I just skipped 7.0,
> > since it wouldn't allow expressing the nullable return types I had to
> > express in the APIs I maintain.
>
>
> Sorry, I'm still confused what the "pain" is *other than* feeling
> obliged to wait until 7.1.
>

Maybe others that read this can share their experience on the topic?


> The larger issue is that when used as a type on arguments, adding the
> > nullability flag isn't possible without a BC breaking change.
>
>
> I can't imagine many people will force a parameter to be non-nullable
> just to use the shiny new syntax, then re-allow nulls in a subsequent
> version. More likely, they will leave that parameter un-checked until
> the full type can be specified.
>
> There is also a lot of code out there which is either:
>
> * in stand-alone applications, so backwards compatibility has no meaning
> * in private libraries with a handful of uses, so bringing uses in line
> is trivial
> * in public libraries, but marked "private" or "final", or documented as
> "internal use only", and therefore not subject to compatibility guarantees
>
>
> > But until it's too late, I'm willing to engage in this topic because I
> > think the current state is far from ideal for 8.1.
>
>
> There are always more features we could add, and there will always be a
> judgement call of what versions of PHP a code base should support.
>
> If it was generally agreed that there was only one right way to
> implement nullable intersections, and it was a trivial change, then I'd
> support it as a "quick win"; but that doesn't seem to be the case.
>

It is a trivial change from a technical pov, that's why I submit it for
8.1. There's zero risk.

Thanks for your feedback btw!

Nicolas


[PHP-DEV] Re: [RFC] Nullable intersection types

2021-08-12 Thread Nicolas Grekas
>
> Hi everyone,
>
> as proposed by Nikita and Joe, I'm submitting this late RFC for your
> consideration for inclusion in PHP 8.1. Intersection types as currently
> accepted are not nullable. This RFC proposes to make them so.
>
> I wrote everything down about the reasons why here:
> https://wiki.php.net/rfc/nullable_intersection_types
>
> Please have a look and let me know what you think.
>


Hi everyone,

I think it's time to move on. I'm going to open the vote tomorrow.
I'd still be happy to get more feedback before or during the vote!

Nicolas