Skip to content

Commit b3b332d

Browse files
authored
Fixed Psalm issues (#53)
* Fixed Psalm issues * added baseine
1 parent a2e67a8 commit b3b332d

File tree

7 files changed

+25
-55
lines changed

7 files changed

+25
-55
lines changed

manifest.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,39 @@
44
"source": "https:\/\/raw.githubusercontent.com\/aws\/aws-sdk-php\/3.133.6\/src\/data\/s3\/2006-03-01\/api-2.json",
55
"methods": {
66
"PutObject": {
7-
"generated": "2020-02-01T20:29:24+00:00",
7+
"generated": "2020-02-02T12:13:18+00:00",
88
"generate-result-trait": false
99
},
1010
"CreateBucket": {
11-
"generated": "2020-02-01T20:29:24+00:00",
11+
"generated": "2020-02-02T12:13:18+00:00",
1212
"generate-result-trait": false
1313
},
1414
"DeleteObject": {
15-
"generated": "2020-02-01T20:29:24+00:00",
15+
"generated": "2020-02-02T12:13:18+00:00",
1616
"generate-result-trait": false
1717
},
1818
"HeadObject": {
19-
"generated": "2020-02-01T20:29:24+00:00",
19+
"generated": "2020-02-02T12:13:18+00:00",
2020
"generate-result-trait": false
2121
},
2222
"CopyObject": {
23-
"generated": "2020-02-01T20:29:24+00:00",
23+
"generated": "2020-02-02T12:13:18+00:00",
2424
"generate-result-trait": false
2525
},
2626
"GetObject": {
27-
"generated": "2020-02-01T20:29:24+00:00",
27+
"generated": "2020-02-02T12:13:18+00:00",
2828
"generate-result-trait": false
2929
},
3030
"PutObjectAcl": {
31-
"generated": "2020-02-01T20:29:24+00:00",
31+
"generated": "2020-02-02T12:13:18+00:00",
3232
"generate-result-trait": false
3333
},
3434
"GetObjectAcl": {
35-
"generated": "2020-02-01T20:29:24+00:00",
35+
"generated": "2020-02-02T12:13:18+00:00",
3636
"generate-result-trait": false
3737
},
3838
"ListObjects": {
39-
"generated": "2020-02-01T20:29:24+00:00",
39+
"generated": "2020-02-02T12:13:18+00:00",
4040
"generate-result-trait": false
4141
}
4242
}

psalm.baseline

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<files psalm-version="3.8.2@90d6b73fd8062432030ef39b7b6694b3902daa31">
3+
<file src="src/Core/Credentials/IniFileProvider.php">
4+
<UndefinedVariable occurrences="1">
5+
<code>$homeDir</code>
6+
</UndefinedVariable>
7+
</file>
8+
</files>

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xmlns="https://getpsalm.org/schema/config"
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
errorBaseline="psalm.baseline"
89
>
910
<projectFiles>
1011
<directory name="src" />

src/CodeGenerator/Generator/ApiGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ private function setMethodBody(array $inputShape, Method $method, array $operati
440440
];
441441

442442
$body .= '$xmlConfig = ' . $this->printArray($xml) . ";\n";
443-
$body .= '$payload = (new XmlBuilder($input->get' . $inputShape['payload'] . '() ?? [], $xmlConfig))->getXml();' . "\n";
443+
$body .= '$payload = (new XmlBuilder($input->requestBody(), $xmlConfig))->getXml();' . "\n";
444444
}
445445
$payloadVariable = '$payload';
446446
} else {

src/Core/Credentials/IniFileProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ private function loadProfiles(array $filepaths): array
9191
continue;
9292
}
9393
if ('~' === $filepath[0]) {
94+
// FIXME is $homeDir ever defined?
9495
$homeDir = $homeDir ?? $this->getHomeDir();
9596
$filepath = $homeDir . \substr($filepath, 1);
9697
}

src/Core/Result.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ final public function resolve()
7777
* Returns info on the current request
7878
*
7979
* @return array{
80-
* resolved: bool
80+
* resolved: bool,
8181
* response?: ?ResponseInterface,
8282
* status?: int
8383
* }
@@ -93,7 +93,7 @@ final public function info(): array
9393
return [
9494
'resolved' => false,
9595
'response' => $this->response,
96-
'status' => $this->response->getInfo('http_code'),
96+
'status' => (int) $this->response->getInfo('http_code'),
9797
];
9898
}
9999

