Skip to content

Commit

Permalink
Rename type() method from enum to value()
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyoak committed Aug 27, 2015
1 parent 1ac3522 commit 2658c63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/DataType/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ abstract class Enum
/**
* @var string
*/
private $type;
private $value;

/**
* @param mixed $type
* @param mixed $value
*/
public function __construct($type)
public function __construct($value)
{
$this->guardAgainstValueNotInValidConstants($type);
$this->type = $type;
$this->guardAgainstValueNotInValidConstants($value);
$this->value = $value;
}

/**
* @return string
*/
public function type()
public function value()
{
return $this->type;
return $this->value;
}

/**
* @return string
*/
public function __toString()
{
return (string) $this->type;
return (string) $this->value;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/DataType/EnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class EnumTest extends \PHPUnit_Framework_TestCase
const A_NOT_VALID_VALUE = 'A NOT VALID VALUE';

/** @test */
public function shouldReturnType()
public function shouldReturnValue()
{
$value = TestableEnum::TESTABLE_VALUE1;
$enum = new TestableEnum($value);

$this->assertSame($value, $enum->type());
$this->assertSame($value, $enum->value());
}

/** @test */
Expand Down

0 comments on commit 2658c63

Please sign in to comment.