From d2092774c80c632bdc98853dfbad16743cc898e4 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Tue, 29 Dec 2020 16:07:22 +0100 Subject: [PATCH 01/19] Update DetectsLostConnections.php (#35744) (#35752) AWS Aurora serverless DB sometimes aborts queries while performing scaling. The error returned is: "SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry." Co-authored-by: Sab --- src/Illuminate/Database/DetectsLostConnections.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Illuminate/Database/DetectsLostConnections.php b/src/Illuminate/Database/DetectsLostConnections.php index 36b46099983f..6ba3c4939faa 100644 --- a/src/Illuminate/Database/DetectsLostConnections.php +++ b/src/Illuminate/Database/DetectsLostConnections.php @@ -45,6 +45,9 @@ protected function causedByLostConnection(Throwable $e) 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again', 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected', + 'SQLSTATE[HY000] [2002] Connection timed out', + 'SSL: Connection timed out', + 'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.', ]); } } From 4686f22eaaddca3fd71f99290e833413cfcf8f4c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 5 Jan 2021 09:42:30 -0600 Subject: [PATCH 02/19] version --- src/Illuminate/Foundation/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 82860b6f7eb7..140615a3ce68 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -31,7 +31,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn * * @var string */ - const VERSION = '6.20.8'; + const VERSION = '6.20.9'; /** * The base path for the Laravel installation. From 1fa20dd356af21af6e38d95e9ff2b1d444344fbe Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 5 Jan 2021 10:41:31 -0600 Subject: [PATCH 03/19] update conventions --- src/Illuminate/Http/Resources/CollectsResources.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Resources/CollectsResources.php b/src/Illuminate/Http/Resources/CollectsResources.php index a5531f7a02ce..5c42da4225f5 100644 --- a/src/Illuminate/Http/Resources/CollectsResources.php +++ b/src/Illuminate/Http/Resources/CollectsResources.php @@ -47,7 +47,8 @@ protected function collects() } if (Str::endsWith(class_basename($this), 'Collection') && - class_exists($class = Str::replaceLast('Collection', '', get_class($this)))) { + (class_exists($class = Str::replaceLast('Collection', '', get_class($this))) || + class_exists($class = Str::replaceLast('Collection', 'Resource', get_class($this))))) { return $class; } } From 74f1bdcd40000f8acf5e0b10f12370d50c5fea47 Mon Sep 17 00:00:00 2001 From: Ahmad Shakib Date: Tue, 5 Jan 2021 22:59:11 +0330 Subject: [PATCH 04/19] add array to URL action method argument (#35787) --- src/Illuminate/Support/Facades/URL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Support/Facades/URL.php b/src/Illuminate/Support/Facades/URL.php index 9e11006d8697..05866345fea5 100755 --- a/src/Illuminate/Support/Facades/URL.php +++ b/src/Illuminate/Support/Facades/URL.php @@ -5,7 +5,7 @@ /** * @method static \Illuminate\Contracts\Routing\UrlGenerator setRootControllerNamespace(string $rootNamespace) * @method static bool hasValidSignature(\Illuminate\Http\Request $request, bool $absolute = true) - * @method static string action(string $action, $parameters = [], bool $absolute = true) + * @method static string action(string|array $action, $parameters = [], bool $absolute = true) * @method static string asset(string $path, bool $secure = null) * @method static string secureAsset(string $path) * @method static string current() From 006180a54d917de4420c1aeddb7c0251d0189651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Aur=C3=A9lio=20Deleu?= Date: Tue, 5 Jan 2021 19:50:42 -0300 Subject: [PATCH 05/19] Retry if DNS lookup fails (#35790) --- src/Illuminate/Database/DetectsLostConnections.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Database/DetectsLostConnections.php b/src/Illuminate/Database/DetectsLostConnections.php index 6ba3c4939faa..07630c590d5c 100644 --- a/src/Illuminate/Database/DetectsLostConnections.php +++ b/src/Illuminate/Database/DetectsLostConnections.php @@ -44,6 +44,7 @@ protected function causedByLostConnection(Throwable $e) 'running with the --read-only option so it cannot execute this statement', 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again', + 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known', 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected', 'SQLSTATE[HY000] [2002] Connection timed out', 'SSL: Connection timed out', From 08b1b19ce0581d49d15321bdc1194aab1cb1b4b2 Mon Sep 17 00:00:00 2001 From: Joren Dandois Date: Wed, 6 Jan 2021 14:35:15 +0100 Subject: [PATCH 06/19] [6.x] Fix #35795 (#35797) Add an extra is_null check for php 8 --- src/Illuminate/Validation/Concerns/ValidatesAttributes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index d62ec0ee9513..84e0964ba147 100644 --- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -1164,7 +1164,7 @@ public function validateJson($attribute, $value) return false; } - if (! is_scalar($value) && ! method_exists($value, '__toString')) { + if (! is_scalar($value) && ! is_null($value) && ! method_exists($value, '__toString')) { return false; } From 6e563129f679ea0a6fbcb2747e3be77bab3bff1c Mon Sep 17 00:00:00 2001 From: Adnan RIHAN Date: Wed, 6 Jan 2021 14:44:49 +0100 Subject: [PATCH 07/19] [8.x] "null" constraint prevents aliasing SQLite ROWID (#35792) * "null" constraint prevents aliasing SQLite ROWID * Changed tests accordingly --- .../Database/Schema/Grammars/SQLiteGrammar.php | 2 +- tests/Database/DatabaseSQLiteSchemaGrammarTest.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index 5075c0504204..556d749e23b2 100755 --- a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -875,7 +875,7 @@ protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) protected function modifyNullable(Blueprint $blueprint, Fluent $column) { if (is_null($column->virtualAs) && is_null($column->storedAs)) { - return $column->nullable ? ' null' : ' not null'; + return $column->nullable ? '' : ' not null'; } if ($column->nullable === false) { diff --git a/tests/Database/DatabaseSQLiteSchemaGrammarTest.php b/tests/Database/DatabaseSQLiteSchemaGrammarTest.php index 41e53cc725e7..226c58bf2b34 100755 --- a/tests/Database/DatabaseSQLiteSchemaGrammarTest.php +++ b/tests/Database/DatabaseSQLiteSchemaGrammarTest.php @@ -361,7 +361,7 @@ public function testAddingString() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(1, $statements); - $this->assertSame('alter table "users" add column "foo" varchar null default \'bar\'', $statements[0]); + $this->assertSame('alter table "users" add column "foo" varchar default \'bar\'', $statements[0]); } public function testAddingText() @@ -663,8 +663,8 @@ public function testAddingTimestamps() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(2, $statements); $this->assertEquals([ - 'alter table "users" add column "created_at" datetime null', - 'alter table "users" add column "updated_at" datetime null', + 'alter table "users" add column "created_at" datetime', + 'alter table "users" add column "updated_at" datetime', ], $statements); } @@ -675,8 +675,8 @@ public function testAddingTimestampsTz() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(2, $statements); $this->assertEquals([ - 'alter table "users" add column "created_at" datetime null', - 'alter table "users" add column "updated_at" datetime null', + 'alter table "users" add column "created_at" datetime', + 'alter table "users" add column "updated_at" datetime', ], $statements); } @@ -687,7 +687,7 @@ public function testAddingRememberToken() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(1, $statements); - $this->assertSame('alter table "users" add column "remember_token" varchar null', $statements[0]); + $this->assertSame('alter table "users" add column "remember_token" varchar', $statements[0]); } public function testAddingBinary() From 101121830deaf4a8f1ff7e03b8dcbe56f15be2a9 Mon Sep 17 00:00:00 2001 From: Freek Van der Herten Date: Wed, 6 Jan 2021 20:19:55 +0100 Subject: [PATCH 08/19] wip (#35803) --- src/Illuminate/Foundation/helpers.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index d6af860d8915..2c1540f18e37 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -586,11 +586,15 @@ function redirect($to = null, $status = 302, $headers = [], $secure = null) /** * Report an exception. * - * @param \Throwable $exception + * @param \Throwable|string $exception * @return void */ - function report(Throwable $exception) + function report($exception) { + if (is_string($exception)) { + $exception = new Exception($exception); + } + app(ExceptionHandler::class)->report($exception); } } From 7a0517e43d11d945bee7912dcc03ad4573cdece2 Mon Sep 17 00:00:00 2001 From: Tetiana Blindaruk Date: Wed, 6 Jan 2021 22:36:47 +0200 Subject: [PATCH 09/19] [6.x] update changelog --- CHANGELOG-6.x.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-6.x.md b/CHANGELOG-6.x.md index 078fe3776c23..d92867e61bf9 100644 --- a/CHANGELOG-6.x.md +++ b/CHANGELOG-6.x.md @@ -1,6 +1,12 @@ # Release Notes for 6.x -## [Unreleased](https://github.com/laravel/framework/compare/v6.20.8...6.x) +## [Unreleased](https://github.com/laravel/framework/compare/v6.20.9...6.x) + + +## [v6.20.9 (2021-01-05)](https://github.com/laravel/framework/compare/v6.20.8...v6.20.9) + +### Added +- [Updated Illuminate\Database\DetectsLostConnections with new strings](https://github.com/laravel/framework/compare/v6.20.8...v6.20.9) ## [v6.20.8 (2020-12-22)](https://github.com/laravel/framework/compare/v6.20.7...v6.20.8) From 930e7f6f716f5e7c1e087d29c63abb2b76b3f500 Mon Sep 17 00:00:00 2001 From: Tetiana Blindaruk Date: Wed, 6 Jan 2021 23:05:39 +0200 Subject: [PATCH 10/19] [8.x] update changelog --- CHANGELOG-6.x.md | 8 +++++++- CHANGELOG-8.x.md | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-6.x.md b/CHANGELOG-6.x.md index 078fe3776c23..d92867e61bf9 100644 --- a/CHANGELOG-6.x.md +++ b/CHANGELOG-6.x.md @@ -1,6 +1,12 @@ # Release Notes for 6.x -## [Unreleased](https://github.com/laravel/framework/compare/v6.20.8...6.x) +## [Unreleased](https://github.com/laravel/framework/compare/v6.20.9...6.x) + + +## [v6.20.9 (2021-01-05)](https://github.com/laravel/framework/compare/v6.20.8...v6.20.9) + +### Added +- [Updated Illuminate\Database\DetectsLostConnections with new strings](https://github.com/laravel/framework/compare/v6.20.8...v6.20.9) ## [v6.20.8 (2020-12-22)](https://github.com/laravel/framework/compare/v6.20.7...v6.20.8) diff --git a/CHANGELOG-8.x.md b/CHANGELOG-8.x.md index c0499d7f01e5..1f35a3bc3813 100644 --- a/CHANGELOG-8.x.md +++ b/CHANGELOG-8.x.md @@ -1,6 +1,26 @@ # Release Notes for 8.x -## [Unreleased](https://github.com/laravel/framework/compare/v8.20.1...8.x) +## [Unreleased](https://github.com/laravel/framework/compare/v8.21.0...8.x) + + +## [v8.21.0 (2021-01-05)](https://github.com/laravel/framework/compare/v8.20.1...v8.21.0) + +### Added +- Added command to clean batches table ([#35694](https://github.com/laravel/framework/pull/35694), [33f5ac6](https://github.com/laravel/framework/commit/33f5ac695a55d6cdbadcfe1b46e3409e4a66df16)) +- Added item to list of causedByLostConnection errors ([#35744](https://github.com/laravel/framework/pull/35744)) +- Make it possible to set Postmark Message Stream ID ([#35755](https://github.com/laravel/framework/pull/35755)) + +### Fixed +- Fixed `php artisan db` command for the Postgres CLI ([#35725](https://github.com/laravel/framework/pull/35725)) +- Fixed OPTIONS method bug with use same path and diff domain when cache route ([#35714](https://github.com/laravel/framework/pull/35714)) + +### Changed +- Ensure DBAL custom type doesn't exists in `Illuminate\Database\DatabaseServiceProvider::registerDoctrineTypes()` ([#35704](https://github.com/laravel/framework/pull/35704)) +- Added missing `dispatchAfterCommit` to `DatabaseQueue` ([#35715](https://github.com/laravel/framework/pull/35715)) +- Set chain queue when inside a batch ([#35746](https://github.com/laravel/framework/pull/35746)) +- Give a more meaningul message when route parameters are missing ([#35706](https://github.com/laravel/framework/pull/35706)) +- Added table prefix to `Illuminate\Database\Console\DumpCommand::schemaState()` ([4ffe40f](https://github.com/laravel/framework/commit/4ffe40fb169c6bcce9193ff56958eca41e64294f)) +- Refresh the retryUntil time on job retry ([#35780](https://github.com/laravel/framework/pull/35780), [45eb7a7](https://github.com/laravel/framework/commit/45eb7a7b1706ae175268731a673f369c0e556805)) ## [v8.20.1 (2020-12-22)](https://github.com/laravel/framework/compare/v8.20.0...v8.20.1) From 524b1b3b4d677285ae2148d5a3b10774c696f8d8 Mon Sep 17 00:00:00 2001 From: Jesse Kramer Date: Thu, 7 Jan 2021 14:53:36 +0100 Subject: [PATCH 11/19] The request helper might return null, update docblock to reflect this. (#35812) --- src/Illuminate/Foundation/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 2c1540f18e37..3842915bf721 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -605,7 +605,7 @@ function report($exception) * * @param array|string|null $key * @param mixed $default - * @return \Illuminate\Http\Request|string|array + * @return \Illuminate\Http\Request|string|array|null */ function request($key = null, $default = null) { From 4415b94623358bfd1dc2e8f20e4deab0025d2d03 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 7 Jan 2021 08:08:57 -0600 Subject: [PATCH 12/19] fix breaking change --- src/Illuminate/Queue/Console/RetryCommand.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Queue/Console/RetryCommand.php b/src/Illuminate/Queue/Console/RetryCommand.php index fe6248800c99..545f8489b8ae 100644 --- a/src/Illuminate/Queue/Console/RetryCommand.php +++ b/src/Illuminate/Queue/Console/RetryCommand.php @@ -126,6 +126,10 @@ protected function refreshRetryUntil($payload) { $payload = json_decode($payload, true); + if (! isset($payload['data']['command'])) { + return json_encode($payload); + } + $instance = unserialize($payload['data']['command']); if (is_object($instance) && method_exists($instance, 'retryUntil')) { From b3ebb1b01c8ce9d7ab931882105cf6aedd3e8242 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 7 Jan 2021 17:57:53 +0100 Subject: [PATCH 13/19] Fix expectsTable call (#35820) --- src/Illuminate/Testing/PendingCommand.php | 58 +++++++---------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/src/Illuminate/Testing/PendingCommand.php b/src/Illuminate/Testing/PendingCommand.php index 55ea307c82f3..3e08c53ccee7 100644 --- a/src/Illuminate/Testing/PendingCommand.php +++ b/src/Illuminate/Testing/PendingCommand.php @@ -157,12 +157,24 @@ public function doesntExpectOutput($output) */ public function expectsTable($headers, $rows, $tableStyle = 'default', array $columnStyles = []) { - $this->test->expectedTables[] = [ - 'headers' => (array) $headers, - 'rows' => $rows instanceof Arrayable ? $rows->toArray() : $rows, - 'tableStyle' => $tableStyle, - 'columnStyles' => $columnStyles, - ]; + $table = (new Table($output = new BufferedOutput)) + ->setHeaders((array) $headers) + ->setRows($rows instanceof Arrayable ? $rows->toArray() : $rows) + ->setStyle($tableStyle); + + foreach ($columnStyles as $columnIndex => $columnStyle) { + $table->setColumnStyle($columnIndex, $columnStyle); + } + + $table->render(); + + $lines = array_filter( + explode(PHP_EOL, $output->fetch()) + ); + + foreach ($lines as $line) { + $this->expectsOutput($line); + } return $this; } @@ -305,8 +317,6 @@ private function createABufferedOutputMock() ->shouldAllowMockingProtectedMethods() ->shouldIgnoreMissing(); - $this->applyTableOutputExpectations($mock); - foreach ($this->test->expectedOutput as $i => $output) { $mock->shouldReceive('doWrite') ->once() @@ -330,38 +340,6 @@ private function createABufferedOutputMock() return $mock; } - /** - * Apply the output table expectations to the mock. - * - * @param \Mockery\MockInterface $mock - * @return void - */ - private function applyTableOutputExpectations($mock) - { - foreach ($this->test->expectedTables as $i => $consoleTable) { - $table = (new Table($output = new BufferedOutput)) - ->setHeaders($consoleTable['headers']) - ->setRows($consoleTable['rows']) - ->setStyle($consoleTable['tableStyle']); - - foreach ($consoleTable['columnStyles'] as $columnIndex => $columnStyle) { - $table->setColumnStyle($columnIndex, $columnStyle); - } - - $table->render(); - - $lines = array_filter( - explode(PHP_EOL, $output->fetch()) - ); - - foreach ($lines as $line) { - $this->expectsOutput($line); - } - - unset($this->test->expectedTables[$i]); - } - } - /** * Flush the expectations from the test case. * From bd7aaa8ff0c37907ac66fcccfebc7d6e25a7402c Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 8 Jan 2021 15:07:38 +0100 Subject: [PATCH 14/19] Fix bug with RetryCommand (#35828) --- src/Illuminate/Queue/Console/RetryCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Console/RetryCommand.php b/src/Illuminate/Queue/Console/RetryCommand.php index 545f8489b8ae..ad090f6fa5d0 100644 --- a/src/Illuminate/Queue/Console/RetryCommand.php +++ b/src/Illuminate/Queue/Console/RetryCommand.php @@ -2,6 +2,7 @@ namespace Illuminate\Queue\Console; +use DateTimeInterface; use Illuminate\Console\Command; use Illuminate\Support\Arr; @@ -133,7 +134,11 @@ protected function refreshRetryUntil($payload) $instance = unserialize($payload['data']['command']); if (is_object($instance) && method_exists($instance, 'retryUntil')) { - $payload['retryUntil'] = $instance->retryUntil()->timestamp; + $retryUntil = $instance->retryUntil(); + + $payload['retryUntil'] = $retryUntil instanceof DateTimeInterface + ? $retryUntil->getTimestamp() + : $retryUntil; } return json_encode($payload); From 74bb56ad68737ee76b11e21bc51c192149a63e43 Mon Sep 17 00:00:00 2001 From: Rhys Emmerson Date: Sat, 9 Jan 2021 02:21:58 +1000 Subject: [PATCH 15/19] do not map empty string in morph type to instance (#35824) Co-authored-by: Rhys --- .../Database/Eloquent/Concerns/HasRelationships.php | 2 +- tests/Database/DatabaseEloquentMorphToTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php b/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php index 9ee9e3d124e3..5262d4305273 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php @@ -256,7 +256,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null // If the type value is null it is probably safe to assume we're eager loading // the relationship. In this case we'll just pass in a dummy query where we // need to remove any eager loads that may already be defined on a model. - return is_null($class = $this->getAttributeFromArray($type)) + return is_null($class = $this->getAttributeFromArray($type)) || $class === '' ? $this->morphEagerTo($name, $type, $id, $ownerKey) : $this->morphInstanceTo($class, $name, $type, $id, $ownerKey); } diff --git a/tests/Database/DatabaseEloquentMorphToTest.php b/tests/Database/DatabaseEloquentMorphToTest.php index 172a2aa84d1d..a6bd248ff563 100644 --- a/tests/Database/DatabaseEloquentMorphToTest.php +++ b/tests/Database/DatabaseEloquentMorphToTest.php @@ -100,6 +100,16 @@ public function testMorphToWithZeroMorphType() $parent->relation(); } + public function testMorphToWithEmptyStringMorphType() + { + $parent = $this->getMockBuilder(EloquentMorphToModelStub::class)->onlyMethods(['getAttributeFromArray', 'morphEagerTo', 'morphInstanceTo'])->getMock(); + $parent->method('getAttributeFromArray')->with('relation_type')->willReturn(''); + $parent->expects($this->once())->method('morphEagerTo'); + $parent->expects($this->never())->method('morphInstanceTo'); + + $parent->relation(); + } + public function testMorphToWithSpecifiedClassDefault() { $parent = new EloquentMorphToModelStub; From e8ba1d80ba95c7bc1fb9884808662939c03db43e Mon Sep 17 00:00:00 2001 From: Krayvok <76506910+Krayvok@users.noreply.github.com> Date: Mon, 11 Jan 2021 06:46:02 -0800 Subject: [PATCH 16/19] Update Session.php (#35838) Add method tag for flash(). --- src/Illuminate/Support/Facades/Session.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Support/Facades/Session.php b/src/Illuminate/Support/Facades/Session.php index 70e42e20ef16..12a4547a1fbb 100755 --- a/src/Illuminate/Support/Facades/Session.php +++ b/src/Illuminate/Support/Facades/Session.php @@ -13,6 +13,7 @@ * @method static bool save() * @method static bool start() * @method static mixed get(string $key, $default = null) + * @method static mixed flash(string $class, string $message) * @method static mixed pull(string $key, $default = null) * @method static mixed remove(string $key) * @method static string getId() From 374e9565b2718c549f329af5c137e84a7d753a28 Mon Sep 17 00:00:00 2001 From: Theraloss Date: Mon, 11 Jan 2021 15:57:10 +0100 Subject: [PATCH 17/19] [8.x] Add ::assertNothingDispatched() to Events::fake (#35835) * Add ::assertNothingDispatched() to events fake * Update EventFake.php * Update SupportTestingEventFakeTest.php Co-authored-by: Taylor Otwell --- .../Support/Testing/Fakes/EventFake.php | 15 +++++++++++++++ tests/Support/SupportTestingEventFakeTest.php | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/Illuminate/Support/Testing/Fakes/EventFake.php b/src/Illuminate/Support/Testing/Fakes/EventFake.php index 84f67482ebe3..90f30212ef7b 100644 --- a/src/Illuminate/Support/Testing/Fakes/EventFake.php +++ b/src/Illuminate/Support/Testing/Fakes/EventFake.php @@ -106,6 +106,21 @@ public function assertNotDispatched($event, $callback = null) ); } + /** + * Assert that no events were dispatched. + * + * @return void + */ + public function assertNothingDispatched() + { + $count = count(Arr::flatten($this->events)); + + PHPUnit::assertSame( + 0, $count, + "{$count} unexpected events were dispatched." + ); + } + /** * Get all of the events matching a truth-test callback. * diff --git a/tests/Support/SupportTestingEventFakeTest.php b/tests/Support/SupportTestingEventFakeTest.php index 3a9ccc6cdd3b..d51562d10c58 100644 --- a/tests/Support/SupportTestingEventFakeTest.php +++ b/tests/Support/SupportTestingEventFakeTest.php @@ -118,6 +118,21 @@ function ($event, $payload) { $fake->assertDispatched('Bar'); $fake->assertNotDispatched('Baz'); } + + public function testAssertNothingDispatched() + { + $this->fake->assertNothingDispatched(); + + $this->fake->dispatch(EventStub::class); + $this->fake->dispatch(EventStub::class); + + try { + $this->fake->assertNothingDispatched(); + $this->fail(); + } catch (ExpectationFailedException $e) { + $this->assertThat($e, new ExceptionMessage('2 unexpected events were dispatched.')); + } + } } class EventStub From 08dbb8bea12104974ba86337bd37e0471254f39b Mon Sep 17 00:00:00 2001 From: Mo Khosh Date: Tue, 12 Jan 2021 18:51:34 +0330 Subject: [PATCH 18/19] [8.x] Add reduce with keys to collections and lazy collections (#35839) * add reduce with keys to collections * add reduce with keys to lazy collections * add test for reduce with keys * fix style --- src/Illuminate/Collections/Collection.php | 18 ++++++++++++++++++ src/Illuminate/Collections/LazyCollection.php | 18 ++++++++++++++++++ tests/Support/SupportCollectionTest.php | 14 ++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/src/Illuminate/Collections/Collection.php b/src/Illuminate/Collections/Collection.php index f4c7b4007a91..6a8ab88818aa 100644 --- a/src/Illuminate/Collections/Collection.php +++ b/src/Illuminate/Collections/Collection.php @@ -884,6 +884,24 @@ public function reduce(callable $callback, $initial = null) return array_reduce($this->items, $callback, $initial); } + /** + * Reduce an associative collection to a single value. + * + * @param callable $callback + * @param mixed $initial + * @return mixed + */ + public function reduceWithKeys(callable $callback, $initial = null) + { + $result = $initial; + + foreach ($this->items as $key => $value) { + $result = $callback($result, $value, $key); + } + + return $result; + } + /** * Replace the collection items with the given items. * diff --git a/src/Illuminate/Collections/LazyCollection.php b/src/Illuminate/Collections/LazyCollection.php index 2384948f951a..ca51626b071e 100644 --- a/src/Illuminate/Collections/LazyCollection.php +++ b/src/Illuminate/Collections/LazyCollection.php @@ -845,6 +845,24 @@ public function reduce(callable $callback, $initial = null) return $result; } + /** + * Reduce an associative collection to a single value. + * + * @param callable $callback + * @param mixed $initial + * @return mixed + */ + public function reduceWithKeys(callable $callback, $initial = null) + { + $result = $initial; + + foreach ($this as $key => $value) { + $result = $callback($result, $value, $key); + } + + return $result; + } + /** * Replace the collection items with the given items. * diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 6faf65a1a3c2..b622884fe6c1 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -3592,6 +3592,20 @@ public function testReduce($collection) })); } + /** + * @dataProvider collectionClassProvider + */ + public function testReduceWithKeys($collection) + { + $data = new $collection([ + 'foo' => 'bar', + 'baz' => 'qux', + ]); + $this->assertEquals('foobarbazqux', $data->reduceWithKeys(function ($carry, $element, $key) { + return $carry .= $key.$element; + })); + } + /** * @dataProvider collectionClassProvider */ From 88dced8fc1016411ca159fc04651baf270aa54e5 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 12 Jan 2021 09:30:21 -0600 Subject: [PATCH 19/19] version --- src/Illuminate/Foundation/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 140615a3ce68..ae6e70351474 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -31,7 +31,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn * * @var string */ - const VERSION = '6.20.9'; + const VERSION = '6.20.10'; /** * The base path for the Laravel installation. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy