Skip to content

Commit e3c0ef8

Browse files
committed
build: add phan
Change-Id: I494dff2cb8f0dfc92001deff30e69847591108ba
1 parent a06a1e5 commit e3c0ef8

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

.phan/config.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config-library.php';
4+
5+
$cfg['directory_list'][] = 'tests';
6+
7+
return $cfg;

composer.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
},
3333
"require-dev": {
3434
"mediawiki/mediawiki-codesniffer": "41.0.0",
35+
"mediawiki/mediawiki-phan-config": "0.12.1",
3536
"mediawiki/minus-x": "1.1.1",
3637
"ockcyp/covers-validator": "1.6.0",
3738
"php-parallel-lint/php-console-highlighter": "1.0.0",
@@ -40,12 +41,18 @@
4041
},
4142
"scripts": {
4243
"test": [
43-
"parallel-lint . --exclude vendor",
44-
"phpunit",
45-
"covers-validator",
44+
"@lint",
45+
"@phan",
46+
"@phpunit"
47+
],
48+
"lint": [
49+
"parallel-lint . --exclude vendor --exclude node_modules",
4650
"@phpcs",
47-
"minus-x check ."
51+
"minus-x check .",
52+
"covers-validator"
4853
],
54+
"phan": "phan --allow-polyfill-parser",
55+
"phpunit": "phpunit",
4956
"cover": "phpunit --coverage-html coverage",
5057
"fix": [
5158
"minus-x fix .",

src/TestingAccessWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function newFromObject( $object ) {
5050
* Allow access to non-public static methods and properties of the class.
5151
* Returns an object whose methods/properties will correspond to the
5252
* static methods/properties of the given class.
53-
* @param string $className
53+
* @param class-string $className
5454
* @return self
5555
* @throws InvalidArgumentException
5656
*/

tests/TestingAccessWrapperTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ protected function setUp(): void {
2020

2121
public function testConstructorException() {
2222
$this->expectException( \InvalidArgumentException::class );
23+
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal
2324
TestingAccessWrapper::newFromObject( WellProtectedClass::class );
2425
}
2526

2627
public function testStaticConstructorException() {
2728
$this->expectException( \InvalidArgumentException::class );
29+
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal
2830
TestingAccessWrapper::newFromClass( new WellProtectedClass() );
2931
}
3032

0 commit comments

Comments
 (0)