Skip to content

Commit e6500d8

Browse files
committed
Update ECS dependency, fix docblocks
1 parent f98e9fe commit e6500d8

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"require": {
1414
"php": ">=7.2",
1515
"wol-soft/php-micro-template": "^1.3.1",
16-
"symplify/easy-coding-standard": "^4.1",
16+
"symplify/easy-coding-standard": "^6.0.4",
1717
"ext-json": "*"
1818
},
1919
"require-dev": {

src/Model/RenderJob.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use PHPModelGenerator\Exception\FileSystemException;
1010
use PHPModelGenerator\Exception\RenderException;
1111
use PHPModelGenerator\Utils\RenderHelper;
12+
use Throwable;
1213

1314
class RenderJob
1415
{
@@ -104,6 +105,10 @@ protected function renderClass(GeneratorConfiguration $generatorConfiguration):
104105
? [$generatorConfiguration->getErrorRegistryClass()]
105106
: [$generatorConfiguration->getExceptionClass()];
106107

108+
if ($namespace) {
109+
$use[] = Throwable::class;
110+
}
111+
107112
try {
108113
$class = $render->renderTemplate(
109114
'Model.phptpl',

src/Templates/Model.phptpl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ class {{ class }}
3636
* {{ class }} constructor.
3737
*
3838
* @param array $modelData
39-
{% if use %}
40-
*
41-
* @throws Exception
42-
{% endif %}
43-
*/
39+
{% if generatorConfiguration.collectErrors() %}* @param {{ viewHelper.getSimpleClassName(generatorConfiguration.getErrorRegistryClass()) }} $errorRegistry{% endif %}
40+
*
41+
* @throws Throwable
42+
*/
4443
public function __construct(
4544
array $modelData
4645
{% if generatorConfiguration.collectErrors() %}, {{ viewHelper.getSimpleClassName(generatorConfiguration.getErrorRegistryClass()) }} $errorRegistry = null{% endif %}
@@ -122,7 +121,7 @@ class {{ class }}
122121
*
123122
* @param array $modelData
124123
*
125-
* {% if property.getValidators() %}@throws Exception{% endif %}
124+
* {% if property.getValidators() %}{% if not generatorConfiguration.collectErrors() %}@throws Throwable{% endif %}{% endif %}
126125
*/
127126
protected function process{{ viewHelper.ucfirst(property.getAttribute()) }}(array $modelData): void
128127
{

src/cs.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
imports:
2-
- { resource: '../vendor/symplify/easy-coding-standard/config/psr12.yml' }
3-
- { resource: '../vendor/symplify/easy-coding-standard/config/psr2.yml' }
4-
- { resource: '../vendor/symplify/easy-coding-standard/config/common.yml' }
2+
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/psr12.yaml' }
3+
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/psr2.yaml' }
4+
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/common.yaml' }
5+
- { resource: '%vendor_dir%/symplify/easy-coding-standard/config/set/clean-code.yaml' }
56

67
parameters:
7-
exclude_checkers:
8-
- 'Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer'
9-
- 'PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer'
10-
- 'PhpCsFixer\Fixer\Strict\StrictComparisonFixer'
8+
skip:
9+
Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer: ~
10+
PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer: ~
11+
PhpCsFixer\Fixer\Strict\StrictComparisonFixer: ~

0 commit comments

Comments
 (0)