Skip to content

Commit e7c5ea8

Browse files
Fix phpstan when using simple-phpunit (#128)
1 parent 88ad832 commit e7c5ea8

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
}
3737
},
3838
"scripts": {
39-
"test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit",
39+
"test": "vendor/bin/simple-phpunit",
4040
"phpstan": "vendor/bin/phpstan analyse"
4141
}
4242
}

phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
parameters:
22
level: 5
3+
bootstrapFiles:
4+
- tests/bootstrap_phpstan.php
35
paths:
46
- src
57
- tests

tests/bootstrap_phpstan.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
$vendorBin = __DIR__.'/../vendor/bin';
4+
$path = $vendorBin.'/simple-phpunit';
5+
6+
if (!file_exists($vendorBin.'/phpunit') && file_exists($path)) {
7+
passthru(escapeshellarg(realpath($path)).' install');
8+
9+
$autoloader = $vendorBin.'/.phpunit/phpunit/vendor/autoload.php';
10+
if (file_exists($autoloader)) {
11+
require $autoloader;
12+
}
13+
}

0 commit comments

Comments
 (0)