Am 31.07.2025 um 13:16 schrieb Rowan Tommins [IMSoP] <imsop....@rwec.co.uk>:
> I think an inline syntax like this would be a powerful feature, and a 
> potential replacement for the @ operator:
> 
> $fh = null;
> $fh = try fopen($filePath, 'w') ignore (FileLockedException);

First of all: I'm wary because partial error handling seems dangerous to mel do 
I know all possible Exception types and which ones should abort and which ones 
should continue? Or will it encourage try ... ignore (Exception)? I have to 
admit that I'm also a sceptic of converting every possible info/warning/error 
to an Exception but that's a different topic ;-)

If we decide to add something like the above I would very much prefer the try 
... ignore block to be an expression with value null on error, making the first 
line obsolete. One could still use
        $lines = try file($filepath) ignore (FileLockedException) ?? [];
if another default value is preferred.

Regards,
- Chris

Reply via email to