PHPStan fixes (#13038)

* PHPStan fixes
mostly type fixes
semi-risky changes in availability map widget, tested a bit

* fix style

* Style fix

* restore spaces stupid editor removed

* fix the rest

* device model back

* remove ignores

* introduce variable
This commit is contained in:
Tony Murray
2021-07-13 16:35:43 -05:00
committed by GitHub
parent c563efd284
commit 58ca5994a1
61 changed files with 323 additions and 441 deletions

View File

@@ -3,6 +3,8 @@
namespace Database\Factories;
use App\Models\Ipv4Address;
use App\Models\Ipv4Network;
use App\Models\Port;
use Illuminate\Database\Eloquent\Factories\Factory;
use LibreNMS\Util\IPv4;
@@ -29,10 +31,14 @@ class Ipv4AddressFactory extends Factory
'ipv4_address' => $ip->uncompressed(),
'ipv4_prefixlen' => $prefix,
'port_id' => function () {
return \App\Models\Port::factory()->create()->port_id;
$port = Port::factory()->create(); /** @var Port $port */
return $port->port_id;
},
'ipv4_network_id' => function () use ($ip) {
return \App\Models\Ipv4Network::factory()->create(['ipv4_network' => $ip->getNetworkAddress() . '/' . $ip->cidr])->ipv4_network_id;
$ipv4 = Ipv4Network::factory()->create(['ipv4_network' => $ip->getNetworkAddress() . '/' . $ip->cidr]); /** @var Ipv4Address $ipv4 */
return $ipv4->ipv4_network_id;
},
];
}