Skip to content

Commit 24315f7

Browse files
committed
Move exceptions into a separate repository to enable the library as a dev dependency
1 parent 0389cb1 commit 24315f7

25 files changed

+28
-89
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 wol-soft
3+
Copyright (c) 2019 wol-soft
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ Simple example from a PHP application: you define and document an API with swagg
2020

2121
The recommended way to install php-json-model-generator is through [Composer](http://getcomposer.org):
2222
```
23-
$ composer require wol-soft/php-json-model-generator
23+
$ composer require --dev wol-soft/php-json-model-generator
24+
$ composer require wol-soft/php-json-model-generator-exception
2425
```
26+
To avoid adding all dependencies of the php-json-model-generator to your production dependencies it's recommended to add the library as a dev-dependency and include the php-json-model-generator-exception library. The exception library provides all classes to run the generated code. Generating the classes should either be a step done in the development environment (if you decide to commit the models) or as a build step of your application.
2527

2628
## Examples ##
2729

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"php": ">=7.2",
1515
"wol-soft/php-micro-template": "^1.3.1",
1616
"symplify/easy-coding-standard": "^6.0.4",
17-
"ext-json": "*"
17+
"ext-json": "*",
18+
"wol-soft/php-json-schema-model-generator-exception": "^0.1.0"
1819
},
1920
"require-dev": {
2021
"phpunit/phpunit": "^8.0"

src/Exception/ErrorRegistryException.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Exception/ErrorRegistryExceptionInterface.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/Exception/ValidationException.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/Model/GeneratorConfiguration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace PHPModelGenerator\Model;
66

7-
use PHPModelGenerator\Exception\ErrorRegistryException;
8-
use PHPModelGenerator\Exception\ValidationException;
7+
use PHPModelGeneratorException\ErrorRegistryException;
8+
use PHPModelGeneratorException\ValidationException;
99

1010
/**
1111
* Class GeneratorConfiguration

src/Templates/Model.phptpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class {{ class }}
2626
protected $rawModelDataInput;
2727

2828
{% if generatorConfiguration.collectErrors() %}
29-
/** @var Throwable Collect all validation errors */
29+
/** @var ErrorRegistryExceptionInterface Collect all validation errors */
3030
protected $errorRegistry;
3131
/** @var bool Store if the current class is the initial class which must throw a collected exception after
3232
* the validation process is finished
@@ -125,7 +125,7 @@ class {{ class }}
125125
*
126126
* @param array $modelData
127127
*
128-
* {% if property.getValidators() %}{% if not generatorConfiguration.collectErrors() %}@throws Throwable{% endif %}{% endif %}
128+
* {% if property.getValidators() %}{% if not generatorConfiguration.collectErrors() %}@throws ErrorRegistryExceptionInterface{% endif %}{% endif %}
129129
*/
130130
protected function process{{ viewHelper.ucfirst(property.getAttribute()) }}(array $modelData): void
131131
{

tests/AbstractPHPModelGeneratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace PHPModelGenerator\Tests;
44

55
use FilesystemIterator;
6-
use PHPModelGenerator\Exception\ErrorRegistryException;
6+
use PHPModelGeneratorException\ErrorRegistryException;
77
use PHPModelGenerator\Exception\FileSystemException;
88
use PHPModelGenerator\Exception\RenderException;
99
use PHPModelGenerator\Exception\SchemaException;
10-
use PHPModelGenerator\Exception\ValidationException;
10+
use PHPModelGeneratorException\ValidationException;
1111
use PHPModelGenerator\ModelGenerator;
1212
use PHPModelGenerator\Model\GeneratorConfiguration;
1313
use PHPUnit\Framework\TestCase;

tests/Basic/AdditionalPropertiesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PHPModelGenerator\Tests\Basic;
44

5-
use PHPModelGenerator\Exception\ValidationException;
5+
use PHPModelGeneratorException\ValidationException;
66
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;
77

88
/**

tests/Basic/ObjectSizeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PHPModelGenerator\Tests\Basic;
44

5-
use PHPModelGenerator\Exception\ValidationException;
5+
use PHPModelGeneratorException\ValidationException;
66
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;
77

88
/**

tests/ComposedValue/ComposedAllOfTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PHPModelGenerator\Tests\ComposedValue;
44

5-
use PHPModelGenerator\Exception\ValidationException;
5+
use PHPModelGeneratorException\ValidationException;
66
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;
77
use stdClass;
88

tests/ComposedValue/ComposedAnyOfTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PHPModelGenerator\Tests\ComposedValue;
44

5-
use PHPModelGenerator\Exception\ValidationException;
5+
use PHPModelGeneratorException\ValidationException;
66
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;
77
use stdClass;
88

tests/ComposedValue/ComposedOneOfTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PHPModelGenerator\Tests\ComposedValue;
44

5-
use PHPModelGenerator\Exception\ValidationException;
5+
use PHPModelGeneratorException\ValidationException;
66
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;
77
use stdClass;
88

tests/Objects/AbstractNumericPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PHPModelGenerator\Tests\Objects;
44

5-
use PHPModelGenerator\Exception\ValidationException;
5+
use PHPModelGeneratorException\ValidationException;
66
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;
77

88
/**

tests/Objects/BooleanPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;

tests/Objects/ConstPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;

tests/Objects/EnumPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;

tests/Objects/IntegerPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use stdClass;

tests/Objects/MultiTypePropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
76
use PHPModelGenerator\Exception\RenderException;
87
use PHPModelGenerator\Exception\SchemaException;
98
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;
9+
use PHPModelGeneratorException\ValidationException;
1010
use stdClass;
1111

1212
/**

tests/Objects/NullPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;

tests/Objects/NumberPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use stdClass;

tests/Objects/ObjectPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;

tests/Objects/ReferencePropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Objects;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;

tests/Objects/RequiredPropertyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPModelGenerator\Tests\Basic;
44

55
use PHPModelGenerator\Exception\FileSystemException;
6-
use PHPModelGenerator\Exception\ValidationException;
6+
use PHPModelGeneratorException\ValidationException;
77
use PHPModelGenerator\Exception\RenderException;
88
use PHPModelGenerator\Exception\SchemaException;
99
use PHPModelGenerator\Tests\AbstractPHPModelGeneratorTest;

0 commit comments

Comments
 (0)