Skip to content

Commit 2ae8cff

Browse files
committed
Merge branch '6.x'
Signed-off-by: Mior Muhammad Zaki <[email protected]>
2 parents 003bd21 + 77c2e39 commit 2ae8cff

22 files changed

+66
-70
lines changed

.php_cs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ return PhpCsFixer\Config::create()
1010
'@Symfony' => true,
1111
'array_syntax' => ['syntax' => 'short'],
1212
'binary_operator_spaces' => ['align_double_arrow' => false, 'align_equals' => false],
13+
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
1314
'no_extra_blank_lines' => false,
1415
'no_empty_comment' => false,
1516
'no_extra_consecutive_blank_lines' => false,

src/Providers/CommandServiceProvider.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ abstract class CommandServiceProvider extends BaseServiceProvider implements Def
2828
*/
2929
public function register()
3030
{
31-
foreach (\array_keys($this->commands) as $command) {
31+
foreach (array_keys($this->commands) as $command) {
3232
$method = "register{$command}Command";
3333

3434
$this->{$method}();
3535
}
3636

37-
$this->commands(\array_values($this->commands));
37+
$this->commands(array_values($this->commands));
3838
}
3939

4040
/**
@@ -44,6 +44,6 @@ public function register()
4444
*/
4545
public function provides()
4646
{
47-
return \array_merge(\array_values($this->commands), $this->provides);
47+
return array_merge(array_values($this->commands), $this->provides);
4848
}
4949
}

src/Providers/Concerns/DiscoverableEventProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function discoverEvents()
4444

