Skip to content

Commit 2d6b251

Browse files
committed
Merge remote-tracking branch 'origin/10.x' into 10.x
# Conflicts: # CHANGELOG.md
2 parents b57e447 + a8eb983 commit 2d6b251

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+531
-183
lines changed

CHANGELOG.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
## [Unreleased](https://github.com/laravel/framework/compare/v10.1.2...10.x)
44

55

6+
### Fixed
7+
- Fixes constructable migrations ([#46223](https://github.com/laravel/framework/pull/46223))
8+
69
## [v10.1.2 (2023-02-22)](https://github.com/laravel/framework/compare/v10.1.1...v10.1.2)
710

811
### Reverted
9-
- Reverted changes in `Arr::random()` ([cf3eb90](https://github.com/laravel/framework/commit/cf3eb90a6473444bb7a78d1a3af1e9312a62020d))
12+
- Revert changes from `Arr::random()` ([cf3eb90](https://github.com/laravel/framework/commit/cf3eb90a6473444bb7a78d1a3af1e9312a62020d))
1013

1114

1215
## [v10.1.1 (2023-02-21)](https://github.com/laravel/framework/compare/v10.1.0...v10.1.1)
@@ -17,7 +20,6 @@
1720
### Fixed
1821
- Fixed `Illuminate/Collections/Arr::shuffle()` for empty array ([0c6cae0](https://github.com/laravel/framework/commit/0c6cae0ef647158b9554cad05ff39db7e7ad0d33))
1922

20-
2123
## [v10.1.0 (2023-02-21)](https://github.com/laravel/framework/compare/v10.0.3...v10.1.0)
2224

2325
### Fixed
@@ -29,18 +31,15 @@
2931
- Use mixed return type on controller stubs ([#46166](https://github.com/laravel/framework/pull/46166))
3032
- Use InteractsWithDictionary in Eloquent collection ([#46196](https://github.com/laravel/framework/pull/46196))
3133

32-
3334
## [v10.0.3 (2023-02-17)](https://github.com/laravel/framework/compare/v10.0.2...v10.0.3)
3435

3536
### Added
3637
- Added missing expression support for pluck in Builder ([#46146](https://github.com/laravel/framework/pull/46146))
3738

38-
3939
## [v10.0.2 (2023-02-16)](https://github.com/laravel/framework/compare/v10.0.1...v10.0.2)
4040

4141
### Added
42-
- Register policies automatically to the gate ([#46132](https://github.com/laravel/framework/pull/46132))
43-
42+
- Register policies automatically to the gate ([#46132](https://github.com/laravel/framework/pull/46132))
4443

4544
## [v10.0.1 (2023-02-16)](https://github.com/laravel/framework/compare/v10.0.0...v10.0.1)
4645

@@ -54,7 +53,6 @@
5453
- Add AddQueuedCookiesToResponse to middlewarePriority so it is handled in the right place ([#46130](https://github.com/laravel/framework/pull/46130))
5554
- Show queue connection in MonitorCommand ([#46122](https://github.com/laravel/framework/pull/46122))
5655

57-
5856
## [v10.0.0 (2023-02-14)](https://github.com/laravel/framework/compare/v10.0.0...10.x)
5957

6058
Please consult the [upgrade guide](https://laravel.com/docs/10.x/upgrade) and [release notes](https://laravel.com/docs/10.x/releases) in the official Laravel documentation.

src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,14 @@ protected function channelNameMatchesPattern($channel, $pattern)
373373
{
374374
return preg_match('/^'.preg_replace('/\{(.*?)\}/', '([^\.]+)', $pattern).'$/', $channel);
375375
}
376+
377+
/**
378+
* Get all of the registered channels.
379+
*
380+
* @return \Illuminate\Support\Collection
381+
*/
382+
public function getChannels()
383+
{
384+
return collect($this->channels);
385+
}
376386
}

src/Illuminate/Cache/Console/CacheTableCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class CacheTableCommand extends Command
3333

3434
/**
3535
* @var \Illuminate\Support\Composer
36+
*
37+
* @deprecated Will be removed in a future Laravel version.
3638
*/
3739
protected $composer;
3840

@@ -63,8 +65,6 @@ public function handle()
6365
$this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/cache.stub'));
6466

6567
$this->components->info('Migration created successfully.');
66-
67-
$this->composer->dumpAutoloads();
6868
}
6969

7070
/**

src/Illuminate/Collections/Arr.php

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -633,30 +633,28 @@ public static function random($array, $number = null, $preserveKeys = false)
633633
}
634634

635635
if (is_null($number)) {
636-
return head(array_slice($array, random_int(0, $count - 1), 1));
636+
return $array[array_rand($array)];
637637
}
638638

639639
if ((int) $number === 0) {
640640
return [];
641641
}
642642

643-
$keys = array_keys($array);
644-
$count = count($keys);
645-
$selected = [];
643+
$keys = array_rand($array, $number);
646644

647-
for ($i = $count - 1; $i >= $count - $number; $i--) {
648-
$j = random_int(0, $i);
645+
$results = [];
649646

650-
if ($preserveKeys) {
651-
$selected[$keys[$j]] = $array[$keys[$j]];
652-
} else {
653-
$selected[] = $array[$keys[$j]];
647+
if ($preserveKeys) {
648+
foreach ((array) $keys as $key) {
649+
$results[$key] = $array[$key];
650+
}
651+
} else {
652+
foreach ((array) $keys as $key) {
653+
$results[] = $array[$key];
654654
}
655-
656-
$keys[$j] = $keys[$i];
657655
}
658656

659-
return $selected;
657+
return $results;
660658
}
661659

662660
/**
@@ -708,29 +706,15 @@ public static function set(&$array, $key, $value)
708706
*/
709707
public static function shuffle($array, $seed = null)
710708
{
711-
if (! is_null($seed)) {
709+
if (is_null($seed)) {
710+
shuffle($array);
711+
} else {
712712
mt_srand($seed);
713713
shuffle($array);
714714
mt_srand();
715-
716-
return $array;
717-
}
718-
719-
if (empty($array)) {
720-
return [];
721-
}
722-
723-
$keys = array_keys($array);
724-
725-
for ($i = count($keys) - 1; $i > 0; $i--) {
726-
$j = random_int(0, $i);
727-
$shuffled[] = $array[$keys[$j]];
728-
$keys[$j] = $keys[$i];
729715
}
730716

731-
$shuffled[] = $array[$keys[0]];
732-
733-
return $shuffled;
717+
return $array;
734718
}
735719

736720
/**

src/Illuminate/Collections/Collection.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,16 @@ public function transform(callable $callback)
15671567
return $this;
15681568
}
15691569

1570+
/**
1571+
* Flatten a multi-dimensional associative array with dots.
1572+
*
1573+
* @return static
1574+
*/
1575+
public function dot()
1576+
{
1577+
return new static(Arr::dot($this->all()));
1578+
}
1579+
15701580
/**
15711581
* Convert a flatten "dot" notation array into an expanded array.
15721582
*

src/Illuminate/Collections/LazyCollection.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,16 @@ public function tapEach(callable $callback)
15181518
});
15191519
}
15201520

1521+
/**
1522+
* Flatten a multi-dimensional associative array with dots.
1523+
*
1524+
* @return static
1525+
*/
1526+
public function dot()
1527+
{
1528+
return $this->passthru('dot', []);
1529+
}
1530+
15211531
/**
15221532
* Convert a flatten "dot" notation array into an expanded array.
15231533
*

src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class MigrateMakeCommand extends BaseCommand implements PromptsForMissingInput
3939
* The Composer instance.
4040
*
4141
* @var \Illuminate\Support\Composer
42+
*
43+
* @deprecated Will be removed in a future Laravel version.
4244
*/
4345
protected $composer;
4446

@@ -93,8 +95,6 @@ public function handle()
9395
// the migration out, we will dump-autoload for the entire framework to
9496
// make sure that the migrations are registered by the class loaders.
9597
$this->writeMigration($name, $table, $create);
96-
97-
$this->composer->dumpAutoloads();
9898
}
9999

100100
/**

src/Illuminate/Database/Migrations/Migrator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,9 @@ protected function resolvePath(string $path)
525525
$migration = static::$requiredPathCache[$path] ??= $this->files->getRequire($path);
526526

527527
if (is_object($migration)) {
528-
return clone $migration;
528+
return method_exists($migration, '__construct')
529+
? $this->files->getRequire($path)
530+
: clone $migration;
529531
}
530532

531533
return new $class;

0 commit comments

Comments
 (0)