Skip to content
This repository was archived by the owner on May 25, 2020. It is now read-only.

Commit ccdbadb

Browse files
committed
Added PHPStan
1 parent 2af62ad commit ccdbadb

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ install:
22
composer install
33
test:
44
vendor/bin/phpunit --color
5+
vendor/bin/phpstan analyze -l7 src tests
56
coverage:
67
$(eval TMPDIR=$(shell mktemp -d))
78
vendor/bin/phpunit --coverage-html=$(TMPDIR)

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,20 @@
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "^6.1",
19-
"php-vfs/php-vfs": "^v1.3"
19+
"php-vfs/php-vfs": "^v1.3",
20+
"phpstan/phpstan": "^0.9"
2021
},
2122
"autoload": {
2223
"psr-4": {
2324
"DiffSniffer\\": "src/"
2425
}
2526
},
27+
"autoload-dev": {
28+
"psr-4": {
29+
"DiffSniffer\\Tests\\": "tests/",
30+
"PHP_CodeSniffer\\" : "vendor/squizlabs/php_codesniffer/src/"
31+
}
32+
},
2633
"extra": {
2734
"branch-alias": {
2835
"dev-master": "3.0.x-dev"

src/ConfigLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function loadComposerConfig(string $path) : array
8383
*/
8484
private function loadPhpCodeSnifferConfig(string $path) : array
8585
{
86-
$phpCodeSnifferConfig = null;
86+
$phpCodeSnifferConfig = [];
8787

8888
require $path;
8989

@@ -93,7 +93,7 @@ private function loadPhpCodeSnifferConfig(string $path) : array
9393
/**
9494
* Resolves relative installed paths against the configuration file path
9595
*
96-
* @param array Configuration parameters
96+
* @param array $config Configuration parameters
9797
* @param string $configPath Configuration file paths
9898
* @return array Configuration parameters
9999
*/

src/Iterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getIterator() : Traversable
5252
new RecursiveArrayIterator(
5353
new EmptyIterator()
5454
),
55-
null,
55+
'',
5656
$this->config,
5757
$this->ruleSet
5858
));

src/Reporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Reporter extends BaseReporter
1414
/**
1515
* @var Diff
1616
*/
17-
private $diff = [];
17+
private $diff;
1818

1919
public function __construct(Diff $diff, Config $config)
2020
{

tests/RunnerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ class RunnerTest extends TestCase
1111
{
1212
public function testEarlyReturn()
1313
{
14+
/** @var Config|\PHPUnit_Framework_MockObject_MockObject $config */
1415
$config = $this->createMock(Config::class);
1516
$runner = new Runner($config);
1617

18+
/** @var Changeset|\PHPUnit_Framework_MockObject_MockObject $changeSet */
1719
$changeSet = $this->createMock(Changeset::class);
1820
$changeSet->expects($this->once())
1921
->method('getDiff')

0 commit comments

Comments
 (0)