Skip to content

Commit 4c5d4d5

Browse files
authored
Remove unused catch exception variables (#48209)
1 parent dda17ec commit 4c5d4d5

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

src/Illuminate/Bus/DatabaseBatchRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ protected function unserialize($serialized)
342342

343343
try {
344344
return unserialize($serialized);
345-
} catch (ModelNotFoundException $e) {
345+
} catch (ModelNotFoundException) {
346346
return [];
347347
}
348348
}

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ public function createOrFirst(array $attributes = [], array $values = [])
581581
{
582582
try {
583583
return $this->withSavepointIfNeeded(fn () => $this->create(array_merge($attributes, $values)));
584-
} catch (UniqueConstraintViolationException $exception) {
584+
} catch (UniqueConstraintViolationException) {
585585
return $this->useWritePdo()->where($attributes)->first();
586586
}
587587
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ public function firstOrCreate(array $attributes = [], array $values = [], array
626626
} else {
627627
try {
628628
$this->getQuery()->withSavepointIfNeeded(fn () => $this->attach($instance, $joining, $touch));
629-
} catch (UniqueConstraintViolationException $exception) {
629+
} catch (UniqueConstraintViolationException) {
630630
// Nothing to do, the model was already attached...
631631
}
632632
}
@@ -656,7 +656,7 @@ public function createOrFirst(array $attributes = [], array $values = [], array
656656
return tap($this->related->where($attributes)->first(), function ($instance) use ($joining, $touch) {
657657
$this->getQuery()->withSavepointIfNeeded(fn () => $this->attach($instance, $joining, $touch));
658658
});
659-
} catch (UniqueConstraintViolationException $exception) {
659+
} catch (UniqueConstraintViolationException) {
660660
return (clone $this)->useWritePdo()->where($attributes)->first();
661661
}
662662
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function createOrFirst(array $attributes = [], array $values = [])
253253
{
254254
try {
255255
return $this->getQuery()->withSavepointIfNeeded(fn () => $this->create(array_merge($attributes, $values)));
256-
} catch (UniqueConstraintViolationException $exception) {
256+
} catch (UniqueConstraintViolationException) {
257257
return $this->useWritePdo()->where($attributes)->first();
258258
}
259259
}

src/Illuminate/Foundation/Exceptions/Handler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ protected function reportThrowable(Throwable $e): void
273273

274274
try {
275275
$logger = $this->container->make(LoggerInterface::class);
276-
} catch (Exception $ex) {
276+
} catch (Exception) {
277277
throw $e;
278278
}
279279

@@ -370,7 +370,7 @@ protected function context()
370370
return array_filter([
371371
'userId' => Auth::id(),
372372
]);
373-
} catch (Throwable $e) {
373+
} catch (Throwable) {
374374
return [];
375375
}
376376
}

src/Illuminate/Routing/CompiledRouteCollection.php

Lines changed: 1 addition & 1 deletion
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) {
125125
try {
126126
return $this->routes->match($request);
127127
} catch (NotFoundHttpException) {

tests/Database/DatabaseEloquentIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ public function testNestedTransactionsUsingSaveOrFailWillSucceed()
14601460
try {
14611461
$user->email = '[email protected]';
14621462
$user->saveOrFail();
1463-
} catch (Exception $e) {
1463+
} catch (Exception) {
14641464
// ignore the exception
14651465
}
14661466

0 commit comments

Comments
 (0)