On Thu, 5 Jun 2025, 13:56 Bradley Hayes, wrote:
> Here is another way to think about it, trying to make the arguments
> optional not have a new value type.
>
> Optional arguments currently requires a default value.
>
> Assigning values to properties is truly optional but we cant reflect this
> in
Here is another way to think about it, trying to make the arguments
optional not have a new value type.
Optional arguments currently requires a default value.
Assigning values to properties is truly optional but we cant reflect this
in the constructor parameters.
class DTO {
public function
Hey Claude, i did think of the same thing you proposed and I cover that in
the gihub issue I linked to. This doesnt replicate the uninitialized state.
Doing ti with custom classes or enums means now not only are forced to
manually check each property everywhere it might be used you also have to
wr
> Le 3 juin 2025 à 06:22, Bradley Hayes a écrit :
>
> Uninitialized properties are really useful.
> Being skipped in foreach loops and JSON encoded results and other behaviours
> around uninitialized properties save a lot of time wasted on basic checks and
> uncaught logical mistakes around n
Could be handy to allow this in normal functions too (but this it not
the main use case and could be disallowed):
public static function get(string $name, mixed $default = uninitialized): string
{
$value = getenv($name);
if ($value === false) {
return $default; // throws uninitiali
Uninitialized properties are really useful.
Being skipped in foreach loops and JSON encoded results and other
behaviours around uninitialized properties save a lot of time wasted on
basic checks and uncaught logical mistakes around null values.
With the introduction of named arguments and promoted