Skip to content

Commit c0cc8b1

Browse files
committed
phpstan improvements
1 parent fdcc005 commit c0cc8b1

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

phive.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpstan" version="^0.9.1" installed="0.10.2" location="./tools/phpstan" copy="true"/>
4-
<phar name="phpunit" version="^6.0" installed="6.5.5" location="./tools/phpunit" copy="true"/>
3+
<phar name="phpstan" version="^0.9.1" installed="0.10.7" location="./tools/phpstan" copy="true"/>
4+
<phar name="phpunit" version="^6.0" installed="6.5.13" location="./tools/phpunit" copy="true"/>
55
</phive>

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
parameters:
22
ignoreErrors:
3+
4+
- '#Method phpDocumentor\\Reflection\\File\\LocalFile::\md5\(\) should return string but returns string\|false\.#'
35
#
46
# all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it)
57
#

tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ public function testMd5()
3838
$this->assertEquals(md5_file(__FILE__), $file->md5());
3939
}
4040

41+
/**
42+
* @covers ::__construct
43+
* @expectedException \InvalidArgumentException
44+
*/
45+
public function testNotExistingFileThrowsException()
46+
{
47+
new LocalFile('aa');
48+
}
49+
4150
/**
4251
* @covers ::path
4352
*/

tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,16 @@ class ArgumentTest extends TestCase
2727
*/
2828
public function testGetTypes()
2929
{
30-
$argument = new Argument('myArgument', null,'myDefaultValue', true, true);
30+
$argument = new Argument('myArgument', null, 'myDefaultValue', true, true);
3131
$this->assertInstanceOf(Mixed_::class, $argument->getType());
3232

33-
$argument = new Argument('myArgument', new String_(),'myDefaultValue', true, true);
33+
$argument = new Argument(
34+
'myArgument',
35+
new String_(),
36+
'myDefaultValue',
37+
true,
38+
true
39+
);
3440
$this->assertEquals(new String_(), $argument->getType());
3541
}
3642

@@ -50,7 +56,7 @@ public function testGetName()
5056
*/
5157
public function testGetDefault()
5258
{
53-
$argument = new Argument('myArgument', null,'myDefaultValue', true, true);
59+
$argument = new Argument('myArgument', null, 'myDefaultValue', true, true);
5460
$this->assertEquals('myDefaultValue', $argument->getDefault());
5561

5662
$argument = new Argument('myArgument', null, null, true, true);
@@ -63,7 +69,7 @@ public function testGetDefault()
6369
*/
6470
public function testGetWhetherArgumentIsPassedByReference()
6571
{
66-
$argument = new Argument('myArgument', null,'myDefaultValue', true, true);
72+
$argument = new Argument('myArgument', null, 'myDefaultValue', true, true);
6773
$this->assertTrue($argument->isByReference());
6874

6975
$argument = new Argument('myArgument', null, null, false, true);
@@ -76,7 +82,7 @@ public function testGetWhetherArgumentIsPassedByReference()
7682
*/
7783
public function testGetWhetherArgumentisVariadic()
7884
{
79-
$argument = new Argument('myArgument', null,'myDefaultValue', true, true);
85+
$argument = new Argument('myArgument', null, 'myDefaultValue', true, true);
8086
$this->assertTrue($argument->isVariadic());
8187

8288
$argument = new Argument('myArgument', null, 'myDefaultValue', true, false);

0 commit comments

Comments
 (0)