Skip to content

Commit cb5a28d

Browse files
committed
Introduce QA settings
These settings support: * PHPStan * PHPCS * Psalm Fixes: * WebHook generation
1 parent 1823967 commit cb5a28d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1419
-559
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"php": "^8.2",
1313
"api-clients/contracts": "^0.1",
1414
"api-clients/github": "^0.2@dev",
15+
"api-clients/openapi-client-utils": "dev-main",
1516
"ckr/arraymerger": "^3.0",
1617
"codeinc/http-reason-phrase-lookup": "^1.0",
1718
"delight-im/random": "^1.0",

composer.lock

Lines changed: 258 additions & 201 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/openapi-client-miele.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ voter:
3232
- ApiClients\Tools\OpenApiClientGenerator\Voter\ListOperation\PageAndPerPageInQuery
3333
streamOperation:
3434
- ApiClients\Tools\OpenApiClientGenerator\Voter\StreamOperation\DownloadInOperationId
35+
qa:
36+
phpcs:
37+
enabled: true
38+
phpstan:
39+
enabled: true
40+
configFilePath: etc/phpstan-extension.neon

example/openapi-client-one.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ voter:
3232
- ApiClients\Tools\OpenApiClientGenerator\Voter\ListOperation\PageAndPerPageInQuery
3333
streamOperation:
3434
- ApiClients\Tools\OpenApiClientGenerator\Voter\StreamOperation\DownloadInOperationId
35+
qa:
36+
phpcs:
37+
enabled: true
38+
phpstan:
39+
enabled: true
40+
configFilePath: etc/phpstan-extension.neon

example/openapi-client-subsplit.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,9 @@ subSplit:
4747
sectionPackage:
4848
name: github-{{ section }}
4949
repository: [email protected]:php-api-clients/github-{{ section }}.git
50+
qa:
51+
phpcs:
52+
enabled: true
53+
phpstan:
54+
enabled: true
55+
configFilePath: etc/phpstan-extension.neon

example/templates/composer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
{% endfor %}
1717
{% endif %}
1818
"api-clients/contracts": "^0.1",
19+
"api-clients/openapi-client-utils": "dev-main",
1920
"devizzent/cebe-php-openapi": "^1",
2021
"eventsauce/object-hydrator": "^1.1",
2122
"league/openapi-psr7-validator": "^0.21",
@@ -48,6 +49,15 @@
4849
"api-clients/{{ suggest.name }}": "{{ suggest.reason }}"{% if not loop.last %},{% endif %}
4950
{% endfor %}
5051
},
52+
{% endif %}
53+
{% if qa.phpstan.enabled is constant('true') and qa.phpstan.configFilePath is not constant('null') %}
54+
"extra": {
55+
"phpstan": {
56+
"includes": [
57+
"{{ qa.phpstan.configFilePath }}"
58+
]
59+
}
60+
},
5161
{% endif %}
5262
"config": {
5363
"sort-packages": true,

example/templates/etc/qa/phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
includes:
22
- ../../vendor/wyrihaximus/async-test-utilities/rules.neon
3+
- ../phpstan-extension.neon

src/Configuration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use ApiClients\Tools\OpenApiClientGenerator\Configuration\Destination;
88
use ApiClients\Tools\OpenApiClientGenerator\Configuration\EntryPoints;
99
use ApiClients\Tools\OpenApiClientGenerator\Configuration\Namespace_;
10+
use ApiClients\Tools\OpenApiClientGenerator\Configuration\QA;
1011
use ApiClients\Tools\OpenApiClientGenerator\Configuration\Schemas;
1112
use ApiClients\Tools\OpenApiClientGenerator\Configuration\State;
1213
use ApiClients\Tools\OpenApiClientGenerator\Configuration\SubSplit;
@@ -32,6 +33,7 @@ public function __construct(
3233
public SubSplit|null $subSplit,
3334
public Schemas|null $schemas,
3435
public Voter|null $voter,
36+
public QA|null $qa,
3537
) {
3638
}
3739
}

src/Configuration/QA.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Tools\OpenApiClientGenerator\Configuration;
6+
7+
use ApiClients\Tools\OpenApiClientGenerator\Configuration\QA\Tool;
8+
9+
final readonly class QA
10+
{
11+
public function __construct(
12+
public Tool|null $phpcs,
13+
public Tool|null $phpstan,
14+
public Tool|null $psalm,
15+
) {
16+
}
17+
}

src/Configuration/QA/Tool.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Tools\OpenApiClientGenerator\Configuration\QA;
6+
7+
use EventSauce\ObjectHydrator\MapFrom;
8+
9+
final readonly class Tool
10+
{
11+
public function __construct(
12+
public bool $enabled,
13+
#[MapFrom('configFilePath')]
14+
public string|null $configFilePath,
15+
) {
16+
}
17+
}

0 commit comments

Comments
 (0)