Skip to content

Commit

Permalink
fix: namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Lelaisant committed Sep 27, 2022
1 parent db18b1e commit 5c97ae8
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 30 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ A PHP implementation of [JSON Schema](http://json-schema.org/). This library all
Install the latest version with

```bash
$ composer require knplabs/php-json-schema
$ composer require Knp/php-json-schema
```

# Basic Usage

A JsonSchema must implements `KnpLabs\JsonSchema\JsonSchemaInterface` (which is basically an alias for `JsonSerializable`).
A JsonSchema must implements `Knp\JsonSchema\JsonSchemaInterface` (which is basically an alias for `JsonSerializable`).

## Default JsonSchema

There is already a default implementation of `JsonSchemaInterface` called `KnpLabs\JsonSchema\JsonSchema` which is an abstract class. This class provides some static methods to create some common JSON Schema scalars or objects.
There is already a default implementation of `JsonSchemaInterface` called `Knp\JsonSchema\JsonSchema` which is an abstract class. This class provides some static methods to create some common JSON Schema scalars or objects.

## Scalars

### `JsonSchema::string()`

```php
use KnpLabs\JsonSchema\JsonSchema;
use Knp\JsonSchema\JsonSchema;

$schema = JsonSchema::create(
'firstName', // The name of the property
Expand All @@ -36,7 +36,7 @@ $schema = JsonSchema::create(
### `JsonSchema::text()`

```php
use KnpLabs\JsonSchema\JsonSchema;
use Knp\JsonSchema\JsonSchema;

$schema = JsonSchema::create(
'content', // The name of the property
Expand All @@ -49,7 +49,7 @@ $schema = JsonSchema::create(
### `JsonSchema::integer()`

```php
use KnpLabs\JsonSchema\JsonSchema;
use Knp\JsonSchema\JsonSchema;

$schema = JsonSchema::create(
'age', // The name of the property
Expand All @@ -62,7 +62,7 @@ $schema = JsonSchema::create(
### `JsonSchema::positiveInteger()`

```php
use KnpLabs\JsonSchema\JsonSchema;
use Knp\JsonSchema\JsonSchema;

$schema = JsonSchema::create(
'age', // The name of the property
Expand All @@ -75,7 +75,7 @@ $schema = JsonSchema::create(
### `JsonSchema::number()`

```php
use KnpLabs\JsonSchema\JsonSchema;
use Knp\JsonSchema\JsonSchema;

$schema = JsonSchema::create(
'price', // The name of the property
Expand All @@ -88,7 +88,7 @@ $schema = JsonSchema::create(
### `JsonSchema::boolean()`

```php
use KnpLabs\JsonSchema\JsonSchema;
use Knp\JsonSchema\JsonSchema;

$schema = JsonSchema::create(
'isAdult', // The name of the property
Expand All @@ -101,7 +101,7 @@ $schema = JsonSchema::create(
### `JsonSchema::date()`

```php
use KnpLabs\JsonSchema\JsonSchema;
use Knp\JsonSchema\JsonSchema;

$schema = JsonSchema::create(
'createdAt', // The name of the property
Expand All @@ -114,14 +114,14 @@ $schema = JsonSchema::create(
## Enum

Enum is a special type of scalar which is a list of possible values.
They can be created by extending the `KnpLabs\JsonSchema\EnumSchema`:
They can be created by extending the `Knp\JsonSchema\EnumSchema`:

```php
<?php

namespace Acme;

use KnpLabs\JsonSchema\EnumSchema;
use Knp\JsonSchema\EnumSchema;

class RoleEnum extends EnumSchema
{
Expand All @@ -148,14 +148,14 @@ class RoleEnum extends EnumSchema

## Objects

You can create objects schema by extending the `KnpLabs\JsonSchema\ObjectSchema` class:
You can create objects schema by extending the `Knp\JsonSchema\ObjectSchema` class:

```php
<?php

namespace Acme;

use KnpLabs\JsonSchema\ObjectSchema;
use Knp\JsonSchema\ObjectSchema;

class PersonSchema extends ObjectSchema
{
Expand Down Expand Up @@ -188,14 +188,14 @@ class PersonSchema extends ObjectSchema

## Collections

You can create collections schema by extending the `KnpLabs\JsonSchema\CollectionSchema` class:
You can create collections schema by extending the `Knp\JsonSchema\CollectionSchema` class:

```php
<?php

namespace Acme;

use KnpLabs\JsonSchema\CollectionSchema;
use Knp\JsonSchema\CollectionSchema;

class PersonCollectionSchema extends CollectionSchema
{
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"license": "MIT",
"autoload": {
"psr-4": {
"Knplabs\\JsonSchema\\": "src/"
"Knp\\JsonSchema\\": "src/"
}
},
"authors": [
{
"name": "KnpLabs",
"name": "Knp Labs",
"email": "hello@knplabs.com"
}
],
Expand Down
2 changes: 1 addition & 1 deletion src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema;
namespace Knp\JsonSchema;

use Exception;

Expand Down
2 changes: 1 addition & 1 deletion src/CollectionSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema;
namespace Knp\JsonSchema;

/**
* @template I
Expand Down
2 changes: 1 addition & 1 deletion src/EnumSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema;
namespace Knp\JsonSchema;

/**
* @template E
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema;
namespace Knp\JsonSchema;

/**
* @template T of mixed
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchemaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema;
namespace Knp\JsonSchema;

use JsonSerializable;

Expand Down
2 changes: 1 addition & 1 deletion src/ObjectSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema;
namespace Knp\JsonSchema;

/**
* @template T of array<string, mixed>
Expand Down
4 changes: 2 additions & 2 deletions src/Scalar/UuidSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema\Scalar;
namespace Knp\JsonSchema\Scalar;

use KnpLabs\JsonSchema\JsonSchema;
use Knp\JsonSchema\JsonSchema;

/**
* @extends JsonSchema<string>
Expand Down
4 changes: 2 additions & 2 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema;
namespace Knp\JsonSchema;

use KnpLabs\JsonSchema\Validator\Errors;
use Knp\JsonSchema\Validator\Errors;

interface Validator
{
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema\Validator;
namespace Knp\JsonSchema\Validator;

final class Error
{
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace KnpLabs\JsonSchema\Validator;
namespace Knp\JsonSchema\Validator;

use ArrayIterator;
use Countable;
Expand Down

0 comments on commit 5c97ae8

Please sign in to comment.