Skip to content

Commit afb0c03

Browse files
GrahamCampbellnunomadurotaylorotwell
authored
[7.x] Fixes database offset value with non numbers (#39656)
* Fixes database offset value with non numbers (#37164) * Apply fixes from StyleCI Co-authored-by: Nuno Maduro <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
1 parent 46130d0 commit afb0c03

40 files changed

+116
-81
lines changed

src/Illuminate/Console/Events/ScheduledTaskFailed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class ScheduledTaskFailed
2424
/**
2525
* Create a new event instance.
2626
*
27-
* @param \Illuminate\Console\Scheduling\Event $task
28-
* @param \Throwable $exception
27+
* @param \Illuminate\Console\Scheduling\Event $task
28+
* @param \Throwable $exception
2929
*/
3030
public function __construct(Event $task, Throwable $exception)
3131
{

src/Illuminate/Console/Scheduling/Event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ protected function pingCallback($url)
579579
return function (Container $container, HttpClient $http) use ($url) {
580580
try {
581581
$http->request('GET', $url);
582-
} catch (ClientExceptionInterface | TransferException $e) {
582+
} catch (ClientExceptionInterface|TransferException $e) {
583583
$container->make(ExceptionHandler::class)->report($e);
584584
}
585585
};

src/Illuminate/Container/Container.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,6 @@ protected function fireAfterResolvingCallbacks($abstract, $object)
11121112
* @param string $abstract
11131113
* @param object $object
11141114
* @param array $callbacksPerType
1115-
*
11161115
* @return array
11171116
*/
11181117
protected function getCallbacksForType($abstract, $object, array $callbacksPerType)

src/Illuminate/Contracts/Foundation/Application.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ public function basePath($path = '');
2424
/**
2525
* Get the path to the bootstrap directory.
2626
*
27-
* @param string $path Optionally, a path to append to the bootstrap path
27+
* @param string $path Optionally, a path to append to the bootstrap path
2828
* @return string
2929
*/
3030
public function bootstrapPath($path = '');
3131

3232
/**
3333
* Get the path to the application configuration files.
3434
*
35-
* @param string $path Optionally, a path to append to the config path
35+
* @param string $path Optionally, a path to append to the config path
3636
* @return string
3737
*/
3838
public function configPath($path = '');
3939

4040
/**
4141
* Get the path to the database directory.
4242
*
43-
* @param string $path Optionally, a path to append to the database path
43+
* @param string $path Optionally, a path to append to the database path
4444
* @return string
4545
*/
4646
public function databasePath($path = '');

src/Illuminate/Database/Eloquent/Relations/BelongsTo.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class BelongsTo extends Relation
5454
* @param string $foreignKey
5555
* @param string $ownerKey
5656
* @param string $relationName
57-
*
5857
* @return void
5958
*/
6059
public function __construct(Builder $query, Model $child, $foreignKey, $ownerKey, $relationName)

src/Illuminate/Database/Query/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ public function offset($value)
20222022
{
20232023
$property = $this->unions ? 'unionOffset' : 'offset';
20242024

2025-
$this->$property = max(0, $value);
2025+
$this->$property = max(0, (int) $value);
20262026

20272027
return $this;
20282028
}

src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ protected function typeDateTime(Fluent $column)
625625
* Create the column definition for a date-time (with time zone) type.
626626
*
627627
* Note: "SQLite does not have a storage class set aside for storing dates and/or times."
628+
*
628629
* @link https://www.sqlite.org/datatype3.html
629630
*
630631
* @param \Illuminate\Support\Fluent $column

src/Illuminate/Foundation/Application.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public function useAppPath($path)
344344
/**
345345
* Get the base path of the Laravel installation.
346346
*
347-
* @param string $path Optionally, a path to append to the base path
347+
* @param string $path Optionally, a path to append to the base path
348348
* @return string
349349
*/
350350
public function basePath($path = '')
@@ -355,7 +355,7 @@ public function basePath($path = '')
355355
/**
356356
* Get the path to the bootstrap directory.
357357
*
358-
* @param string $path Optionally, a path to append to the bootstrap path
358+
* @param string $path Optionally, a path to append to the bootstrap path
359359
* @return string
360360
*/
361361
public function bootstrapPath($path = '')
@@ -366,7 +366,7 @@ public function bootstrapPath($path = '')
366366
/**
367367
* Get the path to the application configuration files.
368368
*
369-
* @param string $path Optionally, a path to append to the config path
369+
* @param string $path Optionally, a path to append to the config path
370370
* @return string
371371
*/
372372
public function configPath($path = '')
@@ -377,7 +377,7 @@ public function configPath($path = '')
377377
/**
378378
* Get the path to the database directory.
379379
*
380-
* @param string $path Optionally, a path to append to the database path
380+
* @param string $path Optionally, a path to append to the database path
381381
* @return string
382382
*/
383383
public function databasePath($path = '')

src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ protected function withoutExceptionHandling(array $except = [])
6464
$this->originalExceptionHandler = app(ExceptionHandler::class);
6565
}
6666

67-
$this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler {
67+
$this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler
68+
{
6869
protected $except;
6970
protected $originalHandler;
7071

src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ public function withoutMiddleware($middleware = null)
142142
}
143143

144144
foreach ((array) $middleware as $abstract) {
145-
$this->app->instance($abstract, new class {
145+
$this->app->instance($abstract, new class
146+
{
146147
public function handle($request, $next)
147148
{
148149
return $next($request);

src/Illuminate/Log/LogManager.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ public function forgetChannel($driver = null)
494494
*
495495
* @param string $message
496496
* @param array $context
497-
*
498497
* @return void
499498
*/
500499
public function emergency($message, array $context = [])
@@ -510,7 +509,6 @@ public function emergency($message, array $context = [])
510509
*
511510
* @param string $message
512511
* @param array $context
513-
*
514512
* @return void
515513
*/
516514
public function alert($message, array $context = [])
@@ -525,7 +523,6 @@ public function alert($message, array $context = [])
525523
*
526524
* @param string $message
527525
* @param array $context
528-
*
529526
* @return void
530527
*/
531528
public function critical($message, array $context = [])
@@ -539,7 +536,6 @@ public function critical($message, array $context = [])
539536
*
540537
* @param string $message
541538
* @param array $context
542-
*
543539
* @return void
544540
*/
545541
public function error($message, array $context = [])
@@ -555,7 +551,6 @@ public function error($message, array $context = [])
555551
*
556552
* @param string $message
557553
* @param array $context
558-
*
559554
* @return void
560555
*/
561556
public function warning($message, array $context = [])
@@ -568,7 +563,6 @@ public function warning($message, array $context = [])
568563
*
569564
* @param string $message
570565
* @param array $context
571-
*
572566
* @return void
573567
*/
574568
public function notice($message, array $context = [])
@@ -583,7 +577,6 @@ public function notice($message, array $context = [])
583577
*
584578
* @param string $message
585579
* @param array $context
586-
*
587580
* @return void
588581
*/
589582
public function info($message, array $context = [])
@@ -596,7 +589,6 @@ public function info($message, array $context = [])
596589
*
597590
* @param string $message
598591
* @param array $context
599-
*
600592
* @return void
601593
*/
602594
public function debug($message, array $context = [])
@@ -610,7 +602,6 @@ public function debug($message, array $context = [])
610602
* @param mixed $level
611603
* @param string $message
612604
* @param array $context
613-
*
614605
* @return void
615606
*/
616607
public function log($level, $message, array $context = [])

src/Illuminate/Mail/PendingMail.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function send(MailableContract $mailable)
126126
*
127127
* @param \Illuminate\Contracts\Mail\Mailable $mailable
128128
* @return mixed
129+
*
129130
* @deprecated Use send() instead.
130131
*/
131132
public function sendNow(MailableContract $mailable)

src/Illuminate/Pagination/LengthAwarePaginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LengthAwarePaginator extends AbstractPaginator implements Arrayable, Array
3434
* @param int $total
3535
* @param int $perPage
3636
* @param int|null $currentPage
37-
* @param array $options (path, query, fragment, pageName)
37+
* @param array $options (path, query, fragment, pageName)
3838
* @return void
3939
*/
4040
public function __construct($items, $total, $perPage, $currentPage = null, array $options = [])

src/Illuminate/Pagination/Paginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Cou
2626
* @param mixed $items
2727
* @param int $perPage
2828
* @param int|null $currentPage
29-
* @param array $options (path, query, fragment, pageName)
29+
* @param array $options (path, query, fragment, pageName)
3030
* @return void
3131
*/
3232
public function __construct($items, $perPage, $currentPage = null, array $options = [])

src/Illuminate/Queue/SerializableClosure.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class SerializableClosure extends OpisSerializableClosure
1111
/**
1212
* Transform the use variables before serialization.
1313
*
14-
* @param array $data The Closure's use variables
14+
* @param array $data The Closure's use variables
1515
* @return array
1616
*/
1717
protected function transformUseVariables($data)
@@ -26,7 +26,7 @@ protected function transformUseVariables($data)
2626
/**
2727
* Resolve the use variables after unserialization.
2828
*
29-
* @param array $data The Closure's transformed use variables
29+
* @param array $data The Closure's transformed use variables
3030
* @return array
3131
*/
3232
protected function resolveUseVariables($data)

src/Illuminate/Routing/CompiledRouteCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function match(Request $request)
121121
if ($result = $matcher->matchRequest($trimmedRequest)) {
122122
$route = $this->getByName($result['_route']);
123123
}
124-
} catch (ResourceNotFoundException | MethodNotAllowedException $e) {
124+
} catch (ResourceNotFoundException|MethodNotAllowedException $e) {
125125
try {
126126
return $this->routes->match($request);
127127
} catch (NotFoundHttpException $e) {
@@ -136,7 +136,7 @@ public function match(Request $request)
136136
if (! $dynamicRoute->isFallback) {
137137
$route = $dynamicRoute;
138138
}
139-
} catch (NotFoundHttpException | MethodNotAllowedHttpException $e) {
139+
} catch (NotFoundHttpException|MethodNotAllowedHttpException $e) {
140140
//
141141
}
142142
}

src/Illuminate/Support/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ public function prepend($value, $key = null)
808808
/**
809809
* Push one or more items onto the end of the collection.
810810
*
811-
* @param mixed $values [optional]
811+
* @param mixed $values [optional]
812812
* @return $this
813813
*/
814814
public function push(...$values)

src/Illuminate/Support/Testing/Fakes/PendingMailFake.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function send(Mailable $mailable)
3434
*
3535
* @param \Illuminate\Contracts\Mail\Mailable $mailable
3636
* @return mixed
37+
*
3738
* @deprecated Use send() instead.
3839
*/
3940
public function sendNow(Mailable $mailable)

src/Illuminate/Support/Traits/ForwardsCalls.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected function forwardCallTo($object, $method, $parameters)
2121
{
2222
try {
2323
return $object->{$method}(...$parameters);
24-
} catch (Error | BadMethodCallException $e) {
24+
} catch (Error|BadMethodCallException $e) {
2525
$pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~';
2626

2727
if (! preg_match($pattern, $e->getMessage(), $matches)) {

src/Illuminate/Testing/Constraints/ArraySubset.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ public function evaluate($other, string $description = '', bool $returnResult =
9191
/**
9292
* Returns a string representation of the constraint.
9393
*
94-
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
95-
*
9694
* @return string
95+
*
96+
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
9797
*/
9898
public function toString(): string
9999
{
@@ -224,9 +224,9 @@ public function evaluate($other, string $description = '', bool $returnResult =
224224
/**
225225
* Returns a string representation of the constraint.
226226
*
227-
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
228-
*
229227
* @return string
228+
*
229+
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
230230
*/
231231
public function toString(): string
232232
{

src/Illuminate/Validation/Concerns/ValidatesAttributes.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,6 @@ protected function isSameType($first, $second)
19181918
*
19191919
* @param string $attribute
19201920
* @param string $rule
1921-
*
19221921
* @return void
19231922
*/
19241923
protected function shouldBeNumeric($attribute, $rule)

src/Illuminate/Validation/Validator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ protected function shouldBeExcluded($attribute)
430430
* Remove the given attribute.
431431
*
432432
* @param string $attribute
433-
*
434433
* @return void
435434
*/
436435
protected function removeAttribute($attribute)

tests/Auth/AuthenticatableTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public function testItReturnsStringAsRememberTokenWhenItWasSetToTrue()
2323

2424
public function testItReturnsNullWhenRememberTokenNameWasSetToEmpty()
2525
{
26-
$user = new class extends User {
26+
$user = new class extends User
27+
{
2728
public function getRememberTokenName()
2829
{
2930
return '';

tests/Cache/CacheRepositoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ public function dataProviderTestGetSeconds()
223223

224224
/**
225225
* @dataProvider dataProviderTestGetSeconds
226+
*
226227
* @param mixed $duration
227228
*/
228229
public function testGetSeconds($duration)

tests/Console/CommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public function testCallingClassCommandResolveCommandViaApplicationResolution()
4949

5050
public function testGettingCommandArgumentsAndOptionsByClass()
5151
{
52-
$command = new class extends Command {
52+
$command = new class extends Command
53+
{
5354
public function handle()
5455
{
5556
}

tests/Database/DatabaseEloquentCollectionTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,17 +465,19 @@ public function testQueueableCollectionImplementationThrowsExceptionOnMultipleMo
465465
public function testQueueableRelationshipsReturnsOnlyRelationsCommonToAllModels()
466466
{
467467
// This is needed to prevent loading non-existing relationships on polymorphic model collections (#26126)
468-
$c = new Collection([new class {
468+
$c = new Collection([new class
469+
{
469470
public function getQueueableRelations()
470471
{
471472
return ['user'];
472473
}
473-
}, new class {
474+
}, new class
475+
{
474476
public function getQueueableRelations()
475477
{
476478
return ['user', 'comments'];
477479
}
478-
}]);
480+
}, ]);
479481

480482
$this->assertEquals(['user'], $c->getQueueableRelations());
481483
}

0 commit comments

Comments
 (0)