Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 033b460

Browse files
committed
Move variadic dots from parame type to param name
This should make param typing more intuitive and unify it with how it is done in PHP, JavaScript, TypeScript and others
1 parent 85d4ebc commit 033b460

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Specs/Builder/ParameterSpecBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ class ParameterSpecBuilder implements ParameterSpecBuilderInterface
3030
{
3131
protected $regexp = '/
3232
^
33-
(?:
34-
(?<rest>\.{3})
35-
\s*
36-
)?
3733
(?:
3834
(?<type>(\w+\b(?:\(.*\))?)(?:\s*\|\s*(?-1))*)
3935
\s*
4036
)
37+
(?:
38+
(?<rest>\.{3})
39+
\s*
40+
)?
4141
(?<name>[_a-z]\w*)
4242
(?:
4343
\s* = \s*

tests/Specs/Builder/ParameterSpecBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function testBuildingVariadicParameter()
124124
{
125125
$this->extractorDefinitionShouldBuildOn('type');
126126

127-
$spec = $this->builder->build('...type param');
127+
$spec = $this->builder->build('type ...param');
128128

129129
$this->assertInstanceOf(VariadicParameterSpec::class, $spec);
130130

@@ -138,7 +138,7 @@ public function testBuildingVariadicParameter()
138138
*/
139139
public function testBuildingVariadicParameterWithDefaultValueShouldThrowException()
140140
{
141-
$this->builder->build('...type param = []');
141+
$this->builder->build('type ...param = []');
142142
}
143143

144144
/**

0 commit comments

Comments
 (0)