Skip to content

Commit

Permalink
Remove unused catch exception variables (#48209)
Browse files Browse the repository at this point in the history
  • Loading branch information
osbre authored Aug 27, 2023
1 parent dda17ec commit 4c5d4d5
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Bus/DatabaseBatchRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ protected function unserialize($serialized)

try {
return unserialize($serialized);
} catch (ModelNotFoundException $e) {
} catch (ModelNotFoundException) {
return [];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ public function createOrFirst(array $attributes = [], array $values = [])
{
try {
return $this->withSavepointIfNeeded(fn () => $this->create(array_merge($attributes, $values)));
} catch (UniqueConstraintViolationException $exception) {
} catch (UniqueConstraintViolationException) {
return $this->useWritePdo()->where($attributes)->first();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ public function firstOrCreate(array $attributes = [], array $values = [], array
} else {
try {
$this->getQuery()->withSavepointIfNeeded(fn () => $this->attach($instance, $joining, $touch));
} catch (UniqueConstraintViolationException $exception) {
} catch (UniqueConstraintViolationException) {
// Nothing to do, the model was already attached...
}
}
Expand Down Expand Up @@ -656,7 +656,7 @@ public function createOrFirst(array $attributes = [], array $values = [], array
return tap($this->related->where($attributes)->first(), function ($instance) use ($joining, $touch) {
$this->getQuery()->withSavepointIfNeeded(fn () => $this->attach($instance, $joining, $touch));
});
} catch (UniqueConstraintViolationException $exception) {
} catch (UniqueConstraintViolationException) {
return (clone $this)->useWritePdo()->where($attributes)->first();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function createOrFirst(array $attributes = [], array $values = [])
{
try {
return $this->getQuery()->withSavepointIfNeeded(fn () => $this->create(array_merge($attributes, $values)));
} catch (UniqueConstraintViolationException $exception) {
} catch (UniqueConstraintViolationException) {
return $this->useWritePdo()->where($attributes)->first();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected function reportThrowable(Throwable $e): void

try {
$logger = $this->container->make(LoggerInterface::class);
} catch (Exception $ex) {
} catch (Exception) {
throw $e;
}

Expand Down Expand Up @@ -370,7 +370,7 @@ protected function context()
return array_filter([
'userId' => Auth::id(),
]);
} catch (Throwable $e) {
} catch (Throwable) {
return [];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/CompiledRouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
try {
return $this->routes->match($request);
} catch (NotFoundHttpException) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseEloquentIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ public function testNestedTransactionsUsingSaveOrFailWillSucceed()
try {
$user->email = '[email protected]';
$user->saveOrFail();
} catch (Exception $e) {
} catch (Exception) {
// ignore the exception
}

Expand Down

0 comments on commit 4c5d4d5

Please sign in to comment.