Skip to content

Commit

Permalink
Fixed Psalm issues (#53)
Browse files Browse the repository at this point in the history
* Fixed Psalm issues

* added baseine
  • Loading branch information
Nyholm authored Feb 2, 2020
1 parent a2e67a8 commit b3b332d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 55 deletions.
18 changes: 9 additions & 9 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@
"source": "https:\/\/raw.githubusercontent.com\/aws\/aws-sdk-php\/3.133.6\/src\/data\/s3\/2006-03-01\/api-2.json",
"methods": {
"PutObject": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
},
"CreateBucket": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
},
"DeleteObject": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
},
"HeadObject": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
},
"CopyObject": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
},
"GetObject": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
},
"PutObjectAcl": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
},
"GetObjectAcl": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
},
"ListObjects": {
"generated": "2020-02-01T20:29:24+00:00",
"generated": "2020-02-02T12:13:18+00:00",
"generate-result-trait": false
}
}
Expand Down
8 changes: 8 additions & 0 deletions psalm.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.8.2@90d6b73fd8062432030ef39b7b6694b3902daa31">
<file src="src/Core/Credentials/IniFileProvider.php">
<UndefinedVariable occurrences="1">
<code>$homeDir</code>
</UndefinedVariable>
</file>
</files>
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm.baseline"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/CodeGenerator/Generator/ApiGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ private function setMethodBody(array $inputShape, Method $method, array $operati
];

$body .= '$xmlConfig = ' . $this->printArray($xml) . ";\n";
$body .= '$payload = (new XmlBuilder($input->get' . $inputShape['payload'] . '() ?? [], $xmlConfig))->getXml();' . "\n";
$body .= '$payload = (new XmlBuilder($input->requestBody(), $xmlConfig))->getXml();' . "\n";
}
$payloadVariable = '$payload';
} else {
Expand Down
1 change: 1 addition & 0 deletions src/Core/Credentials/IniFileProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ private function loadProfiles(array $filepaths): array
continue;
}
if ('~' === $filepath[0]) {
// FIXME is $homeDir ever defined?
$homeDir = $homeDir ?? $this->getHomeDir();
$filepath = $homeDir . \substr($filepath, 1);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ final public function resolve()
* Returns info on the current request
*
* @return array{
* resolved: bool
* resolved: bool,
* response?: ?ResponseInterface,
* status?: int
* }
Expand All @@ -93,7 +93,7 @@ final public function info(): array
return [
'resolved' => false,
'response' => $this->response,
'status' => $this->response->getInfo('http_code'),
'status' => (int) $this->response->getInfo('http_code'),
];
}

Expand Down
46 changes: 3 additions & 43 deletions src/S3/S3Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function createBucket($input): CreateBucketOutput
$input = CreateBucketRequest::create($input);
$input->validate();
$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/']];
$payload = (new XmlBuilder($input->getCreateBucketConfiguration() ?? [], $xmlConfig))->getXml();
$payload = (new XmlBuilder($input->requestBody(), $xmlConfig))->getXml();

$response = $this->getResponse(
'PUT',
Expand Down Expand Up @@ -299,48 +299,8 @@ public function putObjectAcl($input): PutObjectAclOutput
{
$input = PutObjectAclRequest::create($input);
$input->validate();
$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/',
],
];
$payload = (new XmlBuilder($input->getAccessControlPolicy() ?? [], $xmlConfig))->getXml();
$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/']];
$payload = (new XmlBuilder($input->requestBody(), $xmlConfig))->getXml();

$response = $this->getResponse(
'PUT',
Expand Down

0 comments on commit b3b332d

Please sign in to comment.