Skip to content

Commit a7370f6

Browse files
authored
Fix phpstan errors (php-pm#410)
* Add linting stage * Fix phpstan errors
1 parent fd4e13c commit a7370f6

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

.phpstan.neon

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
- '#Result of method React\\Socket\\ServerInterface::close\(\) \(void\) is used#'
4-
- '#Call to an undefined static method Symfony\\Component\\Process\\ProcessUtils::escapeArgument\(\)#'
3+
- '#Call to an undefined static method Symfony\\Component\\Process\\ProcessUtils::escapeArgument\(\)#'
4+
- '#Binary operation#'
5+
- '#Call to function method_exists.. with ...Symfony..Component#'

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ jobs:
3535
php: 7.1
3636
install:
3737
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
38-
- composer require "phpstan/phpstan:^0.9" "friendsofphp/php-cs-fixer:^2.8"
38+
- composer require "phpstan/phpstan" "friendsofphp/php-cs-fixer:^2.8"
3939
script:
4040
# Static analyzer check
4141
- ./vendor/bin/phpstan analyze -c .phpstan.neon --level=4 --no-progress src
4242
# Check the code style
4343
- IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS
44-
- ./vendor/bin/php-cs-fixer fix --config=.php_cs.php -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}"
44+
- ./vendor/bin/php-cs-fixer fix --config=.php_cs.php -v --dry-run --diff --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}"
4545

4646
# Cache package sources
4747
cache:

src/ProcessManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ProcessManager
4747
protected $status = self::STATE_STARTING;
4848

4949
/**
50-
* @var LoopInterface
50+
* @var LoopInterface|null
5151
*/
5252
protected $loop;
5353

@@ -81,12 +81,12 @@ class ProcessManager
8181
protected $controllerHost;
8282

8383
/**
84-
* @var ServerInterface
84+
* @var ServerInterface|null
8585
*/
8686
protected $controller;
8787

8888
/**
89-
* @var ServerInterface
89+
* @var ServerInterface|null
9090
*/
9191
protected $web;
9292

@@ -1165,7 +1165,7 @@ protected function newSlaveInstance($port)
11651165
// we can not use -q since this disables basically all header support
11661166
// but since this is necessary at least in Symfony we can not use it.
11671167
// e.g. headers_sent() returns always true, although wrong.
1168-
//For version 2.x and 3.x of \Symfony\Component\Process\Process package
1168+
// For version 2.x and 3.x of \Symfony\Component\Process\Process package
11691169
if (method_exists('\Symfony\Component\Process\ProcessUtils', 'escapeArgument')) {
11701170
$commandline = 'exec ' . $this->phpCgiExecutable . ' -C ' . ProcessUtils::escapeArgument($file);
11711171
} else {

src/ProcessSlave.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ class ProcessSlave
3434
/**
3535
* The HTTP Server.
3636
*
37-
* @var ServerInterface
37+
* @var ServerInterface|null
3838
*/
3939
protected $server;
4040

4141
/**
42-
* @var LoopInterface
42+
* @var LoopInterface|null
4343
*/
4444
protected $loop;
4545

4646
/**
4747
* ProcessManager master process connection
4848
*
49-
* @var ConnectionInterface
49+
* @var ConnectionInterface|null
5050
*/
5151
protected $controller;
5252

@@ -83,7 +83,7 @@ class ProcessSlave
8383
protected $inShutdown = false;
8484

8585
/**
86-
* @var BufferingLogger|\Symfony\Component\Debug\BufferingLogger
86+
* @var BufferingLogger|\Symfony\Component\Debug\BufferingLogger|null
8787
*/
8888
protected $errorLogger;
8989

@@ -215,7 +215,7 @@ protected function getStaticDirectory()
215215
}
216216

217217
/**
218-
* @return BridgeInterface
218+
* @return BridgeInterface|null
219219
*/
220220
protected function getBridge()
221221
{

src/RequestHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RequestHandler
2323
private $incoming;
2424

2525
/**
26-
* @var ConnectionInterface
26+
* @var ConnectionInterface|null
2727
*/
2828
private $connection;
2929

src/Slave.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class Slave
4242

4343
private $process;
4444
private $pid;
45+
46+
/**
47+
* @var ConnectionInterface
48+
*/
4549
private $connection; // slave incoming
4650

4751
/**
@@ -208,7 +212,7 @@ public function getPort()
208212
/**
209213
* Get slave incoming connection
210214
*
211-
* @return ConnectionInterface slave connection
215+
* @return ConnectionInterface|null slave connection
212216
*/
213217
public function getConnection()
214218
{

0 commit comments

Comments
 (0)