Skip to content

Commit

Permalink
Make phpstan happy again
Browse files Browse the repository at this point in the history
  • Loading branch information
dinamic committed Jul 15, 2024
1 parent 6c3c74c commit 60bf909
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Testcontainer\Wait\WaitInterface;

/**
* @phpstan-type ContainerInspect array{0: array{NetworkSettings: array{IPAddress: string}}}
* @phpstan-type ContainerInspect array<int, array{'NetworkSettings': array{'IPAddress': string}}>
*/
class Container
{
Expand Down Expand Up @@ -256,10 +256,11 @@ public function logs(): string

public function getAddress(): string
{
if ($this->network !== null && !empty($this->inspectedData[0]['NetworkSettings']['Networks'][$this->network]['IPAddress'])) {
return $this->inspectedData[0]['NetworkSettings']['Networks'][$this->network]['IPAddress'];
if (! is_string($this->network)) {
return $this->inspectedData[0]['NetworkSettings']['IPAddress'];
}

return $this->inspectedData[0]['NetworkSettings']['IPAddress'];
return $this->inspectedData[0]['NetworkSettings']['Networks'][$this->network]['IPAddress']

Check failure on line 263 in src/Container/Container.php

View workflow job for this annotation

GitHub Actions / build

Offset 'Networks' on array{IPAddress: string} on left side of ?? does not exist.
?? $this->inspectedData[0]['NetworkSettings']['IPAddress'];
}
}

0 comments on commit 60bf909

Please sign in to comment.