Skip to content

Commit 73e710f

Browse files
authored
Add type hint comment for relation call in sync method (#1036)
1 parent f20cf3e commit 73e710f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/Auditable.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -711,17 +711,17 @@ public function auditDetach(string $relationName, $ids = null, $touch = true, $c
711711
}
712712

713713
$old = $relationCall->get($columns);
714-
714+
715715
$pivotClass = $relationCall->getPivotClass();
716-
716+
717717
if ($pivotClass !== Pivot::class && is_a($pivotClass, ContractsAuditable::class, true)) {
718718
$results = $pivotClass::withoutAuditing(function () use ($relationCall, $ids, $touch) {
719719
return $relationCall->detach($ids, $touch);
720720
});
721721
} else {
722722
$results = $relationCall->detach($ids, $touch);
723723
}
724-
724+
725725
$new = $relationCall->get($columns);
726726

727727
$this->dispatchRelationAuditEvent($relationName, 'detach', $old, $new);
@@ -742,16 +742,17 @@ public function auditSync(string $relationName, $ids, $detaching = true, $column
742742
{
743743
$this->validateRelationshipMethodExistence($relationName, 'sync');
744744

745+
/** @var BelongsToMany<Model, $this>|\Illuminate\Database\Eloquent\Relations\MorphToMany<Model, $this> $relationCall */
745746
$relationCall = $this->{$relationName}();
746747

747748
if ($callback instanceof \Closure) {
748749
$this->applyClosureToRelationship($relationCall, $callback);
749750
}
750751

751752
$old = $relationCall->get($columns);
752-
753+
753754
$pivotClass = $relationCall->getPivotClass();
754-
755+
755756
if ($pivotClass !== Pivot::class && is_a($pivotClass, ContractsAuditable::class, true)) {
756757
$changes = $pivotClass::withoutAuditing(function () use ($relationCall, $ids, $detaching) {
757758
return $relationCall->sync($ids, $detaching);

src/Resolvers/UrlResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function resolve(Auditable $auditable): string
2525
public static function resolveCommandLine(): string
2626
{
2727
$command = Request::server('argv', null);
28-
if (is_array($command)) { // @phpstan-ignore function.impossibleType
28+
if (is_array($command)) {
2929
return implode(' ', $command);
3030
}
3131

0 commit comments

Comments
 (0)