Re: Deprecation of the Error Control Operator (@ symbol)

From: Date: Thu, 31 Dec 2015 21:48:13 +0000
Subject: Re: Deprecation of the Error Control Operator (@ symbol)
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-89947@lists.php.net to get a copy of this message
On Thu, Dec 31, 2015 at 4:10 PM, Stanislav Malyshev <smalyshev@gmail.com> wrote: > > The inherent problem is that some error reporting is unneeded in some > contexts, while welcome in others. That's the problem that needs > solving, the syntax is secondary to it. > That hits the nail on the head. When triggered errors are unneeded, @ works beautifully. When they're needed, use a helper like from my third-party library <https://github.com/haldayne/fox/blob/master/src/CaptureErrors.php> to capture them: use Haldayne\Fox\CaptureErrors; $copy = new CaptureErrors(function ($a, $b) { return copy($a, $b); }); $okay = $copy('foo.txt', 'bar.txt'); if (! $okay) { throw new RuntimeException($copy->getCapturedErrors()->pop()->get('message')); } I am -1 on removing @ for 7.x series. But, I would be in favor of all changes that remove unnecessary error messages or add functionality to better work with error messages. In my mind, those are requisite steps before removing @. Thanks, bishop

« previous php.internals (#89947) next »