From 035b87718f61adb247fe78946c224d0a5cd2555e Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Wed, 28 Apr 2021 19:22:54 +0100 Subject: [PATCH 1/2] Fixes database offset value with non numbers (#37164) --- src/Illuminate/Database/Query/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index c45eb6195287..2117bc2e3992 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -2022,7 +2022,7 @@ public function offset($value) { $property = $this->unions ? 'unionOffset' : 'offset'; - $this->$property = max(0, $value); + $this->$property = max(0, (int) $value); return $this; } From f417343f13ca6f5d4feb4fd1a520cda2ad0b129c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 17 Nov 2021 15:00:00 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI --- .../Console/Events/ScheduledTaskFailed.php | 4 +-- src/Illuminate/Console/Scheduling/Event.php | 2 +- src/Illuminate/Container/Container.php | 1 - .../Contracts/Foundation/Application.php | 6 ++-- .../Database/Eloquent/Relations/BelongsTo.php | 1 - .../Schema/Grammars/SQLiteGrammar.php | 1 + src/Illuminate/Foundation/Application.php | 8 ++--- .../InteractsWithExceptionHandling.php | 3 +- .../Testing/Concerns/MakesHttpRequests.php | 3 +- src/Illuminate/Log/LogManager.php | 9 ------ src/Illuminate/Mail/PendingMail.php | 1 + .../Pagination/LengthAwarePaginator.php | 2 +- src/Illuminate/Pagination/Paginator.php | 2 +- src/Illuminate/Queue/SerializableClosure.php | 4 +-- .../Routing/CompiledRouteCollection.php | 4 +-- src/Illuminate/Support/Collection.php | 2 +- .../Support/Testing/Fakes/PendingMailFake.php | 1 + .../Support/Traits/ForwardsCalls.php | 2 +- .../Testing/Constraints/ArraySubset.php | 8 ++--- .../Concerns/ValidatesAttributes.php | 1 - src/Illuminate/Validation/Validator.php | 1 - tests/Auth/AuthenticatableTest.php | 3 +- tests/Cache/CacheRepositoryTest.php | 1 + tests/Console/CommandTest.php | 3 +- .../DatabaseEloquentCollectionTest.php | 8 +++-- tests/Database/DatabaseSoftDeletingTest.php | 12 +++++--- .../Foundation/FoundationApplicationTest.php | 6 ++-- .../CheckForMaintenanceModeTest.php | 3 +- .../Foundation/FoundationHelpersTest.php | 3 +- tests/Integration/Http/ResourceTest.php | 27 +++++++++++------ .../Queue/CallQueuedHandlerTest.php | 3 +- .../PaginatorLoadMorphCountTest.php | 3 +- tests/Pagination/PaginatorLoadMorphTest.php | 3 +- tests/Support/SupportCollectionTest.php | 6 ++-- tests/Support/SupportHelpersTest.php | 9 ++++-- tests/Testing/TestResponseTest.php | 3 +- tests/Validation/ValidationValidatorTest.php | 30 ++++++++++++------- .../Blade/BladeComponentTagCompilerTest.php | 3 +- tests/View/ViewFactoryTest.php | 3 +- 39 files changed, 115 insertions(+), 80 deletions(-) diff --git a/src/Illuminate/Console/Events/ScheduledTaskFailed.php b/src/Illuminate/Console/Events/ScheduledTaskFailed.php index 992d339f1a92..f111ce54ceec 100644 --- a/src/Illuminate/Console/Events/ScheduledTaskFailed.php +++ b/src/Illuminate/Console/Events/ScheduledTaskFailed.php @@ -24,8 +24,8 @@ class ScheduledTaskFailed /** * Create a new event instance. * - * @param \Illuminate\Console\Scheduling\Event $task - * @param \Throwable $exception + * @param \Illuminate\Console\Scheduling\Event $task + * @param \Throwable $exception */ public function __construct(Event $task, Throwable $exception) { diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index dfb505045ed2..8869b8177a88 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -579,7 +579,7 @@ protected function pingCallback($url) return function (Container $container, HttpClient $http) use ($url) { try { $http->request('GET', $url); - } catch (ClientExceptionInterface | TransferException $e) { + } catch (ClientExceptionInterface|TransferException $e) { $container->make(ExceptionHandler::class)->report($e); } }; diff --git a/src/Illuminate/Container/Container.php b/src/Illuminate/Container/Container.php index 1eb489a4f06f..28ec63620126 100755 --- a/src/Illuminate/Container/Container.php +++ b/src/Illuminate/Container/Container.php @@ -1112,7 +1112,6 @@ protected function fireAfterResolvingCallbacks($abstract, $object) * @param string $abstract * @param object $object * @param array $callbacksPerType - * * @return array */ protected function getCallbacksForType($abstract, $object, array $callbacksPerType) diff --git a/src/Illuminate/Contracts/Foundation/Application.php b/src/Illuminate/Contracts/Foundation/Application.php index 8ae0a31f267d..eb42f495e48c 100644 --- a/src/Illuminate/Contracts/Foundation/Application.php +++ b/src/Illuminate/Contracts/Foundation/Application.php @@ -24,7 +24,7 @@ public function basePath($path = ''); /** * Get the path to the bootstrap directory. * - * @param string $path Optionally, a path to append to the bootstrap path + * @param string $path Optionally, a path to append to the bootstrap path * @return string */ public function bootstrapPath($path = ''); @@ -32,7 +32,7 @@ public function bootstrapPath($path = ''); /** * Get the path to the application configuration files. * - * @param string $path Optionally, a path to append to the config path + * @param string $path Optionally, a path to append to the config path * @return string */ public function configPath($path = ''); @@ -40,7 +40,7 @@ public function configPath($path = ''); /** * Get the path to the database directory. * - * @param string $path Optionally, a path to append to the database path + * @param string $path Optionally, a path to append to the database path * @return string */ public function databasePath($path = ''); diff --git a/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php b/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php index 5ec2c315b8dc..0ee8d1ec9be0 100755 --- a/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php @@ -54,7 +54,6 @@ class BelongsTo extends Relation * @param string $foreignKey * @param string $ownerKey * @param string $relationName - * * @return void */ public function __construct(Builder $query, Model $child, $foreignKey, $ownerKey, $relationName) diff --git a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index edb075485382..557a3f534300 100755 --- a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -625,6 +625,7 @@ protected function typeDateTime(Fluent $column) * Create the column definition for a date-time (with time zone) type. * * Note: "SQLite does not have a storage class set aside for storing dates and/or times." + * * @link https://www.sqlite.org/datatype3.html * * @param \Illuminate\Support\Fluent $column diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 142bc4b2d4bd..bd53e19c5d6f 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -344,7 +344,7 @@ public function useAppPath($path) /** * Get the base path of the Laravel installation. * - * @param string $path Optionally, a path to append to the base path + * @param string $path Optionally, a path to append to the base path * @return string */ public function basePath($path = '') @@ -355,7 +355,7 @@ public function basePath($path = '') /** * Get the path to the bootstrap directory. * - * @param string $path Optionally, a path to append to the bootstrap path + * @param string $path Optionally, a path to append to the bootstrap path * @return string */ public function bootstrapPath($path = '') @@ -366,7 +366,7 @@ public function bootstrapPath($path = '') /** * Get the path to the application configuration files. * - * @param string $path Optionally, a path to append to the config path + * @param string $path Optionally, a path to append to the config path * @return string */ public function configPath($path = '') @@ -377,7 +377,7 @@ public function configPath($path = '') /** * Get the path to the database directory. * - * @param string $path Optionally, a path to append to the database path + * @param string $path Optionally, a path to append to the database path * @return string */ public function databasePath($path = '') diff --git a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php index 40e3d777ffbd..36253f624dac 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php +++ b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php @@ -64,7 +64,8 @@ protected function withoutExceptionHandling(array $except = []) $this->originalExceptionHandler = app(ExceptionHandler::class); } - $this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler { + $this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler + { protected $except; protected $originalHandler; diff --git a/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php b/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php index 10e55aab1358..01f843283d21 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php +++ b/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php @@ -142,7 +142,8 @@ public function withoutMiddleware($middleware = null) } foreach ((array) $middleware as $abstract) { - $this->app->instance($abstract, new class { + $this->app->instance($abstract, new class + { public function handle($request, $next) { return $next($request); diff --git a/src/Illuminate/Log/LogManager.php b/src/Illuminate/Log/LogManager.php index ab9bf51a15a4..53bc54ee7fc4 100644 --- a/src/Illuminate/Log/LogManager.php +++ b/src/Illuminate/Log/LogManager.php @@ -494,7 +494,6 @@ public function forgetChannel($driver = null) * * @param string $message * @param array $context - * * @return void */ public function emergency($message, array $context = []) @@ -510,7 +509,6 @@ public function emergency($message, array $context = []) * * @param string $message * @param array $context - * * @return void */ public function alert($message, array $context = []) @@ -525,7 +523,6 @@ public function alert($message, array $context = []) * * @param string $message * @param array $context - * * @return void */ public function critical($message, array $context = []) @@ -539,7 +536,6 @@ public function critical($message, array $context = []) * * @param string $message * @param array $context - * * @return void */ public function error($message, array $context = []) @@ -555,7 +551,6 @@ public function error($message, array $context = []) * * @param string $message * @param array $context - * * @return void */ public function warning($message, array $context = []) @@ -568,7 +563,6 @@ public function warning($message, array $context = []) * * @param string $message * @param array $context - * * @return void */ public function notice($message, array $context = []) @@ -583,7 +577,6 @@ public function notice($message, array $context = []) * * @param string $message * @param array $context - * * @return void */ public function info($message, array $context = []) @@ -596,7 +589,6 @@ public function info($message, array $context = []) * * @param string $message * @param array $context - * * @return void */ public function debug($message, array $context = []) @@ -610,7 +602,6 @@ public function debug($message, array $context = []) * @param mixed $level * @param string $message * @param array $context - * * @return void */ public function log($level, $message, array $context = []) diff --git a/src/Illuminate/Mail/PendingMail.php b/src/Illuminate/Mail/PendingMail.php index d040f79068ba..f59d3fc62528 100644 --- a/src/Illuminate/Mail/PendingMail.php +++ b/src/Illuminate/Mail/PendingMail.php @@ -126,6 +126,7 @@ public function send(MailableContract $mailable) * * @param \Illuminate\Contracts\Mail\Mailable $mailable * @return mixed + * * @deprecated Use send() instead. */ public function sendNow(MailableContract $mailable) diff --git a/src/Illuminate/Pagination/LengthAwarePaginator.php b/src/Illuminate/Pagination/LengthAwarePaginator.php index ba368cfe5149..46435b843e36 100644 --- a/src/Illuminate/Pagination/LengthAwarePaginator.php +++ b/src/Illuminate/Pagination/LengthAwarePaginator.php @@ -34,7 +34,7 @@ class LengthAwarePaginator extends AbstractPaginator implements Arrayable, Array * @param int $total * @param int $perPage * @param int|null $currentPage - * @param array $options (path, query, fragment, pageName) + * @param array $options (path, query, fragment, pageName) * @return void */ public function __construct($items, $total, $perPage, $currentPage = null, array $options = []) diff --git a/src/Illuminate/Pagination/Paginator.php b/src/Illuminate/Pagination/Paginator.php index dfe146465656..eb664eef3cfc 100644 --- a/src/Illuminate/Pagination/Paginator.php +++ b/src/Illuminate/Pagination/Paginator.php @@ -26,7 +26,7 @@ class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Cou * @param mixed $items * @param int $perPage * @param int|null $currentPage - * @param array $options (path, query, fragment, pageName) + * @param array $options (path, query, fragment, pageName) * @return void */ public function __construct($items, $perPage, $currentPage = null, array $options = []) diff --git a/src/Illuminate/Queue/SerializableClosure.php b/src/Illuminate/Queue/SerializableClosure.php index f8a1cf4bc5eb..7fc934ea92d2 100644 --- a/src/Illuminate/Queue/SerializableClosure.php +++ b/src/Illuminate/Queue/SerializableClosure.php @@ -11,7 +11,7 @@ class SerializableClosure extends OpisSerializableClosure /** * Transform the use variables before serialization. * - * @param array $data The Closure's use variables + * @param array $data The Closure's use variables * @return array */ protected function transformUseVariables($data) @@ -26,7 +26,7 @@ protected function transformUseVariables($data) /** * Resolve the use variables after unserialization. * - * @param array $data The Closure's transformed use variables + * @param array $data The Closure's transformed use variables * @return array */ protected function resolveUseVariables($data) diff --git a/src/Illuminate/Routing/CompiledRouteCollection.php b/src/Illuminate/Routing/CompiledRouteCollection.php index 099156cc4b81..65544d8f9bd8 100644 --- a/src/Illuminate/Routing/CompiledRouteCollection.php +++ b/src/Illuminate/Routing/CompiledRouteCollection.php @@ -121,7 +121,7 @@ public function match(Request $request) if ($result = $matcher->matchRequest($trimmedRequest)) { $route = $this->getByName($result['_route']); } - } catch (ResourceNotFoundException | MethodNotAllowedException $e) { + } catch (ResourceNotFoundException|MethodNotAllowedException $e) { try { return $this->routes->match($request); } catch (NotFoundHttpException $e) { @@ -136,7 +136,7 @@ public function match(Request $request) if (! $dynamicRoute->isFallback) { $route = $dynamicRoute; } - } catch (NotFoundHttpException | MethodNotAllowedHttpException $e) { + } catch (NotFoundHttpException|MethodNotAllowedHttpException $e) { // } } diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index 4fe58afe2550..5c435dc68cff 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -808,7 +808,7 @@ public function prepend($value, $key = null) /** * Push one or more items onto the end of the collection. * - * @param mixed $values [optional] + * @param mixed $values [optional] * @return $this */ public function push(...$values) diff --git a/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php b/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php index 7a7da77ffc39..13a13012351d 100644 --- a/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php +++ b/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php @@ -34,6 +34,7 @@ public function send(Mailable $mailable) * * @param \Illuminate\Contracts\Mail\Mailable $mailable * @return mixed + * * @deprecated Use send() instead. */ public function sendNow(Mailable $mailable) diff --git a/src/Illuminate/Support/Traits/ForwardsCalls.php b/src/Illuminate/Support/Traits/ForwardsCalls.php index bf9a2fc0445f..8b7add869689 100644 --- a/src/Illuminate/Support/Traits/ForwardsCalls.php +++ b/src/Illuminate/Support/Traits/ForwardsCalls.php @@ -21,7 +21,7 @@ protected function forwardCallTo($object, $method, $parameters) { try { return $object->{$method}(...$parameters); - } catch (Error | BadMethodCallException $e) { + } catch (Error|BadMethodCallException $e) { $pattern = '~^Call to undefined method (?P[^:]+)::(?P[^\(]+)\(\)$~'; if (! preg_match($pattern, $e->getMessage(), $matches)) { diff --git a/src/Illuminate/Testing/Constraints/ArraySubset.php b/src/Illuminate/Testing/Constraints/ArraySubset.php index b2ae60455add..c455bdd55487 100644 --- a/src/Illuminate/Testing/Constraints/ArraySubset.php +++ b/src/Illuminate/Testing/Constraints/ArraySubset.php @@ -91,9 +91,9 @@ public function evaluate($other, string $description = '', bool $returnResult = /** * Returns a string representation of the constraint. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * * @return string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ public function toString(): string { @@ -224,9 +224,9 @@ public function evaluate($other, string $description = '', bool $returnResult = /** * Returns a string representation of the constraint. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * * @return string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ public function toString(): string { diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index eed211c81be5..1c0b1d7c945e 100644 --- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -1918,7 +1918,6 @@ protected function isSameType($first, $second) * * @param string $attribute * @param string $rule - * * @return void */ protected function shouldBeNumeric($attribute, $rule) diff --git a/src/Illuminate/Validation/Validator.php b/src/Illuminate/Validation/Validator.php index d210d41825e8..18a5d00cf4e8 100755 --- a/src/Illuminate/Validation/Validator.php +++ b/src/Illuminate/Validation/Validator.php @@ -430,7 +430,6 @@ protected function shouldBeExcluded($attribute) * Remove the given attribute. * * @param string $attribute - * * @return void */ protected function removeAttribute($attribute) diff --git a/tests/Auth/AuthenticatableTest.php b/tests/Auth/AuthenticatableTest.php index 3837f06cf2bb..51bd662f3ccd 100644 --- a/tests/Auth/AuthenticatableTest.php +++ b/tests/Auth/AuthenticatableTest.php @@ -23,7 +23,8 @@ public function testItReturnsStringAsRememberTokenWhenItWasSetToTrue() public function testItReturnsNullWhenRememberTokenNameWasSetToEmpty() { - $user = new class extends User { + $user = new class extends User + { public function getRememberTokenName() { return ''; diff --git a/tests/Cache/CacheRepositoryTest.php b/tests/Cache/CacheRepositoryTest.php index 0a65163aa84c..d0dc9c803e2d 100755 --- a/tests/Cache/CacheRepositoryTest.php +++ b/tests/Cache/CacheRepositoryTest.php @@ -223,6 +223,7 @@ public function dataProviderTestGetSeconds() /** * @dataProvider dataProviderTestGetSeconds + * * @param mixed $duration */ public function testGetSeconds($duration) diff --git a/tests/Console/CommandTest.php b/tests/Console/CommandTest.php index d6c6afbbd2e0..33daf5866974 100644 --- a/tests/Console/CommandTest.php +++ b/tests/Console/CommandTest.php @@ -49,7 +49,8 @@ public function testCallingClassCommandResolveCommandViaApplicationResolution() public function testGettingCommandArgumentsAndOptionsByClass() { - $command = new class extends Command { + $command = new class extends Command + { public function handle() { } diff --git a/tests/Database/DatabaseEloquentCollectionTest.php b/tests/Database/DatabaseEloquentCollectionTest.php index ce216d705317..0680d768e384 100755 --- a/tests/Database/DatabaseEloquentCollectionTest.php +++ b/tests/Database/DatabaseEloquentCollectionTest.php @@ -465,17 +465,19 @@ public function testQueueableCollectionImplementationThrowsExceptionOnMultipleMo public function testQueueableRelationshipsReturnsOnlyRelationsCommonToAllModels() { // This is needed to prevent loading non-existing relationships on polymorphic model collections (#26126) - $c = new Collection([new class { + $c = new Collection([new class + { public function getQueueableRelations() { return ['user']; } - }, new class { + }, new class + { public function getQueueableRelations() { return ['user', 'comments']; } - }]); + }, ]); $this->assertEquals(['user'], $c->getQueueableRelations()); } diff --git a/tests/Database/DatabaseSoftDeletingTest.php b/tests/Database/DatabaseSoftDeletingTest.php index f14bd9f90cd1..7642b9ab3577 100644 --- a/tests/Database/DatabaseSoftDeletingTest.php +++ b/tests/Database/DatabaseSoftDeletingTest.php @@ -18,7 +18,8 @@ public function testDeletedAtIsAddedToDateCasts() public function testDeletedAtIsUniqueWhenAlreadyExists() { - $model = new class extends SoftDeletingModel { + $model = new class extends SoftDeletingModel + { protected $dates = ['deleted_at']; }; $entries = array_filter($model->getDates(), function ($attribute) { @@ -40,7 +41,8 @@ public function testDeletedAtIsCastToCarbonInstance() public function testExistingCastOverridesAddedDateCast() { - $model = new class(['deleted_at' => '2018-12-29 13:59:39']) extends SoftDeletingModel { + $model = new class(['deleted_at' => '2018-12-29 13:59:39']) extends SoftDeletingModel + { protected $casts = ['deleted_at' => 'bool']; }; @@ -49,7 +51,8 @@ public function testExistingCastOverridesAddedDateCast() public function testExistingMutatorOverridesAddedDateCast() { - $model = new class(['deleted_at' => '2018-12-29 13:59:39']) extends SoftDeletingModel { + $model = new class(['deleted_at' => '2018-12-29 13:59:39']) extends SoftDeletingModel + { protected function getDeletedAtAttribute() { return 'expected'; @@ -61,7 +64,8 @@ protected function getDeletedAtAttribute() public function testCastingToStringOverridesAutomaticDateCastingToRetainPreviousBehaviour() { - $model = new class(['deleted_at' => '2018-12-29 13:59:39']) extends SoftDeletingModel { + $model = new class(['deleted_at' => '2018-12-29 13:59:39']) extends SoftDeletingModel + { protected $casts = ['deleted_at' => 'string']; }; diff --git a/tests/Foundation/FoundationApplicationTest.php b/tests/Foundation/FoundationApplicationTest.php index 9f2fd3217b1a..5328579c31ed 100755 --- a/tests/Foundation/FoundationApplicationTest.php +++ b/tests/Foundation/FoundationApplicationTest.php @@ -45,7 +45,8 @@ public function testServiceProvidersAreCorrectlyRegistered() public function testClassesAreBoundWhenServiceProviderIsRegistered() { $app = new Application; - $app->register($provider = new class($app) extends ServiceProvider { + $app->register($provider = new class($app) extends ServiceProvider + { public $bindings = [ AbstractClass::class => ConcreteClass::class, ]; @@ -62,7 +63,8 @@ public function testClassesAreBoundWhenServiceProviderIsRegistered() public function testSingletonsAreCreatedWhenServiceProviderIsRegistered() { $app = new Application; - $app->register($provider = new class($app) extends ServiceProvider { + $app->register($provider = new class($app) extends ServiceProvider + { public $singletons = [ AbstractClass::class => ConcreteClass::class, ]; diff --git a/tests/Foundation/Http/Middleware/CheckForMaintenanceModeTest.php b/tests/Foundation/Http/Middleware/CheckForMaintenanceModeTest.php index c05b5e0fa200..5ad55578e5c8 100644 --- a/tests/Foundation/Http/Middleware/CheckForMaintenanceModeTest.php +++ b/tests/Foundation/Http/Middleware/CheckForMaintenanceModeTest.php @@ -105,7 +105,8 @@ public function testApplicationAllowsSomeURIs() { $app = $this->createMaintenanceApplication(); - $middleware = new class($app) extends CheckForMaintenanceMode { + $middleware = new class($app) extends CheckForMaintenanceMode + { public function __construct($app) { parent::__construct($app); diff --git a/tests/Integration/Foundation/FoundationHelpersTest.php b/tests/Integration/Foundation/FoundationHelpersTest.php index 3aba586e31e8..242e8f960d35 100644 --- a/tests/Integration/Foundation/FoundationHelpersTest.php +++ b/tests/Integration/Foundation/FoundationHelpersTest.php @@ -29,7 +29,8 @@ public function testRescue() return 'no need to rescue'; }, 'rescued!'), 'no need to rescue'); - $testClass = new class { + $testClass = new class + { public function test(int $a) { return $a; diff --git a/tests/Integration/Http/ResourceTest.php b/tests/Integration/Http/ResourceTest.php index 2553fd49c1e8..e8d3d07fac29 100644 --- a/tests/Integration/Http/ResourceTest.php +++ b/tests/Integration/Http/ResourceTest.php @@ -857,7 +857,8 @@ public function testKeysArePreservedInAnAnonymousColletionIfTheResourceIsFlagged public function testLeadingMergeKeyedValueIsMergedCorrectly() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() @@ -877,7 +878,8 @@ public function work() public function testLeadingMergeKeyedValueIsMergedCorrectlyWhenFirstValueIsMissing() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() @@ -901,7 +903,8 @@ public function work() public function testLeadingMergeValueIsMergedCorrectly() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() @@ -926,7 +929,8 @@ public function work() public function testMergeValuesMayBeMissing() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() @@ -951,7 +955,8 @@ public function work() public function testInitialMergeValuesMayBeMissing() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() @@ -976,7 +981,8 @@ public function work() public function testMergeValueCanMergeJsonSerializable() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() @@ -1007,7 +1013,8 @@ public function work() public function testMergeValueCanMergeCollectionOfJsonSerializable() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() @@ -1033,7 +1040,8 @@ public function work() public function testAllMergeValuesMayBeMissing() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() @@ -1058,7 +1066,8 @@ public function work() public function testNestedMerges() { - $filter = new class { + $filter = new class + { use ConditionallyLoadsAttributes; public function work() diff --git a/tests/Integration/Queue/CallQueuedHandlerTest.php b/tests/Integration/Queue/CallQueuedHandlerTest.php index 0eb2f0c1e923..a8558e44f176 100644 --- a/tests/Integration/Queue/CallQueuedHandlerTest.php +++ b/tests/Integration/Queue/CallQueuedHandlerTest.php @@ -149,7 +149,8 @@ abstract class AbstractCallQueuedHandlerTestJobWithMiddleware public function middleware() { return [ - new class { + new class + { public function handle($command, $next) { AbstractCallQueuedHandlerTestJobWithMiddleware::$middlewareCommand = $command; diff --git a/tests/Pagination/PaginatorLoadMorphCountTest.php b/tests/Pagination/PaginatorLoadMorphCountTest.php index 6fa9ba34a88e..c6e06454e451 100644 --- a/tests/Pagination/PaginatorLoadMorphCountTest.php +++ b/tests/Pagination/PaginatorLoadMorphCountTest.php @@ -19,7 +19,8 @@ public function testCollectionLoadMorphCountCanChainOnThePaginator() $items = m::mock(Collection::class); $items->shouldReceive('loadMorphCount')->once()->with('parentable', $relations); - $p = (new class extends AbstractPaginator { + $p = (new class extends AbstractPaginator + { // })->setCollection($items); diff --git a/tests/Pagination/PaginatorLoadMorphTest.php b/tests/Pagination/PaginatorLoadMorphTest.php index 5fd611040fa8..9ad43219daf5 100644 --- a/tests/Pagination/PaginatorLoadMorphTest.php +++ b/tests/Pagination/PaginatorLoadMorphTest.php @@ -19,7 +19,8 @@ public function testCollectionLoadMorphCanChainOnThePaginator() $items = m::mock(Collection::class); $items->shouldReceive('loadMorph')->once()->with('parentable', $relations); - $p = (new class extends AbstractPaginator { + $p = (new class extends AbstractPaginator + { // })->setCollection($items); diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 765561aecb17..d0c1dcda6ed9 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -586,7 +586,8 @@ public function testHigherOrderUnique($collection) public function testHigherOrderFilter($collection) { $c = new $collection([ - new class { + new class + { public $name = 'Alex'; public function active() @@ -594,7 +595,8 @@ public function active() return true; } }, - new class { + new class + { public $name = 'John'; public function active() diff --git a/tests/Support/SupportHelpersTest.php b/tests/Support/SupportHelpersTest.php index 9e5b6464f4ca..fc65ae6043b2 100755 --- a/tests/Support/SupportHelpersTest.php +++ b/tests/Support/SupportHelpersTest.php @@ -385,7 +385,8 @@ public function testOptional() { $this->assertNull(optional(null)->something()); - $this->assertEquals(10, optional(new class { + $this->assertEquals(10, optional(new class + { public function something() { return 10; @@ -463,10 +464,12 @@ public function testOptionalIsMacroable() $this->assertNull(optional(null)->present()->something()); - $this->assertSame('$10.00', optional(new class { + $this->assertSame('$10.00', optional(new class + { public function present() { - return new class { + return new class + { public function something() { return '$10.00'; diff --git a/tests/Testing/TestResponseTest.php b/tests/Testing/TestResponseTest.php index 6886cd3ebc5b..db87caae694e 100644 --- a/tests/Testing/TestResponseTest.php +++ b/tests/Testing/TestResponseTest.php @@ -39,7 +39,8 @@ public function testAssertViewHas() public function testAssertViewHasModel() { - $model = new class extends Model { + $model = new class extends Model + { public function is($model) { return $this == $model; diff --git a/tests/Validation/ValidationValidatorTest.php b/tests/Validation/ValidationValidatorTest.php index 12881c1fe373..e32d715b743b 100755 --- a/tests/Validation/ValidationValidatorTest.php +++ b/tests/Validation/ValidationValidatorTest.php @@ -2360,7 +2360,8 @@ public function testValidateEmail() $this->assertFalse($v->passes()); $v = new Validator($trans, [ - 'x' => new class { + 'x' => new class + { public function __toString() { return 'aslsdlks'; @@ -2370,7 +2371,8 @@ public function __toString() $this->assertFalse($v->passes()); $v = new Validator($trans, [ - 'x' => new class { + 'x' => new class + { public function __toString() { return 'foo@gmail.com'; @@ -4801,7 +4803,8 @@ public function testCustomValidationObject() $this->getIlluminateArrayTranslator(), ['name' => 'taylor'], [ - 'name' => new class implements Rule { + 'name' => new class implements Rule + { public function passes($attribute, $value) { return $value === 'taylor'; @@ -4823,7 +4826,8 @@ public function message() ['name' => 'adam'], [ 'name' => [ - new class implements Rule { + new class implements Rule + { public function passes($attribute, $value) { return $value === 'taylor'; @@ -4877,7 +4881,8 @@ public function message() $this->getIlluminateArrayTranslator(), ['name' => 'taylor', 'states' => ['AR', 'TX'], 'number' => 9], [ - 'states.*' => new class implements Rule { + 'states.*' => new class implements Rule + { public function passes($attribute, $value) { return in_array($value, ['AK', 'HI']); @@ -4915,7 +4920,8 @@ function ($attribute, $value, $fail) { $this->getIlluminateArrayTranslator(), ['name' => 42], [ - 'name' => new class implements Rule { + 'name' => new class implements Rule + { public function passes($attribute, $value) { return $value === 'taylor'; @@ -4939,7 +4945,8 @@ public function message() ['name' => 42], [ 'name' => [ - new class implements Rule { + new class implements Rule + { public function passes($attribute, $value) { return $value === 'taylor'; @@ -4966,7 +4973,8 @@ public function testCustomValidationObjectWithDotKeysIsCorrectlyPassedValue() $this->getIlluminateArrayTranslator(), ['foo' => ['foo.bar' => 'baz']], [ - 'foo' => new class implements Rule { + 'foo' => new class implements Rule + { public function passes($attribute, $value) { return $value === ['foo.bar' => 'baz']; @@ -4987,7 +4995,8 @@ public function message() $this->getIlluminateArrayTranslator(), ['foo' => ['foo.bar' => 'baz']], [ - 'foo.foo\.bar' => new class implements Rule { + 'foo.foo\.bar' => new class implements Rule + { public function passes($attribute, $value) { return false; @@ -5012,7 +5021,8 @@ public function testImplicitCustomValidationObjects() $this->getIlluminateArrayTranslator(), ['name' => ''], [ - 'name' => $rule = new class implements ImplicitRule { + 'name' => $rule = new class implements ImplicitRule + { public $called = false; public function passes($attribute, $value) diff --git a/tests/View/Blade/BladeComponentTagCompilerTest.php b/tests/View/Blade/BladeComponentTagCompilerTest.php index 8b123ba5e0ea..e64e15d06aa1 100644 --- a/tests/View/Blade/BladeComponentTagCompilerTest.php +++ b/tests/View/Blade/BladeComponentTagCompilerTest.php @@ -223,7 +223,8 @@ public function testPackagesClasslessComponents() public function testAttributeSanitization() { - $class = new class { + $class = new class + { public function __toString() { return ''; diff --git a/tests/View/ViewFactoryTest.php b/tests/View/ViewFactoryTest.php index bd8db37658e4..313d00be8a6d 100755 --- a/tests/View/ViewFactoryTest.php +++ b/tests/View/ViewFactoryTest.php @@ -593,7 +593,8 @@ public function testAddingLoopDoesNotCloseGenerator() { $factory = $this->getFactory(); - $data = (new class { + $data = (new class + { public function generate() { for ($count = 0; $count < 3; $count++) {