src/S3/S3Client.php

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function createBucket($input): CreateBucketOutput
106106
$input = CreateBucketRequest::create($input);
107107
$input->validate();
108108
$xmlConfig = ['CreateBucketConfiguration' => ['type' => 'structure','members' => ['LocationConstraint' => ['shape' => 'BucketLocationConstraint']]],'BucketLocationConstraint' => ['type' => 'string'],'_root' => ['type' => 'CreateBucketConfiguration','xmlName' => 'CreateBucketConfiguration','uri' => 'http://s3.amazonaws.com/doc/2006-03-01/']];
109-
$payload = (new XmlBuilder($input->getCreateBucketConfiguration() ?? [], $xmlConfig))->getXml();
109+
$payload = (new XmlBuilder($input->requestBody(), $xmlConfig))->getXml();
110110

111111
$response = $this->getResponse(
112112
'PUT',
@@ -299,48 +299,8 @@ public function putObjectAcl($input): PutObjectAclOutput
299299
{
300300
$input = PutObjectAclRequest::create($input);
301301
$input->validate();
302-
$xmlConfig = [
303-
'AccessControlPolicy' => [
304-
'type' => 'structure',
305-
'members' => [
306-
'Grants' => ['shape' => 'Grants', 'locationName' => 'AccessControlList'],
307-
'Owner' => ['shape' => 'Owner'],
308-
],
309-
],
310-
'Grants' => ['type' => 'list', 'member' => ['shape' => 'Grant', 'locationName' => 'Grant']],
311-
'Grant' => [
312-
'type' => 'structure',
313-
'members' => ['Grantee' => ['shape' => 'Grantee'], 'Permission' => ['shape' => 'Permission']],
314-
],
315-
'Grantee' => [
316-
'type' => 'structure',
317-
'required' => [0 => 'Type'],
318-
'members' => [
319-
'DisplayName' => ['shape' => 'DisplayName'],
320-
'EmailAddress' => ['shape' => 'EmailAddress'],
321-
'ID' => ['shape' => 'ID'],
322-
'Type' => ['shape' => 'Type', 'locationName' => 'xsi:type', 'xmlAttribute' => '1'],
323-
'URI' => ['shape' => 'URI'],
324-
],
325-
'xmlNamespace' => ['prefix' => 'xsi', 'uri' => 'http://www.w3.org/2001/XMLSchema-instance'],
326-
],
327-
'DisplayName' => ['type' => 'string'],
328-
'EmailAddress' => ['type' => 'string'],
329-
'ID' => ['type' => 'string'],
330-
'Type' => ['type' => 'string'],
331-
'URI' => ['type' => 'string'],
332-
'Permission' => ['type' => 'string'],
333-
'Owner' => [
334-
'type' => 'structure',
335-
'members' => ['DisplayName' => ['shape' => 'DisplayName'], 'ID' => ['shape' => 'ID']],
336-
],
337-
'_root' => [
338-
'type' => 'AccessControlPolicy',
339-
'xmlName' => 'AccessControlPolicy',
340-
'uri' => 'http://s3.amazonaws.com/doc/2006-03-01/',
341-
],
342-
];
343-
$payload = (new XmlBuilder($input->getAccessControlPolicy() ?? [], $xmlConfig))->getXml();
302+
$xmlConfig = ['AccessControlPolicy' => ['type' => 'structure','members' => ['Grants' => ['shape' => 'Grants','locationName' => 'AccessControlList'],'Owner' => ['shape' => 'Owner']]],'Grants' => ['type' => 'list','member' => ['shape' => 'Grant','locationName' => 'Grant']],'Grant' => ['type' => 'structure','members' => ['Grantee' => ['shape' => 'Grantee'],'Permission' => ['shape' => 'Permission']]],'Grantee' => ['type' => 'structure','required' => [0 => 'Type'],'members' => ['DisplayName' => ['shape' => 'DisplayName'],'EmailAddress' => ['shape' => 'EmailAddress'],'ID' => ['shape' => 'ID'],'Type' => ['shape' => 'Type','locationName' => 'xsi:type','xmlAttribute' => '1'],'URI' => ['shape' => 'URI']],'xmlNamespace' => ['prefix' => 'xsi','uri' => 'http://www.w3.org/2001/XMLSchema-instance']],'DisplayName' => ['type' => 'string'],'EmailAddress' => ['type' => 'string'],'ID' => ['type' => 'string'],'Type' => ['type' => 'string'],'URI' => ['type' => 'string'],'Permission' => ['type' => 'string'],'Owner' => ['type' => 'structure','members' => ['DisplayName' => ['shape' => 'DisplayName'],'ID' => ['shape' => 'ID']]],'_root' => ['type' => 'AccessControlPolicy','xmlName' => 'AccessControlPolicy','uri' => 'http://s3.amazonaws.com/doc/2006-03-01/']];
303+
$payload = (new XmlBuilder($input->requestBody(), $xmlConfig))->getXml();
344304

345305
$response = $this->getResponse(
346306
'PUT',

0 commit comments

Comments
 (0)