mirror of
https://github.com/Respect/Validation.git
synced 2024-06-04 14:52:17 +02:00
Rename rule "Float" to "FloatVal"
This commit is contained in:
parent
7f2cdceb31
commit
3e1f86baf8
|
@ -1,10 +0,0 @@
|
|||
# Float
|
||||
|
||||
- `v::float()`
|
||||
|
||||
Validates a floating point number.
|
||||
|
||||
```php
|
||||
v::float()->validate(1.5); //true
|
||||
v::float()->validate('1e5'); //true
|
||||
```
|
10
docs/FloatVal.md
Normal file
10
docs/FloatVal.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# FloatVal
|
||||
|
||||
- `v::floatVal()`
|
||||
|
||||
Validates a floating point number.
|
||||
|
||||
```php
|
||||
v::floatVal()->validate(1.5); //true
|
||||
v::floatVal()->validate('1e5'); //true
|
||||
```
|
|
@ -7,7 +7,7 @@ Validates if NONE of the given validators validate:
|
|||
```php
|
||||
v::noneOf(
|
||||
v::int(),
|
||||
v::float()
|
||||
v::floatVal()
|
||||
)->validate('foo'); //true
|
||||
```
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ This is a group validator that acts as an OR operator.
|
|||
```php
|
||||
v::oneOf(
|
||||
v::int(),
|
||||
v::float()
|
||||
v::floatVal()
|
||||
)->validate(15.5); //true
|
||||
```
|
||||
|
||||
In the sample above, `v::int()` doesn't validates, but
|
||||
`v::float()` validates, so oneOf returns true.
|
||||
`v::floatVal()` validates, so oneOf returns true.
|
||||
|
||||
`v::oneOf` returns true if at least one inner validator
|
||||
passes.
|
||||
|
@ -20,7 +20,7 @@ passes.
|
|||
Using a shortcut
|
||||
|
||||
```php
|
||||
v::int()->addOr(v::float())->validate(15.5); //true
|
||||
v::int()->addOr(v::floatVal())->validate(15.5); //true
|
||||
```
|
||||
|
||||
***
|
||||
|
|
|
@ -17,7 +17,7 @@ See also:
|
|||
* [BoolType](BoolType.md)
|
||||
* [CallableType](CallableType.md)
|
||||
* [Finite](Finite.md)
|
||||
* [Float](Float.md)
|
||||
* [FloatVal](FloatVal.md)
|
||||
* [Infinite](Infinite.md)
|
||||
* [Instance](Instance.md)
|
||||
* [Int](Int.md)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* [CallableType](CallableType.md)
|
||||
* [Date](Date.md)
|
||||
* [FalseVal](FalseVal.md)
|
||||
* [Float](Float.md)
|
||||
* [FloatVal](FloatVal.md)
|
||||
* [Instance](Instance.md)
|
||||
* [Int](Int.md)
|
||||
* [NullValue](NullValue.md)
|
||||
|
@ -47,7 +47,7 @@
|
|||
* [Even](Even.md)
|
||||
* [Factor](Factor.md)
|
||||
* [Finite](Finite.md)
|
||||
* [Float](Float.md)
|
||||
* [FloatVal](FloatVal.md)
|
||||
* [Infinite](Infinite.md)
|
||||
* [Int](Int.md)
|
||||
* [Multiple](Multiple.md)
|
||||
|
@ -218,7 +218,7 @@
|
|||
* [File](File.md)
|
||||
* [FilterVar](FilterVar.md)
|
||||
* [Finite](Finite.md)
|
||||
* [Float](Float.md)
|
||||
* [FloatVal](FloatVal.md)
|
||||
* [Graph](Graph.md)
|
||||
* [HexRgbColor](HexRgbColor.md)
|
||||
* [In](In.md)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
class FloatException extends ValidationException
|
||||
class FloatValException extends ValidationException
|
||||
{
|
||||
public static $defaultTemplates = array(
|
||||
self::MODE_DEFAULT => array(
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Respect\Validation\Rules;
|
||||
|
||||
class Float extends AbstractRule
|
||||
class FloatVal extends AbstractRule
|
||||
{
|
||||
public function validate($input)
|
||||
{
|
|
@ -60,7 +60,7 @@ use Respect\Validation\Rules\Key;
|
|||
* @method static Validator file()
|
||||
* @method static Validator filterVar(int $filter, mixed $options = null)
|
||||
* @method static Validator finite()
|
||||
* @method static Validator float()
|
||||
* @method static Validator floatVal()
|
||||
* @method static Validator graph(string $additionalChars = null)
|
||||
* @method static Validator hexRgbColor()
|
||||
* @method static Validator in(mixed $haystack, bool $compareIdentical = false)
|
||||
|
|
|
@ -13,16 +13,16 @@ namespace Respect\Validation\Rules;
|
|||
|
||||
/**
|
||||
* @group rule
|
||||
* @covers Respect\Validation\Rules\Float
|
||||
* @covers Respect\Validation\Exceptions\FloatException
|
||||
* @covers Respect\Validation\Rules\FloatVal
|
||||
* @covers Respect\Validation\Exceptions\FloatValException
|
||||
*/
|
||||
class FloatTest extends \PHPUnit_Framework_TestCase
|
||||
class FloatValTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $floatValidator;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->floatValidator = new Float();
|
||||
$this->floatValidator = new FloatVal();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ class FloatTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @dataProvider providerForNotFloat
|
||||
* @expectedException Respect\Validation\Exceptions\FloatException
|
||||
* @expectedException Respect\Validation\Exceptions\FloatValException
|
||||
*/
|
||||
public function testNotFloatNumbersShouldFail($input)
|
||||
{
|
Loading…
Reference in a new issue