Skip to content

Commit a942b98

Browse files
rtucekbighappyface
authored andcommitted
Fix various details in README.md (#335)
Add newline after heading and code block (consistency). Use triple backticks for bash code examples. Change how library will be installed via composer. Remove explicit version constraint in `composer require` example. Recent versions of composer will default the most recent version and set a non-major breaking constraint. Version constraint was still pointing to the most recent version of 2.* release. Soft limit text to 80 chars (does node affect code examples). Remove 'Basic usage' heading. Fix heading 'Type coercion' (space and typo). Add missing opening PHP tag (section 'Type coercion'. Fix indentation in code example (consistent 4 spaces). Use single backticks for inline code. Add parenthesis to method in description.
1 parent 10d1f69 commit a942b98

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ See [json-schema](http://json-schema.org/) for more details.
1212

1313
### Library
1414

15-
$ git clone https://github.com/justinrainbow/json-schema.git
15+
```bash
16+
git clone https://github.com/justinrainbow/json-schema.git
17+
```
1618

17-
### Dependencies
19+
### Composer
1820

19-
#### [`Composer`](https://github.com/composer/composer) (*will use the Composer ClassLoader*)
21+
[Install PHP Composer](https://getcomposer.org/doc/00-intro.md)
2022

21-
$ wget http://getcomposer.org/composer.phar
22-
$ php composer.phar require justinrainbow/json-schema:~2.0
23+
```bash
24+
composer require justinrainbow/json-schema
25+
```
2326

2427
## Usage
2528

26-
### Basic usage
27-
2829
```php
2930
<?php
3031

@@ -43,17 +44,23 @@ if ($validator->isValid()) {
4344
}
4445
}
4546
```
46-
###Type Coercion
47-
If you're validating data passed to your application via HTTP, you can cast strings and booleans to the expected types defined by your schema:
47+
48+
### Type coercion
49+
50+
If you're validating data passed to your application via HTTP, you can cast strings and booleans to
51+
the expected types defined by your schema:
52+
4853
```php
54+
<?php
55+
4956
use JsonSchema\SchemaStorage;
5057
use JsonSchema\Validator;
5158
use JsonSchema\Constraints\Factory;
5259
use JsonSchema\Constraints\Constraint;
5360

5461
$request = (object)[
55-
'processRefund'=>"true",
56-
'refundAmount'=>"17"
62+
'processRefund'=>"true",
63+
'refundAmount'=>"17"
5764
];
5865

5966
$factory = new Factory( null, null, Constraint::CHECK_MODE_TYPE_CAST | Constraint::CHECK_MODE_COERCE );
@@ -75,7 +82,7 @@ is_bool($request->processRefund); // true
7582
is_int($request->refundAmount); // true
7683
```
7784

78-
Note that the ```CHECK_MODE_COERCE``` flag will only take effect when an object is passed into the ```check``` method.
85+
Note that the `CHECK_MODE_COERCE` flag will only take effect when an object is passed into the `check()` method.
7986

8087
### With inline references
8188

@@ -133,4 +140,6 @@ $jsonValidator->check($jsonToValidateObject, $jsonSchemaObject);
133140

134141
## Running the tests
135142

136-
$ vendor/bin/phpunit
143+
```bash
144+
vendor/bin/phpunit
145+
```

0 commit comments

Comments
 (0)