Skip to content

Commit

Permalink
Rename class Float to Decimal to avoid PHP7 conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
briedis committed Apr 29, 2016
1 parent 930df6c commit 92e1419
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Briedis\ApiBuilder\Items;


class Float extends BaseItem{
class Decimal extends BaseItem{
const TYPE = 'float';

public function validateValue($value){
Expand Down
4 changes: 2 additions & 2 deletions src/Briedis/ApiBuilder/StructureBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Briedis\ApiBuilder\Items\BaseItem;
use Briedis\ApiBuilder\Items\Boolean;
use Briedis\ApiBuilder\Items\Float;
use Briedis\ApiBuilder\Items\Decimal;
use Briedis\ApiBuilder\Items\Integer;
use Briedis\ApiBuilder\Items\Mixed;
use Briedis\ApiBuilder\Items\String;
Expand Down Expand Up @@ -90,7 +90,7 @@ public function str($name, $description = ''){
* @return StructureBuilder
*/
public function float($name, $description = ''){
return $this->addItem(new Float($name, $description));
return $this->addItem(new Decimal($name, $description));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/MultiDepthValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


use Briedis\ApiBuilder\Exceptions\InvalidStructureException;
use Briedis\ApiBuilder\Items\Float;
use Briedis\ApiBuilder\Items\Decimal;
use Briedis\ApiBuilder\StructureBuilder as SB;
use Briedis\ApiBuilder\StructureValidator;

Expand Down Expand Up @@ -64,7 +64,7 @@ public function testInvalidStructure(){
} catch(InvalidStructureException $e){
$caught = true;
$fields = $e->getBadFields();
$this->assertInstanceOf(get_class(new Float), $fields['s11.decimal'], 'Correct field is missing');
$this->assertInstanceOf(get_class(new Decimal), $fields['s11.decimal'], 'Correct field is missing');
$this->assertEquals(1, count($fields), 'Bad parameter count matches');
}

Expand Down
4 changes: 2 additions & 2 deletions tests/SingleDepthValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


use Briedis\ApiBuilder\Exceptions\InvalidStructureException;
use Briedis\ApiBuilder\Items\Float;
use Briedis\ApiBuilder\Items\Decimal;
use Briedis\ApiBuilder\Items\Integer;
use Briedis\ApiBuilder\StructureBuilder;
use Briedis\ApiBuilder\StructureValidator;
Expand Down Expand Up @@ -73,7 +73,7 @@ public function testInvalidParam(){
$fields = $e->getBadFields();

$this->assertInstanceOf(get_class(new Integer), $fields['id'], 'Correct field is invalid');
$this->assertInstanceOf(get_class(new Float), $fields['decimal'], 'Correct field is invalid');
$this->assertInstanceOf(get_class(new Decimal), $fields['decimal'], 'Correct field is invalid');
$this->assertEquals(2, count($fields), 'Bad parameter count matches');
}

Expand Down
6 changes: 3 additions & 3 deletions tests/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Briedis\ApiBuilder\Items\BaseItem;
use Briedis\ApiBuilder\Items\Boolean;
use Briedis\ApiBuilder\Items\Float;
use Briedis\ApiBuilder\Items\Decimal;
use Briedis\ApiBuilder\Items\Integer;
use Briedis\ApiBuilder\Items\Mixed;
use Briedis\ApiBuilder\Items\String;
Expand Down Expand Up @@ -58,7 +58,7 @@ public function testIsFloat(){
'-1223',
1.234,
1e2,
], new Float);
], new Decimal);
}

public function testIsNotFloat(){
Expand All @@ -72,7 +72,7 @@ public function testIsNotFloat(){
'0xf4c3b00c',
'0b10100111001',
'0777',
], new Float);
], new Decimal);
}

public function testIsString(){
Expand Down

0 comments on commit 92e1419

Please sign in to comment.