Skip to content

Commit 2f0fd06

Browse files
committed
fix compatibility with latest shipmonk/phpstan-rules
1 parent 1ca8f19 commit 2f0fd06

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

phpstan.neon.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ parameters:
2828
allowNamedArgumentOnlyInAttributes:
2929
enabled: false
3030

31+
forbidAssignmentNotMatchingVarDoc:
32+
enabled: false
33+
34+
forbidCheckedExceptionInCallable:
35+
enabled: true
36+
immediatelyCalledCallables:
37+
'ShipMonkTests\InputMapper\InputMapperTestCase::assertException': 2
38+
3139
ignoreErrors:
3240
-
3341
message: '#Property [\w\\]++::\$provider is never read, only written\.#'

src/Compiler/Php/PhpCodeBuilder.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class PhpCodeBuilder extends BuilderFactory
8080
private array $functionImports = [];
8181

8282
/**
83-
* @var array<string, mixed>
83+
* @var array<string, Expr|bool|int|float|string|array<mixed>|null>
8484
*/
8585
private array $constants = [];
8686

@@ -304,7 +304,10 @@ public function withVariableScope(callable $cb): mixed
304304
}
305305
}
306306

307-
public function addConstant(string $name, mixed $value): void
307+
/**
308+
* @param Expr|bool|int|float|string|array<mixed>|null $value
309+
*/
310+
public function addConstant(string $name, Expr|bool|null|int|float|string|array $value): void
308311
{
309312
if (isset($this->constants[$name]) && $this->constants[$name] !== $value) {
310313
throw new LogicException('Constant already exists with different value');
@@ -469,7 +472,7 @@ public function mapperClass(string $shortClassName, MapperCompiler $mapperCompil
469472

470473
$constants = Arrays::map(
471474
$this->constants,
472-
function (mixed $value, string $name): ClassConst {
475+
function (Expr|bool|null|int|float|string|array $value, string $name): ClassConst {
473476
return $this->classConst($name, $value)
474477
->makePrivate()
475478
->getNode();

0 commit comments

Comments
 (0)