Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions psalm.baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@
<code><![CDATA[list<Reason::*>]]></code>
</MoreSpecificReturnType>
</file>
<file src="src/Service/Route53/src/Result/CreateHostedZoneResponse.php">
<PossiblyNullPropertyAssignmentValue>
<code><![CDATA[$headers['location'][0] ?? null]]></code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/Service/S3/src/Result/ListObjectsV2Output.php">
<LessSpecificReturnStatement>
<code>$items</code>
Expand Down Expand Up @@ -331,5 +326,5 @@
<code><![CDATA[list<KeyAgreementAlgorithmSpec::*>]]></code>
<code><![CDATA[list<SigningAlgorithmSpec::*>]]></code>
</MoreSpecificReturnType>
</file>
</file>
</files>
Original file line number Diff line number Diff line change
Expand Up @@ -190,39 +190,39 @@ private function generatePopulator(Operation $operation, StructureShape $shape,
$memberShape = $member->getShape();
switch ($memberShape->getType()) {
case 'timestamp':
$body .= strtr('$this->PROPERTY_NAME = isset($headers["LOCATION_NAME"][0]) ? new \DateTimeImmutable($headers["LOCATION_NAME"][0]) : null;' . "\n", [
'PROPERTY_NAME' => $propertyName,
'LOCATION_NAME' => $locationName,
]);
$propertyValue = 'new \DateTimeImmutable($headers["LOCATION_NAME"][0])';

break;
case 'integer':
case 'long':
$body .= strtr('$this->PROPERTY_NAME = isset($headers["LOCATION_NAME"][0]) ? (int) $headers["LOCATION_NAME"][0] : null;' . "\n", [
'PROPERTY_NAME' => $propertyName,
'LOCATION_NAME' => $locationName,
]);
$propertyValue = '(int) $headers["LOCATION_NAME"][0]';

break;
case 'boolean':
$this->requirementsRegistry->addRequirement('ext-filter');

$body .= strtr('$this->PROPERTY_NAME = isset($headers["LOCATION_NAME"][0]) ? filter_var($headers["LOCATION_NAME"][0], FILTER_VALIDATE_BOOLEAN) : null;' . "\n", [
'PROPERTY_NAME' => $propertyName,
'LOCATION_NAME' => $locationName,
]);
$propertyValue = 'filter_var($headers["LOCATION_NAME"][0], FILTER_VALIDATE_BOOLEAN)';

break;
case 'string':
$body .= strtr('$this->PROPERTY_NAME = $headers["LOCATION_NAME"][0] ?? null;' . "\n", [
'PROPERTY_NAME' => $propertyName,
'LOCATION_NAME' => $locationName,
]);
$propertyValue = '$headers["LOCATION_NAME"][0]';

break;
default:
throw new \RuntimeException(\sprintf('Type %s is not yet implemented', $memberShape->getType()));
}
if (!$member->isRequired()) {
if ('$headers["LOCATION_NAME"][0]' === $propertyValue) {
$propertyValue .= '?? null';
} else {
$propertyValue = 'isset($headers["LOCATION_NAME"][0]) ? ' . $propertyValue . ' : null';
}
}

$body .= strtr('$this->PROPERTY_NAME = ' . $propertyValue . ';' . "\n", [
'PROPERTY_NAME' => $propertyName,
'LOCATION_NAME' => $locationName,
]);
}

// This will catch arbitrary values that exists in undefined "headers"
Expand Down
4 changes: 4 additions & 0 deletions src/Service/Route53/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- AWS api-change: Added `us-isof-east-1` and `us-isof-south-1` regions

### Changed

- trust AWS's API response: And not check if required headers are present

## 2.6.0

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function populateResult(Response $response): void
{
$headers = $response->getHeaders();

$this->location = $headers['location'][0] ?? null;
$this->location = $headers['location'][0];

$data = new \SimpleXMLElement($response->getContent());
$this->hostedZone = $this->populateResultHostedZone($data->HostedZone);
Expand Down