Skip to content

PHPDoc Shopping\Types\ProductIDType::$type #3

@quazardous

Description

@quazardous

phpstan complains on

$request = new FindProductsRequestType();
$request->ProductID = new ProductIDType();
$request->ProductID->type = 'EAN'; // <<< [phpstan] Property DTS\eBaySDK\Shopping\Types\ProductIDType::$type (DTS\eBaySDK\Shopping\Enums\ProductIDCodeType) does not accept string.
$request->ProductID->value = $ean;
namespace DTS\eBaySDK\Shopping\Types;

/**
 *
 * @property \DTS\eBaySDK\Shopping\Enums\ProductIDCodeType $type
 */
class ProductIDType extends \DTS\eBaySDK\Types\StringType
{
...

(The code is working, but I'm not sure on the good way to write it)

EDIT:

works good too without warning from phpstan

$request = new FindProductsRequestType();
$request->ProductID = new ProductIDType(['value' => $ean, 'type' => 'EAN']);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions