Skip to content

Commit

Permalink
Use Arr::wrap (#23484)
Browse files Browse the repository at this point in the history
  • Loading branch information
carusogabriel authored and taylorotwell committed Mar 10, 2018
1 parent 072189b commit 1908068
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Illuminate/Console/Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Closure;
use Cron\CronExpression;
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use GuzzleHttp\Client as HttpClient;
use Illuminate\Contracts\Mail\Mailer;
Expand Down Expand Up @@ -377,7 +378,7 @@ public function emailOutputTo($addresses, $onlyIfOutputExists = false)
{
$this->ensureOutputIsBeingCapturedForEmail();

$addresses = is_array($addresses) ? $addresses : [$addresses];
$addresses = Arr::wrap($addresses);

return $this->then(function (Mailer $mailer) use ($addresses, $onlyIfOutputExists) {
$this->emailOutput($mailer, $addresses, $onlyIfOutputExists);
Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Foundation/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Exception;
use Throwable;
use ReflectionClass;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Symfony\Component\Finder\Finder;
Expand Down Expand Up @@ -195,7 +196,7 @@ public function command($signature, Closure $callback)
*/
protected function load($paths)
{
$paths = array_unique(is_array($paths) ? $paths : (array) $paths);
$paths = array_unique(Arr::wrap($paths));

$paths = array_filter($paths, function ($path) {
return is_dir($path);
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public static function finish($value, $cap)
*/
public static function is($pattern, $value)
{
$patterns = is_array($pattern) ? $pattern : (array) $pattern;
$patterns = Arr::wrap($pattern);

if (empty($patterns)) {
return false;
Expand Down

0 comments on commit 1908068

Please sign in to comment.