Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed missing return types in interfaces, and remove request methods from interfaces #229

Merged
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
6 changes: 5 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

$finder = PhpCsFixer\Finder::create()
->files()
->notPath([
__DIR__ . '/src/AmazonPHP/SellingPartner/ObjectSerializer.php'
])
->in([
__DIR__ . '/src',
__DIR__ . '/tools/src',
Expand Down Expand Up @@ -186,6 +189,8 @@
'phpdoc_types' => ['groups' => ['simple', 'meta']],
'phpdoc_types_order' => true,
'phpdoc_var_without_name' => true,
'phpdoc_to_param_type' => true,
'phpdoc_to_return_type' => true,
'pow_to_exponentiation' => true,
'protected_to_private' => true,
'return_assignment' => true,
Expand All @@ -207,7 +212,6 @@
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'phpdoc_to_param_type' => true,
'visibility_required' => [
'elements' => [
'const',
Expand Down
13 changes: 4 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@
"@clean",
"bin/generate.sh",
"@rector:process:force:php",
"@cs:php:fix",
"@rector:process:force:types",
"@cs:php:fix"
],
"build": [
"@static:analyze"
],
"static:analyze": [
"tools/vendor/bin/php-cs-fixer fix --dry-run"
"tools/vendor/bin/php-cs-fixer fix --dry-run",
"tools/vendor/bin/psalm"
],
"test": [
"@test:unit"
Expand All @@ -66,18 +65,14 @@
"test:functional": [
"tools/vendor/bin/phpunit --testsuite functional"
],
"rector:process": [
"rector:process:php": [
"Composer\\Config::disableProcessTimeout",
"tools/vendor/bin/rector process --dry-run"
"tools/vendor/bin/rector process --config=rector-php.php --dry-run"
],
"rector:process:force:php": [
"Composer\\Config::disableProcessTimeout",
"tools/vendor/bin/rector process --no-diffs --no-progress-bar --config=rector-php.php"
],
"rector:process:force:types": [
"Composer\\Config::disableProcessTimeout",
"tools/vendor/bin/rector process --no-diffs --no-progress-bar --config=rector-types.php"
],
"cs:php:fix": "tools/vendor/bin/php-cs-fixer fix",
"tools:install": "composer install --working-dir=./tools",
"post-install-cmd": [
Expand Down
16 changes: 16 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config tools/vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src/AmazonPHP/SellingPartner/Api" />
<directory name="src/AmazonPHP/SellingPartner/Model" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
7 changes: 3 additions & 4 deletions rector-php.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@
]);
$config->sets([
SetList::PHP_73,
SetList::PHP_74
SetList::PHP_74,
SetList::TYPE_DECLARATION,
SetList::TYPE_DECLARATION_STRICT
]);

$config->import(SetList::PHP_73);
$config->import(SetList::PHP_74);

/**
* Explanation here: https://github.com/amazon-php/sp-api-sdk/issues/101#issuecomment-1002159988
*/
Expand Down
23 changes: 0 additions & 23 deletions rector-types.php

This file was deleted.

29 changes: 0 additions & 29 deletions resources/php-amazon-selling-partner-api/api_interface.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,6 @@ use Psr\Http\Message\RequestInterface;
* @return {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}null{{/returnType}}
*/
public function {{operationId}}(AccessToken $accessToken, string $region{{^vendorExtensions.x-group-parameters}}{{#allParams}}, ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}{{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}, $associative_array{{/vendorExtensions.x-group-parameters}});


/**
* Create request for operation '{{{operationId}}}'
*
{{#vendorExtensions.x-group-parameters}}
* Note: the input parameter is an associative array with the keys listed as the parameter name below
*
{{/vendorExtensions.x-group-parameters}}
{{#servers}}
{{#-first}}
* This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
{{/-first}}
* URL: {{{url}}}
{{#-last}}
*
{{/-last}}
{{/servers}}
* @param AccessToken $accessToken
* @param string $region
{{#allParams}}
* @param {{{dataType}}}{{^required}}{{#defaultValue}}{{/defaultValue}}{{^defaultValue}}|null{{/defaultValue}}{{/required}} ${{paramName}} {{#description}}{{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}}
*
* @throws InvalidArgumentException
* @return RequestInterface
*/
public function {{operationId}}Request(AccessToken $accessToken, string $region{{^vendorExtensions.x-group-parameters}}{{#allParams}}, ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}{{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}, $associative_array{{/vendorExtensions.x-group-parameters}}) : RequestInterface;

{{/operation}}
}
{{/operations}}
22 changes: 2 additions & 20 deletions src/AmazonPHP/SellingPartner/Api/AplusContentApi/APlusSDK.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ public function createContentDocument(AccessToken $accessToken, string $region,
/**
* Create request for operation 'createContentDocument'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param \AmazonPHP\SellingPartner\Model\APlus\PostContentDocumentRequest $post_content_document_request The content document request details. (required)
*
Expand Down Expand Up @@ -258,6 +256,8 @@ public function createContentDocumentRequest(AccessToken $accessToken, string $r
/**
* Operation getContentDocument.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $content_reference_key The unique reference key for the A+ Content document. A content reference key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match any A+ Content identifier. (required)
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param string[] $included_data_set The set of A+ Content data types to include in the response. (required)
Expand Down Expand Up @@ -355,8 +355,6 @@ public function getContentDocument(AccessToken $accessToken, string $region, str
/**
* Create request for operation 'getContentDocument'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $content_reference_key The unique reference key for the A+ Content document. A content reference key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match any A+ Content identifier. (required)
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param string[] $included_data_set The set of A+ Content data types to include in the response. (required)
Expand Down Expand Up @@ -596,8 +594,6 @@ public function listContentDocumentAsinRelations(AccessToken $accessToken, strin
/**
* Create request for operation 'listContentDocumentAsinRelations'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $content_reference_key The unique reference key for the A+ Content document. A content reference key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match any A+ Content identifier. (required)
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param null|string[] $included_data_set The set of A+ Content data types to include in the response. If you do not include this parameter, the operation returns the related ASINs without metadata. (optional)
Expand Down Expand Up @@ -849,8 +845,6 @@ public function postContentDocumentApprovalSubmission(AccessToken $accessToken,
/**
* Create request for operation 'postContentDocumentApprovalSubmission'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $content_reference_key The unique reference key for the A+ Content document. A content reference key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match any A+ content identifier. (required)
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
*
Expand Down Expand Up @@ -1068,8 +1062,6 @@ public function postContentDocumentAsinRelations(AccessToken $accessToken, strin
/**
* Create request for operation 'postContentDocumentAsinRelations'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $content_reference_key The unique reference key for the A+ Content document. A content reference key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match any A+ content identifier. (required)
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param \AmazonPHP\SellingPartner\Model\APlus\PostContentDocumentAsinRelationsRequest $post_content_document_asin_relations_request The content document ASIN relations request details. (required)
Expand Down Expand Up @@ -1302,8 +1294,6 @@ public function postContentDocumentSuspendSubmission(AccessToken $accessToken, s
/**
* Create request for operation 'postContentDocumentSuspendSubmission'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $content_reference_key The unique reference key for the A+ Content document. A content reference key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match any A+ content identifier. (required)
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
*
Expand Down Expand Up @@ -1520,8 +1510,6 @@ public function searchContentDocuments(AccessToken $accessToken, string $region,
/**
* Create request for operation 'searchContentDocuments'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param null|string $page_token A page token from the nextPageToken response element returned by your previous call to this operation. nextPageToken is returned when the results of a call exceed the page size. To get the next page of results, call the operation and include pageToken as the only parameter. Specifying pageToken with any other parameter will cause the request to fail. When no nextPageToken value is returned there are no more pages to return. A pageToken value is not usable across different operations. (optional)
*
Expand Down Expand Up @@ -1731,8 +1719,6 @@ public function searchContentPublishRecords(AccessToken $accessToken, string $re
/**
* Create request for operation 'searchContentPublishRecords'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN). (required)
* @param null|string $page_token A page token from the nextPageToken response element returned by your previous call to this operation. nextPageToken is returned when the results of a call exceed the page size. To get the next page of results, call the operation and include pageToken as the only parameter. Specifying pageToken with any other parameter will cause the request to fail. When no nextPageToken value is returned there are no more pages to return. A pageToken value is not usable across different operations. (optional)
Expand Down Expand Up @@ -1962,8 +1948,6 @@ public function updateContentDocument(AccessToken $accessToken, string $region,
/**
* Create request for operation 'updateContentDocument'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $content_reference_key The unique reference key for the A+ Content document. A content reference key cannot form a permalink and may change in the future. A content reference key is not guaranteed to match any A+ Content identifier. (required)
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param \AmazonPHP\SellingPartner\Model\APlus\PostContentDocumentRequest $post_content_document_request The content document request details. (required)
Expand Down Expand Up @@ -2197,8 +2181,6 @@ public function validateContentDocumentAsinRelations(AccessToken $accessToken, s
/**
* Create request for operation 'validateContentDocumentAsinRelations'.
*
* @param AccessToken $accessToken
* @param string $region
* @param string $marketplace_id The identifier for the marketplace where the A+ Content is published. (required)
* @param \AmazonPHP\SellingPartner\Model\APlus\PostContentDocumentRequest $post_content_document_request The content document request details. (required)
* @param null|string[] $asin_set The set of ASINs. (optional)
Expand Down
Loading