Skip to content

Commit 110a355

Browse files
authored
Merge pull request #1227 from php-api-clients/GitHub/from-1.1.4-bd1a2cde4ef1f12a463c3206d4665fb8-from-1.1.4-bd1a2cde4ef1f12a463c3206d4665fb8
2 parents 7d988fa + ff240f5 commit 110a355

File tree

18 files changed

+435
-2199
lines changed

18 files changed

+435
-2199
lines changed

clients/GitHub/etc/openapi-client-generator.state

+23-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"specHash": "ed9f9c8a528083c4f510bc9ec29e7cbc",
2+
"specHash": "bd1a2cde4ef1f12a463c3206d4665fb8",
33
"generatedFiles": {
44
"files": [
55
{
@@ -808,11 +808,11 @@
808808
},
809809
{
810810
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Commit.php",
811-
"hash": "fecf1872a093ef9b8e030d1b85ec04d6"
811+
"hash": "5d4e74927c311c39a5bf5a2128703049"
812812
},
813813
{
814814
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/BranchWithProtection.php",
815-
"hash": "a2d1dc45500db9335f41f494d54cde28"
815+
"hash": "abe7bf076fd01ba2a37c645792410f3b"
816816
},
817817
{
818818
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/StatusCheckPolicy.php",
@@ -976,7 +976,7 @@
976976
},
977977
{
978978
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CommitComparison.php",
979-
"hash": "102c311bc331cb4727727a168dff9480"
979+
"hash": "2f47b90f82deea1f53f7eb05b19d0832"
980980
},
981981
{
982982
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/ContentTree.php",
@@ -5576,7 +5576,7 @@
55765576
},
55775577
{
55785578
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Orgs.php",
5579-
"hash": "b70830c3e9116294d4024aa1c4b96d82"
5579+
"hash": "9cc8a952a09ba39d91e86ea451a347e8"
55805580
},
55815581
{
55825582
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Actions.php",
@@ -15256,7 +15256,7 @@
1525615256
},
1525715257
{
1525815258
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Orgs\/AddSecurityManagerTeam.php",
15259-
"hash": "d2fce870b2cb247448df55fad25e7db6"
15259+
"hash": "2e655db0da01ce7954a01700e3299829"
1526015260
},
1526115261
{
1526215262
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Orgs\/RemoveSecurityManagerTeam.php",
@@ -24888,7 +24888,7 @@
2488824888
},
2488924889
{
2489024890
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Put\/Orgs.php",
24891-
"hash": "036a72c9ebe842c9829dfcc14984247a"
24891+
"hash": "d9fa1cd41ee4ef5dc9e80b71f39c5771"
2489224892
},
2489324893
{
2489424894
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Put\/Codespaces.php",
@@ -25144,7 +25144,7 @@
2514425144
},
2514525145
{
2514625146
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Put\/Six.php",
25147-
"hash": "0e732f175758864698227b1f673bf2b3"
25147+
"hash": "2d193ba8e2a36a3ea0fe0a7e952dd209"
2514825148
},
2514925149
{
2515025150
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Put\/Eight.php",
@@ -26028,7 +26028,7 @@
2602826028
},
2602926029
{
2603026030
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Branches\/Branch.php",
26031-
"hash": "ea6f9da0e8c8911a0613ddc66b7cf2ed"
26031+
"hash": "025dcd472975b0fb7c72bb928995c634"
2603226032
},
2603326033
{
2603426034
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Branches\/Branch\/Protection.php",
@@ -26072,7 +26072,7 @@
2607226072
},
2607326073
{
2607426074
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Branches\/Branch\/Rename.php",
26075-
"hash": "a1c0237c73b0ddd223f409c459bebcee"
26075+
"hash": "5f16afe381efaca4e1ea38bfa312b7f1"
2607626076
},
2607726077
{
2607826078
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/CheckRuns.php",
@@ -26212,7 +26212,7 @@
2621226212
},
2621326213
{
2621426214
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Commits\/Ref.php",
26215-
"hash": "5438585603d89e956a174d7f30da8387"
26215+
"hash": "70fcc6d425b1790fa9d8652892f669d8"
2621626216
},
2621726217
{
2621826218
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Commits\/Ref\/CheckRuns.php",
@@ -26236,7 +26236,7 @@
2623626236
},
2623726237
{
2623826238
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Compare\/Basehead.php",
26239-
"hash": "bfc9ee03d219636623bbde3a938b2751"
26239+
"hash": "a1d5fd3ac5695b04a52bc309e55d04a3"
2624026240
},
2624126241
{
2624226242
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Contents\/Path.php",
@@ -26532,7 +26532,7 @@
2653226532
},
2653326533
{
2653426534
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Merges.php",
26535-
"hash": "85d84ac03b6d73d3eb8024e91354dc87"
26535+
"hash": "eb5c1ca126517bbbbafb6d18583d3868"
2653626536
},
2653726537
{
2653826538
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Milestones.php",
@@ -27788,11 +27788,11 @@
2778827788
},
2778927789
{
2779027790
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php",
27791-
"hash": "e7abe40b6c23a63db1d22af67a244d0a"
27791+
"hash": "34097be811968901ed3316c689e3d3eb"
2779227792
},
2779327793
{
2779427794
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php",
27795-
"hash": "0d934126b3c4a55fdb6b817bd106c15e"
27795+
"hash": "b24dfb45ef8936c0dcfc11f99fb51c47"
2779627796
},
2779727797
{
2779827798
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon",
@@ -30285,6 +30285,14 @@
3028530285
{
3028630286
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/AliasAbstract\/TietA56E04B2\/Tiet87E35262\/Tiet960294EF\/Tiet9CED5A0E.php",
3028730287
"hash": "2cc0aacc6a4cef12676e8a260c2b0e83"
30288+
},
30289+
{
30290+
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Attribute\/CastUnionToType\/Schema\/Commit\/Author.php",
30291+
"hash": "ac1b7172489166e89480b03255d9beac"
30292+
},
30293+
{
30294+
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Attribute\/CastUnionToType\/Schema\/Commit\/Committer.php",
30295+
"hash": "e7db03df5ee771f105cc3dc7a3aa517e"
3028830296
}
3028930297
]
3029030298
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHub\Internal\Attribute\CastUnionToType\Schema\Commit;
6+
7+
use ApiClients\Client\GitHub\Schema;
8+
use Attribute;
9+
use EventSauce\ObjectHydrator\ObjectMapper;
10+
use EventSauce\ObjectHydrator\PropertyCaster;
11+
use Throwable;
12+
13+
use function array_keys;
14+
use function array_unique;
15+
use function implode;
16+
use function is_array;
17+
use function sort;
18+
19+
#[Attribute(Attribute::TARGET_PARAMETER)]
20+
final class Author implements PropertyCaster
21+
{
22+
public function cast(mixed $value, ObjectMapper $hydrator): mixed
23+
{
24+
if (is_array($value)) {
25+
$signatureChunks = array_unique(array_keys($value));
26+
sort($signatureChunks);
27+
$signature = implode('|', $signatureChunks);
28+
if ($signature === 'avatar_url|email|events_url|followers_url|following_url|gists_url|gravatar_id|html_url|id|login|name|node_id|organizations_url|received_events_url|repos_url|site_admin|starred_at|starred_url|subscriptions_url|type|url') {
29+
try {
30+
return $hydrator->hydrateObject(Schema\SimpleUser::class, $value);
31+
} catch (Throwable) {
32+
}
33+
}
34+
35+
if ($signature === '') {
36+
try {
37+
return $hydrator->hydrateObject(Schema\EmptyObject::class, $value);
38+
} catch (Throwable) {
39+
}
40+
}
41+
}
42+
43+
return $value;
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHub\Internal\Attribute\CastUnionToType\Schema\Commit;
6+
7+
use ApiClients\Client\GitHub\Schema;
8+
use Attribute;
9+
use EventSauce\ObjectHydrator\ObjectMapper;
10+
use EventSauce\ObjectHydrator\PropertyCaster;
11+
use Throwable;
12+
13+
use function array_keys;
14+
use function array_unique;
15+
use function implode;
16+
use function is_array;
17+
use function sort;
18+
19+
#[Attribute(Attribute::TARGET_PARAMETER)]
20+
final class Committer implements PropertyCaster
21+
{
22+
public function cast(mixed $value, ObjectMapper $hydrator): mixed
23+
{
24+
if (is_array($value)) {
25+
$signatureChunks = array_unique(array_keys($value));
26+
sort($signatureChunks);
27+
$signature = implode('|', $signatureChunks);
28+
if ($signature === 'avatar_url|email|events_url|followers_url|following_url|gists_url|gravatar_id|html_url|id|login|name|node_id|organizations_url|received_events_url|repos_url|site_admin|starred_at|starred_url|subscriptions_url|type|url') {
29+
try {
30+
return $hydrator->hydrateObject(Schema\SimpleUser::class, $value);
31+
} catch (Throwable) {
32+
}
33+
}
34+
35+
if ($signature === '') {
36+
try {
37+
return $hydrator->hydrateObject(Schema\EmptyObject::class, $value);
38+
} catch (Throwable) {
39+
}
40+
}
41+
}
42+
43+
return $value;
44+
}
45+
}

0 commit comments

Comments
 (0)