Skip to content

Commit 2d13c30

Browse files
authored
Merge pull request #11 from ItsKelsBoys/master
Fix #10
2 parents c2f9eb4 + 5e857e1 commit 2d13c30

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"require-dev": {
4040
"friendsofphp/php-cs-fixer": "^2.0",
41-
"phpunit/phpunit": "^7.0"
41+
"phpunit/phpunit": "^6.0 || ^7.0"
4242
},
4343
"extra": {
4444
"branch-alias": {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Vendor\Project;
4+
5+
class MyClass
6+
{
7+
private $argument1;
8+
9+
private $argument2;
10+
11+
private $argument3;
12+
13+
private $argument4;
14+
15+
public function __construct(
16+
int $argument1,
17+
float $argument2,
18+
string $argument3,
19+
bool $argument4
20+
) {
21+
$this->argument1 = $argument1;
22+
$this->argument2 = $argument2;
23+
$this->argument3 = $argument3;
24+
$this->argument4 = $argument4;
25+
}
26+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Vendor\Project;
4+
5+
class MyClass
6+
{
7+
}

src/Memio/SpecGen/GenerateMethod/GenerateMethodHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class GenerateMethodHandler implements CommandHandler
3232
'array',
3333
'null',
3434
'mixed',
35-
'float',
3635
];
3736

3837
private $eventDispatcher;

tests/Memio/SpecGen/Generator/GenerateConstructorTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,29 @@ public function it_inserts_properties_with_initialization_for_each_constructor_a
6868

6969
$this->assertExpectedCode($filename);
7070
}
71+
72+
/**
73+
* @test
74+
*/
75+
public function it_prevents_constructor_to_use_a_special_class_name()
76+
{
77+
$filename = $this->getFixtureFilename();
78+
79+
$resource = $this->prophesize(Resource::class);
80+
$resource->getSrcFilename()->willReturn($filename);
81+
$resource->getSrcNamespace()->willReturn(self::NAME_SPACE);
82+
$resource->getSrcClassname()->willReturn(self::CLASS_NAME);
83+
84+
$this->constructorGenerator->generate($resource->reveal(), [
85+
'name' => '__construct',
86+
'arguments' => [
87+
77,
88+
3.14,
89+
'letsgoboys',
90+
true,
91+
],
92+
]);
93+
94+
$this->assertExpectedCode($filename);
95+
}
7196
}

0 commit comments

Comments
 (0)