From 8c84eb8dcec6a4c62c4ded1c9eb51dbe3ca10fa4 Mon Sep 17 00:00:00 2001 From: Michael Nabil <46572405+michaelnabil230@users.noreply.github.com> Date: Sat, 26 Nov 2022 20:13:57 +0200 Subject: [PATCH 1/2] Fix spaces --- .../Database/Concerns/CompilesJsonPaths.php | 2 +- .../DatabaseEloquentWithCastsTest.php | 2 +- tests/Http/HttpRequestTest.php | 10 +++++----- .../Database/EloquentWhereHasTest.php | 2 +- .../NotificationDatabaseChannelTest.php | 8 ++++---- tests/Queue/QueueDatabaseQueueUnitTest.php | 9 ++++----- tests/Support/SupportArrTest.php | 4 ++-- tests/Support/SupportStrTest.php | 2 +- tests/Validation/ValidationValidatorTest.php | 20 +++++++++---------- .../Blade/BladeComponentTagCompilerTest.php | 2 +- .../Eloquent/ModelNotFoundException.php | 12 +++++------ types/Support/Collection.php | 2 +- 12 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/Illuminate/Database/Concerns/CompilesJsonPaths.php b/src/Illuminate/Database/Concerns/CompilesJsonPaths.php index cd520e788502..ade546153f5f 100644 --- a/src/Illuminate/Database/Concerns/CompilesJsonPaths.php +++ b/src/Illuminate/Database/Concerns/CompilesJsonPaths.php @@ -35,7 +35,7 @@ protected function wrapJsonPath($value, $delimiter = '->') $value = preg_replace("/([\\\\]+)?\\'/", "''", $value); $jsonPath = collect(explode($delimiter, $value)) - ->map(fn ($segment) => $this->wrapJsonPathSegment($segment)) + ->map(fn ($segment) => $this->wrapJsonPathSegment($segment)) ->join('.'); return "'$".(str_starts_with($jsonPath, '[') ? '' : '.').$jsonPath."'"; diff --git a/tests/Database/DatabaseEloquentWithCastsTest.php b/tests/Database/DatabaseEloquentWithCastsTest.php index 689323c514ff..ecc6ccb419a2 100644 --- a/tests/Database/DatabaseEloquentWithCastsTest.php +++ b/tests/Database/DatabaseEloquentWithCastsTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $db = new DB; $db->addConnection([ - 'driver' => 'sqlite', + 'driver' => 'sqlite', 'database' => ':memory:', ]); diff --git a/tests/Http/HttpRequestTest.php b/tests/Http/HttpRequestTest.php index cc19d1999ecb..96c6e5082b97 100644 --- a/tests/Http/HttpRequestTest.php +++ b/tests/Http/HttpRequestTest.php @@ -587,7 +587,7 @@ public function testInputMethod() public function testBooleanMethod() { - $request = Request::create('/', 'GET', ['with_trashed' => 'false', 'download' => true, 'checked' => 1, 'unchecked' => '0', 'with_on' => 'on', 'with_yes'=> 'yes']); + $request = Request::create('/', 'GET', ['with_trashed' => 'false', 'download' => true, 'checked' => 1, 'unchecked' => '0', 'with_on' => 'on', 'with_yes' => 'yes']); $this->assertTrue($request->boolean('checked')); $this->assertTrue($request->boolean('download')); $this->assertFalse($request->boolean('unchecked')); @@ -605,8 +605,8 @@ public function testIntegerMethod() 'zero_padded' => '078', 'space_padded' => ' 901', 'nan' => 'nan', - 'mixed'=> '1ab', - 'underscore_notation'=> '2_000', + 'mixed' => '1ab', + 'underscore_notation' => '2_000', ]); $this->assertSame(123, $request->integer('int')); $this->assertSame(456, $request->integer('raw_int')); @@ -627,8 +627,8 @@ public function testFloatMethod() 'zero_padded' => '0.78', 'space_padded' => ' 90.1', 'nan' => 'nan', - 'mixed'=> '1.ab', - 'scientific_notation'=> '1e3', + 'mixed' => '1.ab', + 'scientific_notation' => '1e3', ]); $this->assertSame(1.23, $request->float('float')); $this->assertSame(45.6, $request->float('raw_float')); diff --git a/tests/Integration/Database/EloquentWhereHasTest.php b/tests/Integration/Database/EloquentWhereHasTest.php index dcc297c0d20f..22cfaf5d5a75 100644 --- a/tests/Integration/Database/EloquentWhereHasTest.php +++ b/tests/Integration/Database/EloquentWhereHasTest.php @@ -110,7 +110,7 @@ public static function dataProviderWhereRelationCallback() }; return [ - 'Find user with post.public = true' => $callbackArray(true), + 'Find user with post.public = true' => $callbackArray(true), 'Find user with post.public = false' => $callbackArray(false), ]; } diff --git a/tests/Notifications/NotificationDatabaseChannelTest.php b/tests/Notifications/NotificationDatabaseChannelTest.php index 3a45a65a3fc5..d10722693ab6 100644 --- a/tests/Notifications/NotificationDatabaseChannelTest.php +++ b/tests/Notifications/NotificationDatabaseChannelTest.php @@ -57,10 +57,10 @@ public function testCustomizeTypeIsSentToDatabase() $notifiable = m::mock(); $notifiable->shouldReceive('routeNotificationFor->create')->with([ - 'id' => 1, - 'type' => 'MONTHLY', - 'data' => ['invoice_id' => 1], - 'read_at' => null, + 'id' => 1, + 'type' => 'MONTHLY', + 'data' => ['invoice_id' => 1], + 'read_at' => null, 'something' => 'else', ]); diff --git a/tests/Queue/QueueDatabaseQueueUnitTest.php b/tests/Queue/QueueDatabaseQueueUnitTest.php index 118a38434ac1..021e037de007 100644 --- a/tests/Queue/QueueDatabaseQueueUnitTest.php +++ b/tests/Queue/QueueDatabaseQueueUnitTest.php @@ -54,11 +54,10 @@ public function testDelayedPushProperlyPushesJobOntoDatabase() return $uuid; }); - $queue = $this->getMockBuilder( - DatabaseQueue::class)->onlyMethods( - ['currentTime'])->setConstructorArgs( - [$database = m::mock(Connection::class), 'table', 'default'] - )->getMock(); + $queue = $this->getMockBuilder(DatabaseQueue::class) + ->onlyMethods(['currentTime']) + ->setConstructorArgs([$database = m::mock(Connection::class), 'table', 'default']) + ->getMock(); $queue->expects($this->any())->method('currentTime')->willReturn('time'); $queue->setContainer($container = m::spy(Container::class)); $database->shouldReceive('table')->with('table')->andReturn($query = m::mock(stdClass::class)); diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index d0a86cc32a64..89b466f18e50 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -994,9 +994,9 @@ public function testForget() Arr::forget($array, 1); $this->assertEquals(['name' => 'hAz', 2 => 'bAz'], $array); - $array = [2 => [1 =>'products', 3 => 'users']]; + $array = [2 => [1 => 'products', 3 => 'users']]; Arr::forget($array, 2.3); - $this->assertEquals([2 => [1 =>'products']], $array); + $this->assertEquals([2 => [1 => 'products']], $array); } public function testWrap() diff --git a/tests/Support/SupportStrTest.php b/tests/Support/SupportStrTest.php index a1ae2c504927..42903d5e74cf 100755 --- a/tests/Support/SupportStrTest.php +++ b/tests/Support/SupportStrTest.php @@ -326,7 +326,7 @@ public function testSlug() $this->assertSame('500-dollar-bill', Str::slug('500-$-bill', '-', 'en', ['$' => 'dollar'])); $this->assertSame('500-dollar-bill', Str::slug('500$--bill', '-', 'en', ['$' => 'dollar'])); $this->assertSame('500-dollar-bill', Str::slug('500-$--bill', '-', 'en', ['$' => 'dollar'])); - $this->assertSame('أحمد-في-المدرسة', Str::slug('أحمد@المدرسة', '-', null, ['@' =>'في'])); + $this->assertSame('أحمد-في-المدرسة', Str::slug('أحمد@المدرسة', '-', null, ['@' => 'في'])); } public function testStrStart() diff --git a/tests/Validation/ValidationValidatorTest.php b/tests/Validation/ValidationValidatorTest.php index 89fb0989b07a..d1b82afe7e17 100755 --- a/tests/Validation/ValidationValidatorTest.php +++ b/tests/Validation/ValidationValidatorTest.php @@ -4736,7 +4736,7 @@ public function testItemAwareSometimesAddingRules() { // ['users'] -> if users is not empty it must be validated as array $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]], ['users.*.name'=> 'required|string']); + $v = new Validator($trans, ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]], ['users.*.name' => 'required|string']); $v->sometimes(['users'], 'array', function ($i, $item) { return $item !== null; }); @@ -4744,7 +4744,7 @@ public function testItemAwareSometimesAddingRules() // ['users'] -> if users is null no rules will be applied $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['users' => null], ['users.*.name'=> 'required|string']); + $v = new Validator($trans, ['users' => null], ['users.*.name' => 'required|string']); $v->sometimes(['users'], 'array', function ($i, $item) { return (bool) $item; }); @@ -4752,7 +4752,7 @@ public function testItemAwareSometimesAddingRules() // ['company.users'] -> if users is not empty it must be validated as array $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['company' => ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]]], ['company.users.*.name'=> 'required|string']); + $v = new Validator($trans, ['company' => ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]]], ['company.users.*.name' => 'required|string']); $v->sometimes(['company.users'], 'array', function ($i, $item) { return $item->users !== null; }); @@ -4760,7 +4760,7 @@ public function testItemAwareSometimesAddingRules() // ['company.users'] -> if users is null no rules will be applied $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['company' => ['users' => null]], ['company'=> 'required', 'company.users.*.name'=> 'required|string']); + $v = new Validator($trans, ['company' => ['users' => null]], ['company' => 'required', 'company.users.*.name' => 'required|string']); $v->sometimes(['company.users'], 'array', function ($i, $item) { return (bool) $item->users; }); @@ -4768,7 +4768,7 @@ public function testItemAwareSometimesAddingRules() // ['company.*'] -> if users is not empty it must be validated as array $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['company' => ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]]], ['company.users.*.name'=> 'required|string']); + $v = new Validator($trans, ['company' => ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]]], ['company.users.*.name' => 'required|string']); $v->sometimes(['company.*'], 'array', function ($i, $item) { return $item !== null; }); @@ -4776,7 +4776,7 @@ public function testItemAwareSometimesAddingRules() // ['company.*'] -> if users is null no rules will be applied $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['company' => ['users' => null]], ['company'=> 'required', 'company.users.*.name'=> 'required|string']); + $v = new Validator($trans, ['company' => ['users' => null]], ['company' => 'required', 'company.users.*.name' => 'required|string']); $v->sometimes(['company.*'], 'array', function ($i, $item) { return (bool) $item; }); @@ -4784,7 +4784,7 @@ public function testItemAwareSometimesAddingRules() // ['users.*'] -> all nested array items in users must be validated as array $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]], ['users.*.name'=> 'required|string']); + $v = new Validator($trans, ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]], ['users.*.name' => 'required|string']); $v->sometimes(['users.*'], 'array', function ($i, $item) { return (bool) $item; }); @@ -4792,7 +4792,7 @@ public function testItemAwareSometimesAddingRules() // ['company.users.*'] -> all nested array items in users must be validated as array $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['company' => ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]]], ['company.users.*.name'=> 'required|string']); + $v = new Validator($trans, ['company' => ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]]], ['company.users.*.name' => 'required|string']); $v->sometimes(['company.users.*'], 'array', function () { return true; }); @@ -4800,7 +4800,7 @@ public function testItemAwareSometimesAddingRules() // ['company.*.*'] -> all nested array items in users must be validated as array $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['company' => ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]]], ['company.users.*.name'=> 'required|string']); + $v = new Validator($trans, ['company' => ['users' => [['name' => 'Taylor'], ['name' => 'Abigail']]]], ['company.users.*.name' => 'required|string']); $v->sometimes(['company.*.*'], 'array', function ($i, $item) { return true; }); @@ -4905,7 +4905,7 @@ public function testItemAwareSometimesAddingRules() // ['attendee.*'] -> if attendee name is set, all other fields will be required as well $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['attendee' => ['name' => 'Taylor', 'title' => 'Creator of Laravel', 'type' => 'Developer']], ['attendee.*'=> 'string']); + $v = new Validator($trans, ['attendee' => ['name' => 'Taylor', 'title' => 'Creator of Laravel', 'type' => 'Developer']], ['attendee.*' => 'string']); $v->sometimes(['attendee.*'], 'required', function ($i, $item) { return (bool) $item; }); diff --git a/tests/View/Blade/BladeComponentTagCompilerTest.php b/tests/View/Blade/BladeComponentTagCompilerTest.php index 0fdd7295d8ac..5ec4aa194243 100644 --- a/tests/View/Blade/BladeComponentTagCompilerTest.php +++ b/tests/View/Blade/BladeComponentTagCompilerTest.php @@ -268,7 +268,7 @@ public function testClassDirective() getConstructor()): ?> except(collect(\$constructor->getParameters())->map->getName()->all()); ?> -withAttributes(['class' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(\Illuminate\Support\Arr::toCssClasses(['bar'=>true]))]); ?> @endComponentClass##END-COMPONENT-CLASS##", trim($result)); +withAttributes(['class' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(\Illuminate\Support\Arr::toCssClasses(['bar' => true]))]); ?> @endComponentClass##END-COMPONENT-CLASS##", trim($result)); } public function testColonNestedComponentParsing() diff --git a/types/Database/Eloquent/ModelNotFoundException.php b/types/Database/Eloquent/ModelNotFoundException.php index c9feffc13b1f..9f8b36fae0d3 100644 --- a/types/Database/Eloquent/ModelNotFoundException.php +++ b/types/Database/Eloquent/ModelNotFoundException.php @@ -6,10 +6,10 @@ /** @var ModelNotFoundException $exception */ $exception = new ModelNotFoundException(); - assertType('array', $exception->getIds()); - assertType('class-string', $exception->getModel()); +assertType('array', $exception->getIds()); +assertType('class-string', $exception->getModel()); - $exception->setModel(User::class, 1); - $exception->setModel(User::class, [1]); - $exception->setModel(User::class, '1'); - $exception->setModel(User::class, ['1']); +$exception->setModel(User::class, 1); +$exception->setModel(User::class, [1]); +$exception->setModel(User::class, '1'); +$exception->setModel(User::class, ['1']); diff --git a/types/Support/Collection.php b/types/Support/Collection.php index aa1adb617ed3..f691d4c38435 100644 --- a/types/Support/Collection.php +++ b/types/Support/Collection.php @@ -286,7 +286,7 @@ function ($collection, $name) { } ) ); -assertType('Illuminate\Support\Collection|void', $collection->when(fn () =>'Taylor', function ($collection, $name) { +assertType('Illuminate\Support\Collection|void', $collection->when(fn () => 'Taylor', function ($collection, $name) { assertType('Illuminate\Support\Collection', $collection); assertType('string', $name); })); From 43b90729cba2c9504659207302d0bce3eab56076 Mon Sep 17 00:00:00 2001 From: Michael Nabil <46572405+michaelnabil230@users.noreply.github.com> Date: Sat, 26 Nov 2022 20:17:50 +0200 Subject: [PATCH 2/2] fix --- tests/View/Blade/BladeComponentTagCompilerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/View/Blade/BladeComponentTagCompilerTest.php b/tests/View/Blade/BladeComponentTagCompilerTest.php index 5ec4aa194243..0fdd7295d8ac 100644 --- a/tests/View/Blade/BladeComponentTagCompilerTest.php +++ b/tests/View/Blade/BladeComponentTagCompilerTest.php @@ -268,7 +268,7 @@ public function testClassDirective() getConstructor()): ?> except(collect(\$constructor->getParameters())->map->getName()->all()); ?> -withAttributes(['class' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(\Illuminate\Support\Arr::toCssClasses(['bar' => true]))]); ?> @endComponentClass##END-COMPONENT-CLASS##", trim($result)); +withAttributes(['class' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(\Illuminate\Support\Arr::toCssClasses(['bar'=>true]))]); ?> @endComponentClass##END-COMPONENT-CLASS##", trim($result)); } public function testColonNestedComponentParsing()