Re: Re: PHP 8 is_file/is_dir input handling

From: Date: Wed, 02 Dec 2020 23:06:59 +0000
Subject: Re: Re: PHP 8 is_file/is_dir input handling
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-112386@lists.php.net to get a copy of this message
On 2 December 2020 22:38:13 GMT+00:00, "Björn Larsson" <bjorn.x.larsson@telia.com> wrote: >One could add that here the PHP programmer need to do work that >basically >replicate how the code worked earlier for little gain. Just to reiterate, the previous implementation was also bad - it returned an entirely undocumented and unexpected null value. In many cases, that will have worked because it was implicitly cast to boolean, but in some cases it will already have led to a TypeError being thrown, e.g. in a wrapper like this: <?php declare(strict_types=1); class Dir { private $path; // ... public function hasFile(string $name): bool { return is_file("$path/$name"); } } Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#112386) next »