From e873768845d8c4954a98ff06b991d67fcaaab85c Mon Sep 17 00:00:00 2001 From: Jellyfrog Date: Mon, 26 Jul 2021 16:00:34 +0200 Subject: [PATCH] Bump larastan (#13071) * Bump larastan * Use php7.4 for lint test --- .github/workflows/lint.yml | 2 +- LibreNMS/IRCBot.php | 2 +- LibreNMS/Util/ModuleTestHelper.php | 2 +- app/Models/Notification.php | 14 -------------- composer.json | 2 +- composer.lock | 16 ++++++++-------- database/factories/AlertScheduleFactory.php | 1 + database/factories/BgpPeerFactory.php | 1 + database/factories/BillFactory.php | 1 + database/factories/ComponentFactory.php | 1 + database/factories/DeviceFactory.php | 1 + database/factories/DeviceGroupFactory.php | 1 + database/factories/Ipv4AddressFactory.php | 1 + database/factories/Ipv4NetworkFactory.php | 1 + database/factories/LocationFactory.php | 1 + database/factories/OspfNbrFactory.php | 1 + database/factories/OspfPortFactory.php | 1 + database/factories/PortFactory.php | 1 + database/factories/SensorFactory.php | 1 + database/factories/SyslogFactory.php | 1 + database/factories/UserFactory.php | 1 + database/factories/VminfoFactory.php | 1 + phpstan-baseline.neon | 8 ++++---- 23 files changed, 32 insertions(+), 30 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8d990b41e3..4936a90c70 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -39,7 +39,7 @@ jobs: name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 7.4 tools: composer - diff --git a/LibreNMS/IRCBot.php b/LibreNMS/IRCBot.php index de8447a9ed..c06bbb0b14 100644 --- a/LibreNMS/IRCBot.php +++ b/LibreNMS/IRCBot.php @@ -443,7 +443,7 @@ class IRCBot private function handleCommand() { $this->command = str_replace(':.', '', $this->command); - $tmp = explode(':.' . $this->command . ' ', $this->data); /* @phpstan-ignore-line */ + $tmp = explode(':.' . $this->command . ' ', $this->data); $this->user = $this->getAuthdUser(); $this->log('isAuthd-1? ' . $this->isAuthd()); if (! $this->isAuthd() && (isset($this->config['irc_auth']))) { diff --git a/LibreNMS/Util/ModuleTestHelper.php b/LibreNMS/Util/ModuleTestHelper.php index 14d019ddef..e7452af6f4 100644 --- a/LibreNMS/Util/ModuleTestHelper.php +++ b/LibreNMS/Util/ModuleTestHelper.php @@ -651,7 +651,7 @@ class ModuleTestHelper $module_output = []; $module_start = "#### Load $type module "; $module_end = "#### Unload $type module %s ####"; - $parts = explode($module_start, $output); /* @phpstan-ignore-line */ + $parts = explode($module_start, $output); array_shift($parts); // throw away first part of output foreach ($parts as $part) { // find the module name diff --git a/app/Models/Notification.php b/app/Models/Notification.php index c4578f8e35..54a1a1bb1f 100644 --- a/app/Models/Notification.php +++ b/app/Models/Notification.php @@ -101,20 +101,6 @@ class Notification extends Model ->where(['notifications_attribs.key' => 'sticky', 'notifications_attribs.value' => 1]); } - /** - * @param Builder $query - * @param User $user - * @return mixed - */ - public function scopeIsArchived(Builder $query, User $user) - { - return $query->leftJoin('notifications_attribs', 'notifications.notifications_id', '=', 'notifications_attribs.notifications_id') - ->source() - ->where('notifications_attribs.user_id', $user->user_id) - ->where(['key' => 'read', 'value' => 1]) - ->limit(1); - } - /** * @param Builder $query * @return Builder diff --git a/composer.json b/composer.json index 0256a799d6..a0f82fd8d2 100644 --- a/composer.json +++ b/composer.json @@ -70,7 +70,7 @@ "laravel/dusk": "^6.15", "mockery/mockery": "^1.4.2", "nunomaduro/collision": "^5.0", - "nunomaduro/larastan": "^0.7.4", + "nunomaduro/larastan": "^0.7.12", "php-parallel-lint/php-parallel-lint": "^1.1", "phpstan/phpstan-mockery": "^0.12.13", "phpunit/phpunit": "^9.3.3", diff --git a/composer.lock b/composer.lock index b66259afb5..09d2a5929a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dae39e5a41421453723b043a8a321e35", + "content-hash": "20641974e2977b85a492b8cd89fd0fac", "packages": [ { "name": "amenadiel/jpgraph", @@ -8688,16 +8688,16 @@ }, { "name": "nunomaduro/larastan", - "version": "v0.7.10", + "version": "v0.7.12", "source": { "type": "git", "url": "https://github.com/nunomaduro/larastan.git", - "reference": "d684efa6f79ff34f3a516efa9db532c861438718" + "reference": "b2da312efe88d501aeeb867ba857e8c4198d43c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/larastan/zipball/d684efa6f79ff34f3a516efa9db532c861438718", - "reference": "d684efa6f79ff34f3a516efa9db532c861438718", + "url": "https://api.github.com/repos/nunomaduro/larastan/zipball/b2da312efe88d501aeeb867ba857e8c4198d43c0", + "reference": "b2da312efe88d501aeeb867ba857e8c4198d43c0", "shasum": "" }, "require": { @@ -8713,7 +8713,7 @@ "mockery/mockery": "^0.9 || ^1.0", "php": "^7.2 || ^8.0", "phpstan/phpstan": "^0.12.90", - "symfony/process": "^4.3 || ^5.0" + "symfony/process": "^4.3 || ^5.0 || ^6.0" }, "require-dev": { "orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0", @@ -8761,7 +8761,7 @@ ], "support": { "issues": "https://github.com/nunomaduro/larastan/issues", - "source": "https://github.com/nunomaduro/larastan/tree/v0.7.10" + "source": "https://github.com/nunomaduro/larastan/tree/v0.7.12" }, "funding": [ { @@ -8781,7 +8781,7 @@ "type": "patreon" } ], - "time": "2021-07-07T12:13:19+00:00" + "time": "2021-07-26T12:12:39+00:00" }, { "name": "phar-io/manifest", diff --git a/database/factories/AlertScheduleFactory.php b/database/factories/AlertScheduleFactory.php index dccb9a50a7..7f8c9c581f 100644 --- a/database/factories/AlertScheduleFactory.php +++ b/database/factories/AlertScheduleFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\AlertSchedule; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class AlertScheduleFactory extends Factory { /** diff --git a/database/factories/BgpPeerFactory.php b/database/factories/BgpPeerFactory.php index be6fb336a5..f986f66493 100644 --- a/database/factories/BgpPeerFactory.php +++ b/database/factories/BgpPeerFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\BgpPeer; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class BgpPeerFactory extends Factory { /** diff --git a/database/factories/BillFactory.php b/database/factories/BillFactory.php index d7b348ec99..ed13ed0128 100644 --- a/database/factories/BillFactory.php +++ b/database/factories/BillFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\Bill; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class BillFactory extends Factory { /** diff --git a/database/factories/ComponentFactory.php b/database/factories/ComponentFactory.php index 286c3daf84..613a3b0b57 100644 --- a/database/factories/ComponentFactory.php +++ b/database/factories/ComponentFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\Component; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class ComponentFactory extends Factory { /** diff --git a/database/factories/DeviceFactory.php b/database/factories/DeviceFactory.php index 5207b2c8c4..4fe0e080bf 100644 --- a/database/factories/DeviceFactory.php +++ b/database/factories/DeviceFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\Device; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class DeviceFactory extends Factory { /** diff --git a/database/factories/DeviceGroupFactory.php b/database/factories/DeviceGroupFactory.php index e9802b71ae..6d3deb7e3f 100644 --- a/database/factories/DeviceGroupFactory.php +++ b/database/factories/DeviceGroupFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\DeviceGroup; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class DeviceGroupFactory extends Factory { /** diff --git a/database/factories/Ipv4AddressFactory.php b/database/factories/Ipv4AddressFactory.php index d6360ce454..1c0545f79e 100644 --- a/database/factories/Ipv4AddressFactory.php +++ b/database/factories/Ipv4AddressFactory.php @@ -8,6 +8,7 @@ use App\Models\Port; use Illuminate\Database\Eloquent\Factories\Factory; use LibreNMS\Util\IPv4; +/** @extends Factory */ class Ipv4AddressFactory extends Factory { /** diff --git a/database/factories/Ipv4NetworkFactory.php b/database/factories/Ipv4NetworkFactory.php index 25c4fc1279..f309558aeb 100644 --- a/database/factories/Ipv4NetworkFactory.php +++ b/database/factories/Ipv4NetworkFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\Ipv4Network; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class Ipv4NetworkFactory extends Factory { /** diff --git a/database/factories/LocationFactory.php b/database/factories/LocationFactory.php index ca0e146649..616eae4690 100644 --- a/database/factories/LocationFactory.php +++ b/database/factories/LocationFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\Location; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class LocationFactory extends Factory { /** diff --git a/database/factories/OspfNbrFactory.php b/database/factories/OspfNbrFactory.php index 2a8a0f1326..d054765b9c 100644 --- a/database/factories/OspfNbrFactory.php +++ b/database/factories/OspfNbrFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\OspfNbr; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class OspfNbrFactory extends Factory { /** diff --git a/database/factories/OspfPortFactory.php b/database/factories/OspfPortFactory.php index 64951d4c65..1cb1ff7582 100644 --- a/database/factories/OspfPortFactory.php +++ b/database/factories/OspfPortFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\OspfPort; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class OspfPortFactory extends Factory { /** diff --git a/database/factories/PortFactory.php b/database/factories/PortFactory.php index 586a5be235..8bba393dd4 100644 --- a/database/factories/PortFactory.php +++ b/database/factories/PortFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\Port; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class PortFactory extends Factory { /** diff --git a/database/factories/SensorFactory.php b/database/factories/SensorFactory.php index 01c19690d7..6d15fdfb3e 100644 --- a/database/factories/SensorFactory.php +++ b/database/factories/SensorFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\Sensor; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class SensorFactory extends Factory { /** diff --git a/database/factories/SyslogFactory.php b/database/factories/SyslogFactory.php index 0de526349b..4d7d40c1bc 100644 --- a/database/factories/SyslogFactory.php +++ b/database/factories/SyslogFactory.php @@ -6,6 +6,7 @@ use App\Models\Syslog; use Carbon\Carbon; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class SyslogFactory extends Factory { /** diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index a0b4451530..a415c8370a 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -5,6 +5,7 @@ namespace Database\Factories; use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; +/** @extends Factory */ class UserFactory extends Factory { /** diff --git a/database/factories/VminfoFactory.php b/database/factories/VminfoFactory.php index 0ac819bbd3..7655d9f1a6 100644 --- a/database/factories/VminfoFactory.php +++ b/database/factories/VminfoFactory.php @@ -6,6 +6,7 @@ use App\Models\Vminfo; use Illuminate\Database\Eloquent\Factories\Factory; use LibreNMS\Enum\PowerState; +/** @extends Factory */ class VminfoFactory extends Factory { /** diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 7dd2e5a348..92964f43a0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -16,12 +16,12 @@ parameters: path: LibreNMS/Alerting/QueryBuilderParser.php - - message: "#^Parameter \\#1 \\$ldap of function ldap_error expects resource, false given\\.$#" + message: "#^Parameter \\#1 \\$link_identifier of function ldap_error expects resource, false given\\.$#" count: 1 path: LibreNMS/Authentication/ADAuthorizationAuthorizer.php - - message: "#^Parameter \\#1 \\$ldap of function ldap_error expects resource, false given\\.$#" + message: "#^Parameter \\#1 \\$link_identifier of function ldap_error expects resource, false given\\.$#" count: 1 path: LibreNMS/Authentication/LdapAuthorizationAuthorizer.php @@ -46,12 +46,12 @@ parameters: path: LibreNMS/Authentication/SSOAuthorizer.php - - message: "#^Parameter \\#1 \\$num of function base_convert expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$input of function str_pad expects string, int given\\.$#" count: 1 path: LibreNMS/Authentication/TwoFactor.php - - message: "#^Parameter \\#1 \\$string of function str_pad expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$number of function base_convert expects string, int given\\.$#" count: 1 path: LibreNMS/Authentication/TwoFactor.php