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

[5.5] Use Arr and Str classes. #20879

Merged
merged 1 commit into from
Aug 31, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Foundation\Auth\Access;

use Illuminate\Support\Str;
use Illuminate\Contracts\Auth\Access\Gate;

trait AuthorizesRequests
Expand Down Expand Up @@ -81,7 +82,7 @@ protected function normalizeGuessedAbilityName($ability)
*/
public function authorizeResource($model, $parameter = null, array $options = [], $request = null)
{
$parameter = $parameter ?: snake_case(lcfirst(class_basename($model)));
$parameter = $parameter ?: Str::snake(lcfirst(class_basename($model)));

$middleware = [];

Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Foundation/Console/TestMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Foundation\Console;

use Illuminate\Support\Str;
use Illuminate\Console\GeneratorCommand;

class TestMakeCommand extends GeneratorCommand
Expand Down Expand Up @@ -49,7 +50,7 @@ protected function getStub()
*/
protected function getPath($name)
{
$name = str_replace_first($this->rootNamespace(), '', $name);
$name = Str::replaceFirst($this->rootNamespace(), '', $name);

return $this->laravel->basePath().'/tests'.str_replace('\\', '/', $name).'.php';
}
Expand Down
5 changes: 3 additions & 2 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Illuminate\Support\Str;
use Illuminate\Support\Carbon;
use Illuminate\Support\HtmlString;
use Illuminate\Container\Container;
Expand Down Expand Up @@ -546,11 +547,11 @@ function mix($path, $manifestDirectory = '')
{
static $manifests = [];

if (! starts_with($path, '/')) {
if (! Str::startsWith($path, '/')) {
$path = "/{$path}";
}

if ($manifestDirectory && ! starts_with($manifestDirectory, '/')) {
if ($manifestDirectory && ! Str::startsWith($manifestDirectory, '/')) {
$manifestDirectory = "/{$manifestDirectory}";
}

Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Http/Resources/Json/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use ArrayAccess;
use JsonSerializable;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Container\Container;
use Illuminate\Http\Resources\MergeValue;
Expand Down Expand Up @@ -256,7 +257,7 @@ protected function mergeWhen($condition, $value)
protected function attributes($attributes)
{
return new MergeValue(
array_only($this->resource->toArray(), $attributes)
Arr::only($this->resource->toArray(), $attributes)
);
}

Expand Down