Skip to content

Commit 95dcf0d

Browse files
Merge branch '9.x'
2 parents be9706a + 0667a88 commit 95dcf0d

19 files changed

+273
-46
lines changed

src/Illuminate/Console/Application.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ protected function addToParent(SymfonyCommand $command)
262262
/**
263263
* Add a command, resolving through the application.
264264
*
265-
* @param string $command
265+
* @param \Illuminate\Console\Command|string $command
266266
* @return \Symfony\Component\Console\Command\Command|null
267267
*/
268268
public function resolve($command)
@@ -273,6 +273,10 @@ public function resolve($command)
273273
return null;
274274
}
275275

276+
if ($command instanceof Command) {
277+
return $this->add($command);
278+
}
279+
276280
return $this->add($this->laravel->make($command));
277281
}
278282

src/Illuminate/Container/Container.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,10 @@ protected function resolvePrimitive(ReflectionParameter $parameter)
10061006
return $parameter->getDefaultValue();
10071007
}
10081008

1009+
if ($parameter->isVariadic()) {
1010+
return [];
1011+
}
1012+
10091013
$this->unresolvablePrimitive($parameter);
10101014
}
10111015

src/Illuminate/Filesystem/AwsS3V3Adapter.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ public function url($path)
5656
);
5757
}
5858

