Skip to content

Commit

Permalink
Version 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
3nr1c committed Jul 27, 2015
1 parent 02dcb9c commit 69512ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ $scalar->check($var);
This class runs the ```is_numeric()``` test against a variable. A range property can be defined, with the following syntax:

```regexp
/^\s*[\(\[]\s*-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?\s*[\)\]]\s*$/
/^\s*[\(\[]\s*(-?\d+(\.\d+)?|-inf)\s*,\s*(-?\d+(\.\d+)?|\+?inf)\s*[\)\]]\s*$/
```

That is, it uses the [mathematical notation](https://en.wikipedia.org/wiki/Interval_(mathematics)#Including_or_excluding_endpoints):
Expand All @@ -137,6 +137,9 @@ That is, it uses the [mathematical notation](https://en.wikipedia.org/wiki/Inter
* The ')' character indicates a strict (>) upper bound
* The ']' character indicates a non-strict (>=) upper bound

The term ```inf``` is used to indicate infinities. It has limitations: the left value can only be ```-inf```, and the right
value either ```inf``` or ```+inf```.

The parser will raise an ```\Exception``` if the syntax is not correct. Here are a couple of examples:

```php
Expand Down Expand Up @@ -297,12 +300,12 @@ You can read more documentation by running ```composer doc``` (phpdoc needed) an
# Planned features

* [x] Quick static functions for type testing (ArrayS::check())
* [x] Improvement for ranges: infinities
* [x] Enum type: "{1,2,10,3}"
* [ ] Date formats: timestamp, mysql date/time/datetime, standard times
* [ ] Email, ip, hash formats
* [ ] Improvement for ranges: infinities
* [ ] Objects: attributes (name, visibility) and methods (name, visibility, parameters)
* [ ] Regexp for strings
* [x] Enum type: "{1,2,10,3}"
* [ ] ArrayS: output what failed after check()
* [ ] ArrayS: mark some keys as optional
* [ ] ArrayS: "null[]"
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "3nr1c/structure",
"version": "0.3",
"version": "0.4",
"license": "MIT",
"authors": [
{
Expand Down

0 comments on commit 69512ee

Please sign in to comment.