Skip to content

Commit

Permalink
feat: upgrade phpstan to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
EJTJ3 committed Nov 12, 2024
1 parent 6fdbaf6 commit 417cf8e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 15 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
"phpunit/phpunit": "^9.0",
"phpstan/phpstan": "^2.0"
},
"scripts": {
"test": "vendor/bin/phpunit"
Expand Down
4 changes: 1 addition & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
parameters:
level: 7 # 0 - loose, 8 - strict
level: 9
paths:
- src
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
2 changes: 1 addition & 1 deletion src/Connection/ClientConnectionOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function setName(?string $name): void
$this->name = $name;
}

public function getProtocol(): ?int
public function getProtocol(): int
{
return $this->protocol;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Connection/Msg.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
final class Msg implements MessageInterface
{
/**
* @var string|null the message payload data
* @var string the message payload data
*/
private ?string $payload;
private string $payload;

private function __construct(
// subject name this message was received on - always
Expand Down
2 changes: 1 addition & 1 deletion src/Connection/NatsConnectionOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
return $server;
}

if (is_string($server) && StringUtil::isEmpty($server) === false) {
if (StringUtil::isEmpty($server) === false) {
return new Server($server);
}

Expand Down
4 changes: 0 additions & 4 deletions src/Connection/ServerCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ public function __construct(array $servers, bool $randomize = false)
}

foreach ($servers as $server) {
if (!$server instanceof Server) {
throw new InvalidArgumentException(sprintf('Servers must be of type %s.', Server::class));
}

$this->addServer($server);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Connection/ServerInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ public function getVersion(): string
return $this->version;
}

public function isTlsRequired(): ?bool
public function isTlsRequired(): bool
{
return $this->tlsRequired;
}

public function isTlsVerified(): ?bool
public function isTlsVerified(): bool
{
return $this->tlsVerify;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Logger/NullLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

use Psr\Log\AbstractLogger;
use Psr\Log\LoggerInterface;
use Stringable;

final class NullLogger extends AbstractLogger implements LoggerInterface
{
public function log($level, string|\Stringable $message, array $context = []): void
public function log($level, string|Stringable $message, array $context = []): void
{
}
}

0 comments on commit 417cf8e

Please sign in to comment.