4545
return Collection::make($this->discoverEventsWithin())
4646
->reduce(static function ($discovered, $directory) use ($basePath) {
47-
return \array_merge_recursive(
47+
return array_merge_recursive(
4848
$discovered,
4949
DiscoverEvents::within($directory, $basePath)
5050
);

src/Providers/Concerns/EventProvider.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ trait EventProvider
1515
*/
1616
public function registerEventListeners(DispatcherContract $dispatcher): void
1717
{
18-
$events = \array_merge_recursive(
19-
(\method_exists($this, 'discoveredEvents') ? $this->discoveredEvents() : []),
18+
$events = array_merge_recursive(
19+
(method_exists($this, 'discoveredEvents') ? $this->discoveredEvents() : []),
2020
$this->listens()
2121
);
2222

2323
foreach ($events as $event => $listeners) {
24-
foreach (\array_unique($listeners) as $listener) {
24+
foreach (array_unique($listeners) as $listener) {
2525
$dispatcher->listen($event, $listener);
2626
}
2727
}

src/Providers/Concerns/PackageProvider.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function guessPackagePath(): string
115115
{
116116
$path = (new ReflectionClass($this))->getFileName();
117117

118-
return \realpath(\dirname($path).'/../../');
118+
return realpath(\dirname($path).'/../../');
119119
}
120120

121121
/**
@@ -129,7 +129,7 @@ public function guessPackagePath(): string
129129
protected function getPackageNamespace(string $package, string $namespace): string
130130
{
131131
if (\is_null($namespace)) {
132-
[, $namespace] = \explode('/', $package);
132+
[, $namespace] = explode('/', $package);
133133
}
134134

135135
return $namespace;
@@ -144,7 +144,7 @@ protected function getPackageNamespace(string $package, string $namespace): stri
144144
*/
145145
protected function getAppViewPaths(string $package): array
146146
{
147-
return \array_map(static function ($path) use ($package) {
147+
return array_map(static function ($path) use ($package) {
148148
return "{$path}/packages/{$package}";
149149
}, $this->app->make('config')->get('view.paths', []));
150150
}

src/Providers/ServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ abstract class ServiceProvider extends BaseServiceProvider
1818
*/
1919
protected function loadFactoriesFrom($paths)
2020
{
21-
if (\method_exists($this->app, 'runningUnitTests') && $this->app->runningUnitTests()) {
21+
if (method_exists($this->app, 'runningUnitTests') && $this->app->runningUnitTests()) {
2222
$this->callAfterResolving(EloquentFactory::class, function ($factory) use ($paths) {
2323
foreach ((array) $paths as $path) {
2424
$factory->load($path);

src/Support/Collection.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class Collection extends BaseCollection implements Csvable, Transformable
1313
*/
1414
public function toCsv(): string
1515
{
16-
\ob_start();
16+
ob_start();
1717

1818
$stream = $this->streamCsv();
19-
\fclose($stream);
19+
fclose($stream);
2020

21-
return \ob_get_clean();
21+
return ob_get_clean();
2222
}
2323

2424
/**
@@ -32,12 +32,12 @@ public function streamCsv()
3232
$enclosure = '"';
3333
$header = $this->resolveCsvHeader();
3434

35-
$stream = \fopen('php://output', 'r+');
35+
$stream = fopen('php://output', 'r+');
3636

37-
\fputcsv($stream, $header, $delimiter, $enclosure);
37+
fputcsv($stream, $header, $delimiter, $enclosure);
3838

3939
foreach ($this->items as $key => $item) {
40-
\fputcsv($stream, Arr::dot($item), $delimiter, $enclosure);
40+
fputcsv($stream, Arr::dot($item), $delimiter, $enclosure);
4141
}
4242

4343
return $stream;
@@ -54,7 +54,7 @@ protected function resolveCsvHeader(): array
5454

5555
if (! $this->isEmpty()) {
5656
$single = $this->first();
57-
$header = \array_keys(Arr::dot($single));
57+
$header = array_keys(Arr::dot($single));
5858
}
5959

6060
return $header;

src/Support/Concerns/DataContainer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function secureGet(string $key, $default = null)
7676
*/
7777
public function set(string $key, $value = null)
7878
{
79-
return Arr::set($this->items, $key, \value($value));
79+
return Arr::set($this->items, $key, value($value));
8080
}
8181

8282
/**
@@ -123,7 +123,7 @@ public function forget(string $key): bool
123123
{
124124
$items = $this->items;
125125

126-
\array_push($this->removedItems, $key);
126+
array_push($this->removedItems, $key);
127127
Arr::forget($items, $key);
128128

129129
$this->items = $items;

src/Support/Concerns/Descendible.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ protected function descendants(array $array, ?string $key = null)
2020
return $array;
2121
}
2222

23-
$keys = \explode('.', $key);
24-
$first = \array_shift($keys);
23+
$keys = explode('.', $key);
24+
$first = array_shift($keys);
2525

2626
if (! isset($array[$first])) {
2727
return null;

src/Support/Concerns/Observable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function observe($class): void
2727
$className = \get_class($class);
2828

2929
foreach ($instance->getObservableEvents() as $event) {
30-
if (\method_exists($class, $event)) {
30+
if (method_exists($class, $event)) {
3131
static::registerObservableEvent($event, "{$className}@{$event}");
3232
}
3333
}

src/Support/Concerns/Uploadable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ protected function getUploadedFilename(UploadedFile $file): string
4646
{
4747
$extension = $file->getClientOriginalExtension();
4848

49-
return \sprintf('%s.%s', Str::random(10), $extension);
49+
return sprintf('%s.%s', Str::random(10), $extension);
5050
}
5151
}

src/Support/Concerns/Validation.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final public function onValidationScenario(string $scenario, array $parameters =
3838
{
3939
[$on, $extend] = $this->getValidationSchemasName($scenario);
4040

41-
$this->validationScenarios = \compact('on', 'extend', 'parameters');
41+
$this->validationScenarios = compact('on', 'extend', 'parameters');
4242

4343
return $this;
4444
}
@@ -52,7 +52,7 @@ final public function onValidationScenario(string $scenario, array $parameters =
5252
*/
5353
final public function bindToValidation(array $bindings): self
5454
{
55-
$this->validationBindings = \array_merge($this->validationBindings, $bindings);
55+
$this->validationBindings = array_merge($this->validationBindings, $bindings);
5656

5757
return $this;
5858
}
@@ -78,7 +78,7 @@ final public function runValidation($request, array $phrases = [], $events = [])
7878

7979
[$rules, $phrases] = $this->runValidationEvents($events, $phrases);
8080

81-
return \tap(Validator::make($input, $rules, $phrases), function (ValidatorContract $validator) {
81+
return tap(Validator::make($input, $rules, $phrases), function (ValidatorContract $validator) {
8282
$this->runExtendedScenario($validator);
8383
});
8484
}
@@ -144,12 +144,12 @@ final protected function runExtendedScenario(ValidatorContract $validator): void
144144
final protected function runValidationEvents($events, array $phrases): array
145145
{
146146
// Merge all the events.
147-
$events = \array_merge($this->getValidationEvents(), Arr::wrap($events));
147+
$events = array_merge($this->getValidationEvents(), Arr::wrap($events));
148148

149149
// Convert rules array to Fluent, in order to pass it by references
150150
// in all event listening to this validation.
151151
$rules = new Fluent($this->getBindedRules());
152-
$phrases = new Fluent(\array_merge($this->getValidationPhrases(), $phrases));
152+
$phrases = new Fluent(array_merge($this->getValidationPhrases(), $phrases));
153153

154154
foreach ((array) $events as $event) {
155155
Event::dispatch($event, [&$rules, &$phrases]);
@@ -206,8 +206,8 @@ protected function getValidationSchemasName(string $scenario): array
206206
$extend = "extend{$scenario}";
207207

208208
return [
209-
\method_exists($this, $on) ? $on : null,
210-
\method_exists($this, $extend) ? $extend : null,
209+
method_exists($this, $on) ? $on : null,
210+
method_exists($this, $extend) ? $extend : null,
211211
];
212212
}
213213
}

src/Support/Keyword.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct($value)
2828
$this->value = $value;
2929

3030
if (\is_string($value)) {
31-
$this->slug = \trim(Str::slug($value, '-'));
31+
$this->slug = trim(Str::slug($value, '-'));
3232
}
3333
}
3434

@@ -78,10 +78,10 @@ public function getSlug(): ?string
7878
public function searchIn(array $items = [])
7979
{
8080
if (\is_null($slug = $this->slug)) {
81-
return \array_search($this->value, $items);
81+
return array_search($this->value, $items);
8282
}
8383

84-
return \array_search($slug, $items);
84+
return array_search($slug, $items);
8585
}
8686

8787
/**

src/Support/Manager.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function createDriver($driverName)
4545
// creator Closure to create it.
4646
if (isset($this->customCreators[$driver])) {
4747
return $this->callCustomCreator($driverName);
48-
} elseif (\method_exists($this, $method)) {
48+
} elseif (method_exists($this, $method)) {
4949
return $this->{$method}($name);
5050
}
5151

@@ -75,11 +75,11 @@ protected function callCustomCreator($driverName)
7575
*/
7676
protected function getDriverName(string $driverName): array
7777
{
78-
if (false === \strpos($driverName, '.')) {
78+
if (false === strpos($driverName, '.')) {
7979
$driverName = "{$driverName}.default";
8080
}
8181

82-
[$driver, $name] = \explode('.', $driverName, 2);
82+
[$driver, $name] = explode('.', $driverName, 2);
8383

8484
$this->checkNameIsNotBlacklisted($name);
8585

src/Support/Nesty.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function toFluent($id): Fluent
4242
$defaults = $this->config['defaults'] ?? [];
4343
$class = $this->config['fluent'] ?? Fluent::class;
4444

45-
return new $class(\array_merge($defaults, [
45+
return new $class(array_merge($defaults, [
4646
'id' => $id,
4747
'childs' => [],
4848
]));
@@ -60,8 +60,8 @@ protected function addBefore(string $id, string $before): Fluent
6060
{
6161
$items = [];
6262
$item = $this->toFluent($id);
63-
$keys = \array_keys($this->items);
64-
$position = \array_search($before, $keys);
63+
$keys = array_keys($this->items);
64+
$position = array_search($before, $keys);
6565

6666
if ($position === false) {
6767
return $this->addParent($id);
@@ -92,8 +92,8 @@ protected function addAfter(string $id, string $after): Fluent
9292
{
9393
$items = [];
9494
$item = $this->toFluent($id);
95-
$keys = \array_keys($this->items);
96-
$position = \array_search($after, $keys);
95+
$keys = array_keys($this->items);
96+
$position = array_search($after, $keys);
9797

9898
if ($position === false) {
9999
return $this->addParent($id);
@@ -161,9 +161,9 @@ protected function addParent(string $id): Fluent
161161
*/
162162
public function add(string $id, string $location = '#'): ?Fluent
163163
{
164-
if ($location === '<' && count($keys = array_keys($this->items)) > 0) {
164+
if ($location === '<' && \count($keys = array_keys($this->items)) > 0) {
165165
return $this->addBefore($id, $keys[0]);
166-
} elseif (\preg_match('/^(<|>|\^):(.+)$/', $location, $matches) && count($matches) >= 3) {
166+
} elseif (preg_match('/^(<|>|\^):(.+)$/', $location, $matches) && \count($matches) >= 3) {
167167
return $this->pickTraverseFromMatchedExpression($id, $matches[1], $matches[2]);
168168
}
169169

@@ -201,9 +201,9 @@ protected function pickTraverseFromMatchedExpression(string $id, string $key, st
201201
*/
202202
public function has(string $key): bool
203203
{
204-
$key = \implode('.childs.', \explode('.', $key));
204+
$key = implode('.childs.', explode('.', $key));
205205

206-
return ! \is_null(\data_get($this->items, $key));
206+
return ! \is_null(data_get($this->items, $key));
207207
}
208208

209209
/**

src/Support/Serializer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class Serializer
2323
*/
2424
public function __invoke(...$parameters)
2525
{
26-
if (\method_exists($this, 'serialize')) {
26+
if (method_exists($this, 'serialize')) {
2727
return $this->serialize(...$parameters);
2828
}
2929

0 commit comments

Comments
 (0)