Skip to content

Commit acd0976

Browse files
committed
PHPStan: introduce static analysis
1 parent 53e3430 commit acd0976

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
"php": "^7.1"
1515
},
1616
"require-dev": {
17+
"phpstan/phpstan": "^0.9.1",
18+
"phpstan/phpstan-phpunit": "^0.9.3",
1719
"phpunit/phpunit": "^6.5",
1820
"roave/security-advisories": "dev-master",
1921
"slam/php-cs-fixer-extensions": "^1.12",
2022
"slam/php-debug-r": "^1.2",
21-
"symfony/console": "^4.0"
23+
"slam/phpstan-extensions": "^1.0",
24+
"symfony/console": "^4.0",
25+
"thecodingmachine/phpstan-strict-rules": "^0.9.0"
2226
},
2327
"autoload": {
2428
"psr-4": {

phpstan.neon

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
includes:
2+
- vendor/phpstan/phpstan/conf/config.levelmax.neon
3+
- vendor/phpstan/phpstan-phpunit/extension.neon
4+
- vendor/slam/phpstan-extensions/conf/slam-rules.neon
5+
- vendor/slam/phpstan-extensions/conf/thecodingmachine-rules.neon
6+
7+
parameters:
8+
ignoreErrors:
9+
- '#Class Doctrine\\Common\\Util\\Debug not found#'
10+
- '#Call to static method export\(\) on an unknown class Doctrine\\Common\\Util\\Debug#'
11+
- '#Constant ROOT_PATH not found#'

tests/ErrorHandlerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ final class ErrorHandlerTest extends TestCase
1313
{
1414
private $backupErrorLog;
1515
private $errorLog;
16+
private $exception;
17+
private $emailsSent;
18+
private $errorHandler;
1619

1720
protected function setUp()
1821
{
@@ -104,7 +107,7 @@ public function testScream()
104107

105108
$warningMessage = \uniqid('warning_');
106109
$this->expectException(ErrorException::class);
107-
$this->expectExceptionMessageRegexp(\sprintf('/%s/', \preg_quote($warningMessage)));
110+
$this->expectExceptionMessageRegExp(\sprintf('/%s/', \preg_quote($warningMessage)));
108111

109112
@ \trigger_error($warningMessage, \E_USER_WARNING);
110113
}

0 commit comments

Comments
 (0)