if ($request->boolean('remote')) {
$disk = new S3Disk($config);
} else {
$disk = new LocalDisk($root);
}
$diskS3Disk|LocalDisk $disk->put($path, $contents);
NewBefore 0.14.0, only the last assignment counted: LocalDisk.
$user = $request->user();
if (! $user instanceof Admin) {
abort(403);
}
if ($user->ƒ canImpersonate()boolƒ permissions()arrayƒ getAuthIdentifier()mixed) { … }
NewAlso after assert(), in elseif, match (true), and after && or ||.
try {
$post = Post::findOrFail($id);
} catch (ModelNotFoundException $e) {
return response($e->ƒ getModel()?stringƒ getIds()arrayƒ setModel()staticƒ getMessage()string);
}
Newcatch (A|B $e) gives A|B, and unknown members on it are reported.
// Mailer::send(string $to, string $subject)
$mailer->send⚠ Too few arguments to send(): 1 passed, at least 2 required
argument-count-mismatch($order->email);
NewPHP would throw an ArgumentCountError here. Extra arguments to a method aren't reported any more: PHP allows them.
if (method_exists($notification, 'toArray')) {
return $notification->toArray✓ No warning: the call is checked first($notifiable);
}
// Also understood: property_exists(), is_callable([$x, 'name']),
// early returns and ternaries on the same receiver.
BeforeUnknown member 'toArray' on 'Notification'
$measure = strlen(...);
$bound = $measure->bindTo(null);
$measureClosure(string $string): int('tusk'); // int
NewFirst-class callable syntax gives a Closure with the callee's signature.