Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Adjust is_callable usage where needed for PHP 8 #34999

Merged
merged 2 commits into from Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Illuminate/Console/Scheduling/CallbackEvent.php
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Console\Scheduling;

use Illuminate\Contracts\Container\Container;
use Illuminate\Support\Reflector;
use InvalidArgumentException;
use LogicException;

Expand Down Expand Up @@ -35,7 +36,7 @@ class CallbackEvent extends Event
*/
public function __construct(EventMutex $mutex, $callback, array $parameters = [], $timezone = null)
{
if (! is_string($callback) && ! is_callable($callback)) {
if (! is_string($callback) && ! Reflector::isCallable($callback)) {
throw new InvalidArgumentException(
'Invalid scheduled callback event. Must be a string or callable.'
);
Expand Down Expand Up @@ -163,6 +164,6 @@ public function getSummaryForDisplay()
return $this->description;
}

return is_string($this->callback) ? $this->callback : 'Closure';
return is_string($this->callback) ? $this->callback : 'Callback';
}
}
5 changes: 3 additions & 2 deletions src/Illuminate/Console/Scheduling/Event.php
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Reflector;
use Illuminate\Support\Traits\Macroable;
use Psr\Http\Client\ClientExceptionInterface;
use Symfony\Component\Process\Process;
Expand Down Expand Up @@ -672,7 +673,7 @@ public function onOneServer()
*/
public function when($callback)
{
$this->filters[] = is_callable($callback) ? $callback : function () use ($callback) {
$this->filters[] = Reflector::isCallable($callback) ? $callback : function () use ($callback) {
return $callback;
};

Expand All @@ -687,7 +688,7 @@ public function when($callback)
*/
public function skip($callback)
{
$this->rejects[] = is_callable($callback) ? $callback : function () use ($callback) {
$this->rejects[] = Reflector::isCallable($callback) ? $callback : function () use ($callback) {
return $callback;
};

Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Foundation/Exceptions/Handler.php
Expand Up @@ -19,6 +19,7 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Reflector;
use Illuminate\Support\ViewErrorBag;
use Illuminate\Validation\ValidationException;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -103,7 +104,7 @@ public function report(Exception $e)
return;
}

if (is_callable($reportCallable = [$e, 'report'])) {
if (Reflector::isCallable($reportCallable = [$e, 'report'])) {
return $this->container->call($reportCallable);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/RouteSignatureParameters.php
Expand Up @@ -37,7 +37,7 @@ protected static function fromClassMethodString($uses)
{
[$class, $method] = Str::parseCallback($uses);

if (! method_exists($class, $method) && is_callable($class, $method)) {
if (! method_exists($class, $method) && Reflector::isCallable($class, $method)) {
return [];
}

Expand Down