Skip to content

Commit

Permalink
Merge pull request #6 from aRn0D/issue_5
Browse files Browse the repository at this point in the history
Fix #5 Do not add "use float"
  • Loading branch information
gnugat authored Dec 11, 2017
2 parents 2fe6f34 + eab7c29 commit 67a57e5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Vendor\Project;

class MyClass
{
public function myMethod(
string $argument1,
float $argument2,
int $argument3,
bool $argument4
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Vendor\Project;

class MyClass
{
}
1 change: 1 addition & 0 deletions src/Memio/SpecGen/GenerateMethod/GenerateMethodHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class GenerateMethodHandler implements CommandHandler
'array',
'null',
'mixed',
'float',
];

private $eventDispatcher;
Expand Down
20 changes: 20 additions & 0 deletions tests/Memio/SpecGen/Generator/GenerateMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,24 @@ public function it_prevents_methods_to_be_longer_than_120_characters()

$this->assertExpectedCode($filename);
}

/**
* @test
*/
public function it_prevents_methods_to_use_a_special_class_name()
{
$filename = $this->getFixtureFilename();

$resource = $this->prophesize(Resource::class);
$resource->getSrcFilename()->willReturn($filename);
$resource->getSrcNamespace()->willReturn(self::NAME_SPACE);
$resource->getSrcClassname()->willReturn(self::CLASS_NAME);

$this->methodGenerator->generate($resource->reveal(), [
'name' => 'myMethod',
'arguments' => ['string', 1.1, 1, true],
]);

$this->assertExpectedCode($filename);
}
}

0 comments on commit 67a57e5

Please sign in to comment.