Skip to content

A free open source IT asset/license management system

Small phpstan fixes

snipea147bb351ffb
diff --git a/app/Http/Controllers/CustomFieldsetsController.php b/app/Http/Controllers/CustomFieldsetsController.php
index abd8d4bb2d..b9d8a4790a 100644
--- a/app/Http/Controllers/CustomFieldsetsController.php
+++ b/app/Http/Controllers/CustomFieldsetsController.php
@@ -204,7 +204,7 @@ class CustomFieldsetsController extends Controller
}
}
- $results = $set->fields()->attach($request->input('field_id'), ['required' => ($request->input('required') == 'on'), 'order' => (int) $request->input('order', 1)]);
+ $set->fields()->attach($request->input('field_id'), ['required' => ($request->input('required') == 'on'), 'order' => (int) $request->input('order', 1)]);
return redirect()->route('fieldsets.show', [$id])->with('success', trans('admin/custom_fields/message.field.create.assoc_success'));
}
diff --git a/app/Models/Builders/ActionlogQueryBuilder.php b/app/Models/Builders/ActionlogQueryBuilder.php
index 8d46163d1c..2551d17e4c 100644
--- a/app/Models/Builders/ActionlogQueryBuilder.php
+++ b/app/Models/Builders/ActionlogQueryBuilder.php
@@ -206,11 +206,13 @@ class ActionlogQueryBuilder extends Builder
/**
* @param array{class: class-string, table: string, alias: string, nameExpr: string} $spec
*/
- private static function applyItemNameJoin(Builder $query, array $spec): Builder
+ private static function applyItemNameJoin(self $query, array $spec): self
{
- return $query->leftJoin($spec['table'].' as '.$spec['alias'], function ($join) use ($spec) {
+ $query->leftJoin($spec['table'].' as '.$spec['alias'], function ($join) use ($spec) {
$join->on('action_logs.item_id', '=', $spec['alias'].'.id')
->where('action_logs.item_type', '=', $spec['class']);
});
+
+ return $query;
}
}
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index 2788ac8422..1d96226db8 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -1110,30 +1110,6 @@ parameters:
count: 1
path: app/Http/Controllers/Api/CustomFieldsController.php
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'
- identifier: method.notFound
- count: 1
- path: app/Http/Controllers/Api/CustomFieldsController.php
-
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:detach\(\)\.$#'
- identifier: method.notFound
- count: 1
- path: app/Http/Controllers/Api/CustomFieldsController.php
-
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:sync\(\)\.$#'
- identifier: method.notFound
- count: 1
- path: app/Http/Controllers/Api/CustomFieldsController.php
-
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:sync\(\)\.$#'
- identifier: method.notFound
- count: 1
- path: app/Http/Controllers/Api/CustomFieldsetsController.php
-
-
message: '#^PHPDoc tag @return with type string is incompatible with native type array\.$#'
identifier: return.phpDocType
@@ -1980,24 +1956,6 @@ parameters:
count: 2
path: app/Http/Controllers/CustomFieldsetsController.php
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'
- identifier: method.notFound
- count: 1
- path: app/Http/Controllers/CustomFieldsetsController.php
-
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:sync\(\)\.$#'
- identifier: method.notFound
- count: 1
- path: app/Http/Controllers/CustomFieldsetsController.php
-
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:syncWithoutDetaching\(\)\.$#'
- identifier: method.notFound
- count: 2
- path: app/Http/Controllers/CustomFieldsetsController.php
-
-
message: '#^Variable \$field_ids might not be defined\.$#'
identifier: variable.undefined
@@ -3336,6 +3294,12 @@ parameters:
count: 2
path: app/Livewire/CheckoutTargetPanel.php
+ -
+ message: '#^Access to an undefined property App\\Models\\CustomField\:\:\$pivot\.$#'
+ identifier: property.notFound
+ count: 1
+ path: app/Livewire/CloneFieldset.php
+
-
message: '#^Access to an undefined property App\\Livewire\\CustomFieldEditor\:\:\$allowedElementKeys\.$#'
identifier: property.notFound
@@ -7638,12 +7602,6 @@ parameters:
count: 1
path: database/factories/CustomFieldsetFactory.php
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'
- identifier: method.notFound
- count: 5
- path: database/factories/CustomFieldsetFactory.php
-
-
message: '#^Call to an undefined method Faker\\Generator\:\:catchPhrase\(\)\.$#'
identifier: method.notFound
@@ -7752,12 +7710,6 @@ parameters:
count: 1
path: database/migrations/2015_07_29_230054_add_thread_id_to_asset_logs_table.php
- -
- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'
- identifier: method.notFound
- count: 1
- path: database/migrations/2015_09_22_003413_migrate_mac_address.php
-
-
message: '#^Result of static method Illuminate\\Support\\Facades\\Schema\:\:table\(\) \(void\) is used\.$#'
identifier: staticMethod.void