Skip to content

Commit

Permalink
Update to PHPStan 2.0, fix all issues
Browse files Browse the repository at this point in the history
  • Loading branch information
omnicolor committed Dec 28, 2024
1 parent 952ec5f commit 3ebfd57
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.phpunit.cache/
.php-cs-fixer.cache
.phpunit.cache/
phpstan.neon
vendor/
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.17",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-phpunit": "^1.3.3",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^11.0"
},
"scripts": {
Expand Down
35 changes: 17 additions & 18 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions phpstan.neon → phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ parameters:
paths:
- %currentWorkingDirectory%/src
- %currentWorkingDirectory%/tests
treatPhpDocTypesAsCertain: false
14 changes: 2 additions & 12 deletions src/IrcChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class IrcChannel
{
private ?string $topic;
private string $topic = '';

/** @var array<int, string> */
private array $users = [];
Expand All @@ -31,18 +31,12 @@ public function __construct(private string $name)
}
}

/**
* Fetch the name of the channel, including the `#`.
*/
public function getName(): string
{
return $this->name;
}

/**
* Get the current channel topic.
*/
public function getTopic(): ?string
public function getTopic(): string
{
return $this->topic;
}
Expand All @@ -56,10 +50,6 @@ public function getUsers(): array
return $this->users;
}

/**
* Set the current channel topic.
* @param string $topic The topic
*/
public function setTopic(string $topic): void
{
$this->topic = $topic;
Expand Down
1 change: 0 additions & 1 deletion tests/IrcMessageParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public function testMotd(): void
foreach ($this->parser->parse($message) as $parsed) {
$count++;
self::assertInstanceOf(MOTDMessage::class, $parsed);
self::assertInstanceOf(IrcMessage::class, $parsed);
}
self::assertSame(9, $count);
}
Expand Down

0 comments on commit 3ebfd57

Please sign in to comment.