Skip to content

Commit f38dd51

Browse files
committed
Default rest of parameters after first default
1 parent 85b1ef0 commit f38dd51

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Tool/Generator.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ private function writeClass(string $namespacedClass, string $apiPath, array $pro
495495
$parameters = [];
496496
$passedParameters = [];
497497
$docblock = '';
498+
$restDefault = false;
498499

499500
foreach ($specs['parameters'] ?? [] as $parameter)
500501
{
@@ -521,13 +522,14 @@ private function writeClass(string $namespacedClass, string $apiPath, array $pro
521522
$description = $parameter['description'] ?? '';
522523
$passedParameters[] = "{$dollar}{$name}";
523524
$docblock .= "\n\t * @param {$type} {$dollar}{$name} {$description}";
524-
$required = $parameter['required'] ?? false;
525+
$required = ($parameter['required'] ?? false) && ! $restDefault;
525526
$parameterString = $required ? '' : '?';
526527
$parameterString .= $type . ' $' . $name;
527528

528529
if (! $required)
529530
{
530531
$parameterString .= ' = null';
532+
$restDefault = true;
531533
}
532534
$parameters[$name] = $parameterString;
533535
}

src/ConstantContact/V3/Reports/SummaryReports/SmsCampaignSummaries.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@ public function __construct(\PHPFUI\ConstantContact\Client $client)
2929
* @param string $start_at Use to limit the results to include SMS campaign summary details for SMS campaigns sent on or after the required `start_at` date you specify. ISO 8601 format.
3030
* @param string $end_at Use to limit the results to include SMS campaign summary details for SMS campaigns sent on or before the `end_at` date you specify. ISO 8601 format.
3131
*/
32-
public function get(?string $limit = null, string $start_at, ?string $end_at = null) : ?array
32+
public function get(?string $limit = null, ?string $start_at = null, ?string $end_at = null) : ?array
3333
{
3434

3535
return $this->doGet(['limit' => $limit, 'start_at' => $start_at, 'end_at' => $end_at, ]);
3636
}
3737

38-
public function getTyped(?string $limit = null, string $start_at, ?string $end_at = null) : ?\PHPFUI\ConstantContact\Definition\SmsCampaignSummariesPage
38+
public function getTyped(?string $limit = null, ?string $start_at = null, ?string $end_at = null) : ?\PHPFUI\ConstantContact\Definition\SmsCampaignSummariesPage
3939
{
4040
$data = $this->get($limit, $start_at, $end_at);
4141

4242
return $data ? new \PHPFUI\ConstantContact\Definition\SmsCampaignSummariesPage($data) : null;
4343
}
44-
4544
}

0 commit comments

Comments
 (0)