Skip to content

Commit 5704214

Browse files
fix: phpstan error, bug
1 parent 550d184 commit 5704214

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

src/SiteKitResourceChannelFactory.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
/**
1010
* @phpstan-type ContextPhp array{
11+
* tenant: array{
12+
* id: string,
13+
* name: string,
14+
* anchor: string,
15+
* attributes: array<string, mixed>
16+
* },
1117
* publisher: array{
1218
* id: int,
1319
* name: string,
@@ -17,7 +23,7 @@
1723
* nature: ?string,
1824
* locale: ?string,
1925
* encoding: ?string,
20-
* translationLocales: ?string[]
26+
* translationLocales: ?string[],
2127
* }
2228
* }
2329
*/
@@ -64,10 +70,19 @@ public function create(): ResourceChannel
6470
$this->configDir,
6571
$searchIndex,
6672
$data['publisher']['translationLocales'] ?? [],
67-
$this->createTenant($data['tanent'] ?? $data['client'] /* deprecated */ ?? []),
73+
$this->createTenant($data['tenant']),
6874
);
6975
}
7076

77+
/**
78+
* @param array{
79+
* id: string,
80+
* name: string,
81+
* anchor: string,
82+
* attributes: array<string, mixed>,
83+
* } $data
84+
* @return ResourceTenant
85+
*/
7186
private function createTenant(array $data): ResourceTenant
7287
{
7388
return new ResourceTenant(
@@ -90,6 +105,11 @@ private function loadContextPhpFile(): array
90105
);
91106
}
92107

108+
if (isset($context['client'])) {
109+
$context['tenant'] = $context['client'];
110+
unset($context['client']);
111+
}
112+
93113
/** @var ContextPhp $context */
94114
return $context;
95115
}

test/resources/SiteKitResourceChannelFactory/documentRootLayout/WEB-IES/context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return [
4-
'tanent' => [
4+
'client' => [
55
'id' => '2',
66
'name' => 'Test-Tanent',
77
'anchor' => 'test-tanent',

test/resources/SiteKitResourceChannelFactory/resourceLayout/context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return [
4-
'tanent' => [
4+
'tenant' => [
55
'id' => '2',
66
'name' => 'Test-Tanent',
77
'anchor' => 'test-tanent',

0 commit comments

Comments
 (0)