Skip to content

Commit 6e69f03

Browse files
authored
Merge pull request #1 from xepozz/patch-1
Improve readme view
2 parents adc8352 + a0e98cb commit 6e69f03

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Use just [three rows](https://github.com/IvanGrigorov/VMValidator/blob/2139877c4
1111

1212
# Example
1313

14-
```
14+
```php
1515
<?php
1616

1717
use RMValidator\Attributes\PropertyAttributes\Collection\UniqueAttribute;
@@ -27,8 +27,8 @@ use RMValidator\Validators\MasterValidator;
2727
require __DIR__ . '/vendor/autoload.php';
2828

2929

30-
class Test {
31-
30+
class Test
31+
{
3232
public function __construct(
3333
#[RangeAttribute(from:10, to:50)]
3434
#[RangeAttribute(from:10, to:30)]
@@ -62,8 +62,8 @@ class Test {
6262
public int $prop = 40;
6363
}
6464

65-
class UpperTest {
66-
65+
class UpperTest
66+
{
6767
#[NestedAttribute(excludedProperties:['param'])]
6868
private Test $test;
6969

@@ -81,15 +81,16 @@ try {
8181
ValidationOrderEnum::CONSTANTS],
8282
excludedMethods: ['getFile'],
8383
excludedProperties: ['file']));
84-
}
85-
catch(Exception $e) {
84+
} catch(Exception $e) {
8685
var_dump($e);
8786
}
8887
```
8988

9089
# Installation
9190

92-
```composer require ivangrigorov/vmvalidator```
91+
```bash
92+
composer require ivangrigorov/vmvalidator
93+
```
9394

9495

9596
# Options
@@ -112,20 +113,20 @@ In what order to validate the classes (methods or properties first), and what t
112113
- [x] Custom property and method names for the exceptions
113114

114115
### *The custom validation should be declared as static in a validation class
115-
```
116-
class Validation {
117-
118-
static function validate($valueToTest, $arg1) : bool {
116+
```php
117+
class Validation
118+
{
119+
public static function validate($valueToTest, $arg1): bool
120+
{
119121
return $valueToTest == $arg1;
120122
}
121123
}
122124
```
123125
The method should always return boolean: ```true``` for valid input and ```false``` for invalid.
124126

125127
In the declaration:
126-
```
127-
#[CustomAttribute(staticClassName: Validation::class, staticMethodName: 'validate', args: [2])]
128-
128+
```php
129+
#[CustomAttribute(staticClassName: Validation::class, staticMethodName: 'validate', args: [2])]
129130
```
130131
You can pass additional arguments to use in the validation function, but the first parameter is always the value to be tested.
131132

0 commit comments

Comments
 (0)