Skip to content

Commit 1760031

Browse files
authored
Merge pull request #1 from akondas/phpstan
Add phpstan
2 parents 12c5371 + b1676ad commit 1760031

File tree

5 files changed

+297
-6
lines changed

5 files changed

+297
-6
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ before_script:
1919

2020
script:
2121
- composer check-cs
22-
- vendor/bin/phpunit
22+
- composer phpstan
23+
- composer tests

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
},
1616
"require-dev": {
1717
"phpunit/phpunit": "^7.0",
18-
"symplify/easy-coding-standard": "^3.2"
18+
"symplify/easy-coding-standard": "^3.2",
19+
"phpstan/phpstan": "^0.10.3"
1920
},
2021
"autoload": {
2122
"psr-4": {
@@ -34,6 +35,7 @@
3435
],
3536
"fix-cs": "vendor/bin/ecs check src tests --fix --config=coding-standard.neon",
3637
"check-cs": "vendor/bin/ecs check src tests --config=coding-standard.neon",
38+
"phpstan": "vendor/bin/phpstan analyse src tests --level=max",
3739
"tests": "vendor/bin/phpunit"
3840
}
3941
}

composer.lock

Lines changed: 287 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Node/Peer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public function send(Message $message): void
2626

2727
public function host(): string
2828
{
29-
return parse_url($this->connection->getRemoteAddress(), PHP_URL_HOST);
29+
return parse_url((string) $this->connection->getRemoteAddress(), PHP_URL_HOST);
3030
}
3131

3232
public function port(): int
3333
{
34-
return parse_url($this->connection->getRemoteAddress(), PHP_URL_PORT);
34+
return parse_url((string) $this->connection->getRemoteAddress(), PHP_URL_PORT);
3535
}
3636

3737
/**

tests/NodeTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ final class NodeTest extends TestCase
1717

1818
public function setUp(): void
1919
{
20+
/** @var P2pServer $p2pServer */
21+
$p2pServer = $this->createMock(P2pServer::class);
2022
$this->node = new Node(
2123
new Miner(new Blockchain(Block::genesis()), new ZeroPrefix()),
22-
$this->createMock(P2pServer::class)
24+
$p2pServer
2325
);
2426
}
2527

0 commit comments

Comments
 (0)