Skip to content

Commit f373259

Browse files
committed
Fix unparseable string representation of CallableTypeParameterNode
1 parent 829bd2e commit f373259

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/Ast/Type/CallableTypeParameterNode.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function __toString(): string
4141
$type = "{$this->type} ";
4242
$isReference = $this->isReference ? '&' : '';
4343
$isVariadic = $this->isVariadic ? '...' : '';
44-
$default = $this->isOptional ? ' = default' : '';
45-
return trim("{$type}{$isReference}{$isVariadic}{$this->parameterName}") . $default;
44+
$isOptional = $this->isOptional ? '=' : '';
45+
return trim("{$type}{$isReference}{$isVariadic}{$this->parameterName}") . $isOptional;
4646
}
4747

4848
}

‎tests/PHPStan/Ast/ToString/TypeToStringTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static function provideCallableCases(): Generator
102102
], new IdentifierTypeNode('void')),
103103
],
104104
[
105-
'callable(int = default, int $foo = default): void',
105+
'callable(int=, int $foo=): void',
106106
new CallableTypeNode(new IdentifierTypeNode('callable'), [
107107
new CallableTypeParameterNode(new IdentifierTypeNode('int'), false, false, '', true),
108108
new CallableTypeParameterNode(new IdentifierTypeNode('int'), false, false, '$foo', true),

0 commit comments

Comments
 (0)