Skip to content

Commit f74ed64

Browse files
committed
fix: make phpstan green
1 parent 80bccfb commit f74ed64

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

extension.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ services:
3232

3333
parameters:
3434
specDir: 'spec/'
35+
36+
ignoreErrors:
37+
- '#Method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) invoked with 2 parameters, 0-1 required.#'
38+
- '#Parameter \#1 \$event of method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) expects object, string given.#'

src/NodeVisitor/CustomMatchersResolver.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,16 @@ public function afterTraverse(array $nodes)
6060
}
6161

6262
/**
63-
* @param Node\Expr\ArrayItem[] $items
63+
* @param (Node\Expr\ArrayItem|null)[] $items
6464
*/
6565
private function resolveMatchers(array $items): void
6666
{
6767
// todo: maybe we can resolve custom matcher parameters count?
6868
foreach ($items as $item) {
69+
if ($item === null) {
70+
continue;
71+
}
72+
6973
if ($item->key instanceof Node\Scalar\String_) {
7074
CustomMatchersRegistry::addMatcher($this->currentSpec, $item->key->value);
7175
}

src/Type/CollaboratorPropertyType.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use PHPStan\Reflection\PropertyReflection;
1212
use PHPStan\TrinaryLogic;
1313
use PHPStan\Type\BooleanType;
14+
use PHPStan\Type\Generic\TemplateTypeMap;
1415
use PHPStan\Type\ObjectType;
1516
use PHPStan\Type\Type;
1617
use PHPStan\Type\VerbosityLevel;
@@ -131,6 +132,11 @@ public function getIterableValueType(): Type
131132
return $this->wrappedType->getIterableValueType();
132133
}
133134

135+
public function isArray(): TrinaryLogic
136+
{
137+
return $this->wrappedType->isArray();
138+
}
139+
134140
public function isOffsetAccessible(): TrinaryLogic
135141
{
136142
return $this->wrappedType->isOffsetAccessible();
@@ -196,6 +202,16 @@ public function toArray(): Type
196202
return $this->wrappedType->toArray();
197203
}
198204

205+
public function inferTemplateTypes(Type $receivedType): TemplateTypeMap
206+
{
207+
return $this->wrappedType->inferTemplateTypes($receivedType);
208+
}
209+
210+
public function traverse(callable $cb): Type
211+
{
212+
return $this->wrappedType->traverse($cb);
213+
}
214+
199215
public static function __set_state(array $properties): Type
200216
{
201217
return new self($properties['wrappedType']);

0 commit comments

Comments
 (0)