Skip to content

Commit 0339a6b

Browse files
committed
Fix style issues
1 parent 8aa91c3 commit 0339a6b

File tree

10 files changed

+37
-19
lines changed

10 files changed

+37
-19
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ phpcs:
1919
phpstan:
2020
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src --no-progress --level max --configuration phpstan.neon
2121

22+
.PHONY: psaml
23+
psalm:
24+
docker run -it --rm -v${PWD}:/opt/project -w /opt/project mickaelandrieu/psalm-ga
25+
2226
.PHONY: test
2327
test:
2428
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.2 tools/phpunit
2529

2630
.PHONY: pre-commit-test
27-
pre-commit-test: test phpcs phpstan
31+
pre-commit-test: test phpcs phpstan psalm
2832

src/TypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ private function resolveTypedObject(string $type, ?Context $context = null) : Ob
391391
*/
392392
private function resolveCollection(ArrayIterator $tokens, Type $classType, Context $context) : Type
393393
{
394-
$isArray = ((string) $classType === 'array');
394+
$isArray = ((string) $classType === 'array');
395395
$isIterable = ((string) $classType === 'iterable');
396396

397397
// allow only "array", "iterable" or class name before "<"

src/Types/Iterable_.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace phpDocumentor\Reflection\Types;
1515

16-
use phpDocumentor\Reflection\Type;
17-
1816
/**
1917
* Value Object representing iterable type
2018
*/

tests/unit/CollectionResolverTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313

1414
namespace phpDocumentor\Reflection;
1515

16-
use InvalidArgumentException;
1716
use phpDocumentor\Reflection\Types\Array_;
1817
use phpDocumentor\Reflection\Types\Collection;
1918
use phpDocumentor\Reflection\Types\Compound;
2019
use phpDocumentor\Reflection\Types\Context;
2120
use phpDocumentor\Reflection\Types\Object_;
2221
use phpDocumentor\Reflection\Types\String_;
2322
use PHPUnit\Framework\TestCase;
24-
use RuntimeException;
2523

2624
/**
2725
* @covers ::<private>

tests/unit/FqsenResolverTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace phpDocumentor\Reflection;
1515

16-
use InvalidArgumentException;
1716
use phpDocumentor\Reflection\Types\Context;
1817
use PHPUnit\Framework\TestCase;
1918

tests/unit/TypeResolverTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace phpDocumentor\Reflection;
1515

16-
use InvalidArgumentException;
1716
use Mockery as m;
1817
use phpDocumentor\Reflection\Types\Array_;
1918
use phpDocumentor\Reflection\Types\Boolean;

tests/unit/Types/ArrayTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@
2121
class ArrayTest extends TestCase
2222
{
2323
/**
24-
* @covers ::__toString
25-
*
2624
* @dataProvider provideArrays
25+
* @covers ::__toString
2726
*/
2827
public function testArrayStringifyCorrectly(Array_ $array, string $expectedString) : void
2928
{
3029
$this->assertSame($expectedString, (string) $array);
3130
}
3231

32+
/**
33+
* @return mixed[]
34+
*/
3335
public function provideArrays() : array
3436
{
3537
return [

tests/unit/Types/CollectionTest.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,36 @@
2222
class CollectionTest extends TestCase
2323
{
2424
/**
25-
* @covers ::__toString
26-
*
2725
* @dataProvider provideCollections
26+
* @covers ::__toString
2827
*/
2928
public function testCollectionStringifyCorrectly(Collection $collection, string $expectedString) : void
3029
{
3130
$this->assertSame($expectedString, (string) $collection);
3231
}
3332

33+
/**
34+
* @return mixed[]
35+
*/
3436
public function provideCollections() : array
3537
{
3638
return [
37-
'simple collection' => [new Collection(null, new Integer()), 'object<int>'],
38-
'simple collection with key type' => [new Collection(null, new Integer(), new String_()), 'object<string,int>'],
39-
'collection of single type using specific class' => [new Collection(new Fqsen('\Foo\Bar'), new Integer()), '\Foo\Bar<int>'],
40-
'collection of single type with key type and using specific class' => [new Collection(new Fqsen('\Foo\Bar'), new String_(), new Integer()), '\Foo\Bar<int,string>'],
39+
'simple collection' => [
40+
new Collection(null, new Integer()),
41+
'object<int>',
42+
],
43+
'simple collection with key type' => [
44+
new Collection(null, new Integer(), new String_()),
45+
'object<string,int>',
46+
],
47+
'collection of single type using specific class' => [
48+
new Collection(new Fqsen('\Foo\Bar'), new Integer()),
49+
'\Foo\Bar<int>',
50+
],
51+
'collection of single type with key type and using specific class' => [
52+
new Collection(new Fqsen('\Foo\Bar'), new String_(), new Integer()),
53+
'\Foo\Bar<int,string>',
54+
],
4155
];
4256
}
4357
}

tests/unit/Types/CompoundTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace phpDocumentor\Reflection\Types;
1515

16-
use InvalidArgumentException;
1716
use PHPUnit\Framework\TestCase;
1817

1918
/**

tests/unit/Types/IterableTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,26 @@ class IterableTest extends TestCase
2222
{
2323
/**
2424
* @covers ::__toString
25-
*
2625
* @dataProvider provideIterables
2726
*/
2827
public function testIterableStringifyCorrectly(Iterable_ $iterable, string $expectedString) : void
2928
{
3029
$this->assertSame($expectedString, (string) $iterable);
3130
}
3231

32+
/**
33+
* @return mixed[]
34+
*/
3335
public function provideIterables() : array
3436
{
3537
return [
3638
'simple iterable' => [new Iterable_(), 'iterable'],
3739
'iterable of mixed' => [new Iterable_(new Mixed_()), 'iterable'],
3840
'iterable of single type' => [new Iterable_(new String_()), 'iterable<string>'],
39-
'iterable of compound type' => [new Iterable_(new Compound([new Integer(), new String_()])), 'iterable<int|string>'],
41+
'iterable of compound type' => [
42+
new Iterable_(new Compound([new Integer(), new String_()])),
43+
'iterable<int|string>',
44+
],
4045
'iterable with key type' => [new Iterable_(new String_(), new Integer()), 'iterable<int,string>'],
4146
];
4247
}

0 commit comments

Comments
 (0)