59+
/**
60+
* Determine if temporary URLs can be generated.
61+
*
62+
* @return bool
63+
*/
64+
public function providesTemporaryUrls()
65+
{
66+
return true;
67+
}
68+
5969
/**
6070
* Get a temporary URL for the file at the given path.
6171
*

src/Illuminate/Foundation/Console/ObserverMakeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected function getDefaultNamespace($rootNamespace)
135135
protected function getOptions()
136136
{
137137
return [
138-
['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the observer applies to.'],
138+
['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the observer applies to'],
139139
];
140140
}
141141
}

src/Illuminate/Foundation/Console/RuleMakeCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ protected function getDefaultNamespace($rootNamespace)
8282
protected function getOptions()
8383
{
8484
return [
85-
['implicit', 'i', InputOption::VALUE_NONE, 'Generate an implicit rule.'],
85+
['implicit', 'i', InputOption::VALUE_NONE, 'Generate an implicit rule'],
86+
['invokable', null, InputOption::VALUE_NONE, 'Generate a single method, invokable rule class'],
8687
];
8788
}
8889
}

src/Illuminate/Foundation/Console/TestMakeCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ protected function rootNamespace()
104104
protected function getOptions()
105105
{
106106
return [
107-
['unit', 'u', InputOption::VALUE_NONE, 'Create a unit test.'],
108-
['pest', 'p', InputOption::VALUE_NONE, 'Create a Pest test.'],
107+
['unit', 'u', InputOption::VALUE_NONE, 'Create a unit test'],
108+
['pest', 'p', InputOption::VALUE_NONE, 'Create a Pest test'],
109109
];
110110
}
111111
}

src/Illuminate/Foundation/Vite.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,19 @@ public function __invoke($entrypoints, $buildDirectory = null)
213213
foreach ($entrypoints as $entrypoint) {
214214
$chunk = $this->chunk($manifest, $entrypoint);
215215

216+
foreach ($chunk['imports'] ?? [] as $import) {
217+
foreach ($manifest[$import]['css'] ?? [] as $css) {
218+
$partialManifest = Collection::make($manifest)->where('file', $css);
219+
220+
$tags->push($this->makeTagForChunk(
221+
$partialManifest->keys()->first(),
222+
asset("{$buildDirectory}/{$css}"),
223+
$partialManifest->first(),
224+
$manifest
225+
));
226+
}
227+
}
228+
216229
$tags->push($this->makeTagForChunk(
217230
$entrypoint,
218231
asset("{$buildDirectory}/{$chunk['file']}"),
@@ -230,19 +243,6 @@ public function __invoke($entrypoints, $buildDirectory = null)
230243
$manifest
231244
));
232245
}
233-
234-
foreach ($chunk['imports'] ?? [] as $import) {
235-
foreach ($manifest[$import]['css'] ?? [] as $css) {
236-
$partialManifest = Collection::make($manifest)->where('file', $css);
237-
238-
$tags->push($this->makeTagForChunk(
239-
$partialManifest->keys()->first(),
240-
asset("{$buildDirectory}/{$css}"),
241-
$partialManifest->first(),
242-
$manifest
243-
));
244-
}
245-
}
246246
}
247247

248248
[$stylesheets, $scripts] = $tags->partition(fn ($tag) => str_starts_with($tag, '<link'));

src/Illuminate/Routing/Console/ControllerMakeCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,14 @@ protected function generateFormRequests($modelClass, $storeRequestClass, $update
266266
protected function getOptions()
267267
{
268268
return [
269-
['api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller.'],
270-
['type', null, InputOption::VALUE_REQUIRED, 'Manually specify the controller stub file to use.'],
269+
['api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller'],
270+
['type', null, InputOption::VALUE_REQUIRED, 'Manually specify the controller stub file to use'],
271271
['force', null, InputOption::VALUE_NONE, 'Create the class even if the controller already exists'],
272-
['invokable', 'i', InputOption::VALUE_NONE, 'Generate a single method, invokable controller class.'],
273-
['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model.'],
274-
['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class.'],
275-
['resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class.'],
276-
['requests', 'R', InputOption::VALUE_NONE, 'Generate FormRequest classes for store and update.'],
272+
['invokable', 'i', InputOption::VALUE_NONE, 'Generate a single method, invokable controller class'],
273+
['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model'],
274+
['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class'],
275+
['resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class'],
276+
['requests', 'R', InputOption::VALUE_NONE, 'Generate FormRequest classes for store and update'],
277277
];
278278
}
279279
}

src/Illuminate/Routing/RouteGroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ protected static function formatPrefix($new, $old, $prependExistingPrefix = true
6666
$old = $old['prefix'] ?? '';
6767

6868
if ($prependExistingPrefix) {
69-
return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old;
69+
return trim(isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old, '/');
7070
} else {
71-
return isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old;
71+
return trim(isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old, '/');
7272
}
7373
}
7474

src/Illuminate/Support/Str.php

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,16 @@ public static function camel($value)
218218
* Determine if a given string contains a given substring.
219219
*
220220
* @param string $haystack
221-
* @param string|string[] $needles
221+
* @param string|string[]|Enumerable<array-key, string> $needles
222222
* @param bool $ignoreCase
223223
* @return bool
224224
*/
225225
public static function contains($haystack, $needles, $ignoreCase = false)
226226
{
227+
if ($needles instanceof Enumerable) {
228+
$needles = $needles->toArray();
229+
}
230+
227231
if ($ignoreCase) {
228232
$haystack = mb_strtolower($haystack);
229233
$needles = array_map('mb_strtolower', (array) $needles);
@@ -242,12 +246,16 @@ public static function contains($haystack, $needles, $ignoreCase = false)
242246
* Determine if a given string contains all array values.
243247
*
244248
* @param string $haystack
245-
* @param string[] $needles
249+
* @param string[]|Enumerable<array-key, string> $needles
246250
* @param bool $ignoreCase
247251
* @return bool
248252
*/
249-
public static function containsAll($haystack, array $needles, $ignoreCase = false)
253+
public static function containsAll($haystack, $needles, $ignoreCase = false)
250254
{
255+
if ($needles instanceof Enumerable) {
256+
$needles = $needles->toArray();
257+
}
258+
251259
if ($ignoreCase) {
252260
$haystack = mb_strtolower($haystack);
253261
$needles = array_map('mb_strtolower', $needles);
@@ -266,7 +274,7 @@ public static function containsAll($haystack, array $needles, $ignoreCase = fals
266274
* Determine if a given string ends with a given substring.
267275
*
268276
* @param string $haystack
269-
* @param string|string[] $needles
277+
* @param string|string[]|Enumerable<array-key, string> $needles
270278
* @return bool
271279
*/
272280
public static function endsWith($haystack, $needles)
@@ -781,12 +789,16 @@ public static function repeat(string $string, int $times)
781789
* Replace a given value in the string sequentially with an array.
782790
*
783791
* @param string $search
784-
* @param array<int|string, string> $replace
792+
* @param string[]|Enumerable<array-key, string> $replace
785793
* @param string $subject
786794
* @return string
787795
*/
788-
public static function replaceArray($search, array $replace, $subject)
796+
public static function replaceArray($search, $replace, $subject)
789797
{
798+
if ($replace instanceof Enumerable) {
799+
$replace = $replace->toArray();
800+
}
801+
790802
$segments = explode($search, $subject);
791803

792804
$result = array_shift($segments);
@@ -801,13 +813,25 @@ public static function replaceArray($search, array $replace, $subject)
801813
/**
802814
* Replace the given value in the given string.
803815
*
804-
* @param string|string[] $search
805-
* @param string|string[] $replace
806-
* @param string|string[] $subject
816+
* @param string|string[]|Enumerable<array-key, string> $search
817+
* @param string|string[]|Enumerable<array-key, string> $replace
818+
* @param string|string[]|Enumerable<array-key, string> $subject
807819
* @return string
808820
*/
809821
public static function replace($search, $replace, $subject)
810822
{
823+
if ($search instanceof Enumerable) {
824+
$search = $search->toArray();
825+
}
826+
827+
if ($replace instanceof Enumerable) {
828+
$replace = $replace->toArray();
829+
}
830+
831+
if ($subject instanceof Enumerable) {
832+
$subject = $subject->toArray();
833+
}
834+
811835
return str_replace($search, $replace, $subject);
812836
}
813837

@@ -862,13 +886,17 @@ public static function replaceLast($search, $replace, $subject)
862886
/**
863887
* Remove any occurrence of the given string in the subject.
864888
*
865-
* @param string|array<string> $search
889+
* @param string|string[]|Enumerable<array-key, string> $search
866890
* @param string $subject
867891
* @param bool $caseSensitive
868892
* @return string
869893
*/
870894
public static function remove($search, $subject, $caseSensitive = true)
871895
{
896+
if ($search instanceof Enumerable) {
897+
$search = $search->toArray();
898+
}
899+
872900
$subject = $caseSensitive
873901
? str_replace($search, '', $subject)
874902
: str_ireplace($search, '', $subject);
@@ -1021,7 +1049,7 @@ public static function squish($value)
10211049
* Determine if a given string starts with a given substring.
10221050
*
10231051
* @param string $haystack
1024-
* @param string|string[] $needles
1052+
* @param string|string[]|Enumerable<array-key, string> $needles
10251053
* @return bool
10261054
*/
10271055
public static function startsWith($haystack, $needles)
@@ -1257,9 +1285,11 @@ public static function freezeUuids(Closure $callback = null)
12571285
Str::createUuidsUsing(fn () => $uuid);
12581286

12591287
if ($callback !== null) {
1260-
$callback($uuid);
1261-
1262-
Str::createUuidsNormally();
1288+
try {
1289+
$callback($uuid);
1290+
} finally {
1291+
Str::createUuidsNormally();
1292+
}
12631293
}
12641294

12651295
return $uuid;

0 commit comments

Comments
 (0)