Skip to content

Commit

Permalink
fix naming of variable in discardedAttributeViolationReporter
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-tricks authored Jan 7, 2024
1 parent 38718d2 commit 492f114
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Sentry/Laravel/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ public function __construct(?callable $callback)

public function __invoke(Model $model, array $attributes): void
{
$attributes = implode(', ', $attributes);
SentrySdk::getCurrentHub()->withScope(function (Scope $scope) use ($model, $attributes) {
$attributes_imploded = implode(', ', $attributes);
SentrySdk::getCurrentHub()->withScope(function (Scope $scope) use ($model, $attributes_imploded) {
$scope->setContext('violation', [
'model' => get_class($model),
'attributes' => $attributes,
'attributes' => $attributes_imploded,
'origin' => $this->resolveEventOrigin(),
'kind' => 'discarded_attributes',
]);
Expand All @@ -308,7 +308,7 @@ public function __invoke(Model $model, array $attributes): void
EventHint::fromArray([
'exception' => new MassAssignmentException(sprintf(

Check failure on line 309 in src/Sentry/Laravel/Integration.php

View workflow job for this annotation

GitHub Actions / PHPStan

Instantiated class Illuminate\Database\MassAssignmentException not found.
'Add fillable property [%s] to allow mass assignment on [%s].',
$attributes,
$attributes_imploded,
get_class($model)
)),
'mechanism' => new ExceptionMechanism(ExceptionMechanism::TYPE_GENERIC, true),
Expand All @@ -318,7 +318,7 @@ public function __invoke(Model $model, array $attributes): void

// Forward the violation to the next handler if there is one
if ($this->callback !== null) {
call_user_func($this->callback, $model, $attribute);
call_user_func($this->callback, $model, $attributes);
}
}
};
Expand Down

0 comments on commit 492f114

Please sign in to comment.