diff --git a/CHANGELOG.md b/CHANGELOG.md index bd06fb8ea..b7033817d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,23 @@ # Changelog +## 10.13.0 - 2023-05-11 +* [#1490](https://github.com/stripe/stripe-php/pull/1490) Update generated code + * Add support for `paypal` on `PaymentMethod` + * Add support for `effective_percentage` on `TaxRate` +* [#1488](https://github.com/stripe/stripe-php/pull/1488) Increment PHPStan to strictness level 2 +* [#1483](https://github.com/stripe/stripe-php/pull/1483) Update generated code + +* [#1480](https://github.com/stripe/stripe-php/pull/1480) Update generated code + * Change type of `Identity.VerificationSession.options` from `VerificationSessionOptions` to `nullable(VerificationSessionOptions)` + * Change type of `Identity.VerificationSession.type` from `enum('document'|'id_number')` to `nullable(enum('document'|'id_number'))` +* [#1478](https://github.com/stripe/stripe-php/pull/1478) Update generated code + * Release specs are identical. +* [#1475](https://github.com/stripe/stripe-php/pull/1475) Update generated code + ## 10.13.0-beta.4 - 2023-04-20 * [#1481](https://github.com/stripe/stripe-php/pull/1481) Update generated code for beta * Add support for `country_options` on `Tax.Registration` - * Remove support for `state` and `type` on `Tax.Registration` + * Remove support for `state` and `type` on `Tax.Registration` ## 10.13.0-beta.3 - 2023-04-13 * [#1477](https://github.com/stripe/stripe-php/pull/1477) Update generated code for beta diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 2b3b8788c..39d1ab845 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v313 \ No newline at end of file +v338 \ No newline at end of file diff --git a/lib/ApiOperations/SingletonRetrieve.php b/lib/ApiOperations/SingletonRetrieve.php index baae67e12..59c52c3ae 100644 --- a/lib/ApiOperations/SingletonRetrieve.php +++ b/lib/ApiOperations/SingletonRetrieve.php @@ -11,9 +11,8 @@ trait SingletonRetrieve { /** - * @param array|string $id the ID of the API resource to retrieve, + * @param null|array|string $opts the ID of the API resource to retrieve, * or an options array containing an `id` key - * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * diff --git a/lib/ApiRequestor.php b/lib/ApiRequestor.php index 7162e33b5..6a9a9282a 100644 --- a/lib/ApiRequestor.php +++ b/lib/ApiRequestor.php @@ -325,7 +325,7 @@ private static function _defaultHeaders($apiKey, $clientInfo = null) $uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION; $langVersion = \PHP_VERSION; - $uname_disabled = static::_isDisabled(\ini_get('disable_functions'), 'php_uname'); + $uname_disabled = self::_isDisabled(\ini_get('disable_functions'), 'php_uname'); $uname = $uname_disabled ? '(disabled)' : \php_uname(); $appInfo = Stripe::getAppInfo(); @@ -377,7 +377,7 @@ private function _prepareRequest($method, $url, $params, $headers) if ($params && \is_array($params)) { $optionKeysInParams = \array_filter( - static::$OPTIONS_KEYS, + self::$OPTIONS_KEYS, function ($key) use ($params) { return \array_key_exists($key, $params); } diff --git a/lib/ApiResource.php b/lib/ApiResource.php index 25c6b84a0..c0765c80f 100644 --- a/lib/ApiResource.php +++ b/lib/ApiResource.php @@ -4,7 +4,8 @@ /** * Class ApiResource. - */ + * + * */ abstract class ApiResource extends StripeObject { use ApiOperations\Request; diff --git a/lib/Service/AbstractService.php b/lib/Service/AbstractService.php index 145af6759..44392c452 100644 --- a/lib/Service/AbstractService.php +++ b/lib/Service/AbstractService.php @@ -72,22 +72,28 @@ private static function formatParams($params) protected function request($method, $path, $params, $opts) { - return $this->getClient()->request($method, $path, static::formatParams($params), $opts); + return $this->getClient()->request($method, $path, self::formatParams($params), $opts); } protected function requestStream($method, $path, $readBodyChunkCallable, $params, $opts) { - return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, static::formatParams($params), $opts); + // TODO (MAJOR): Add this method to StripeClientInterface + // @phpstan-ignore-next-line + return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, self::formatParams($params), $opts); } protected function requestCollection($method, $path, $params, $opts) { - return $this->getClient()->requestCollection($method, $path, static::formatParams($params), $opts); + // TODO (MAJOR): Add this method to StripeClientInterface + // @phpstan-ignore-next-line + return $this->getClient()->requestCollection($method, $path, self::formatParams($params), $opts); } protected function requestSearchResult($method, $path, $params, $opts) { - return $this->getClient()->requestSearchResult($method, $path, static::formatParams($params), $opts); + // TODO (MAJOR): Add this method to StripeClientInterface + // @phpstan-ignore-next-line + return $this->getClient()->requestSearchResult($method, $path, self::formatParams($params), $opts); } protected function buildPath($basePath, ...$ids) diff --git a/lib/Service/Capital/FinancingOfferService.php b/lib/Service/Capital/FinancingOfferService.php index f06f1f536..b36d7e3c4 100644 --- a/lib/Service/Capital/FinancingOfferService.php +++ b/lib/Service/Capital/FinancingOfferService.php @@ -24,8 +24,7 @@ public function all($params = null, $opts = null) /** * Acknowledges that platform has received and delivered the financing_offer to the - * intended merchant recipient. This is required to make the application - * accessible. + * intended merchant recipient. * * @param string $id * @param null|array $params diff --git a/lib/StripeObject.php b/lib/StripeObject.php index 844cfebd5..40b175323 100644 --- a/lib/StripeObject.php +++ b/lib/StripeObject.php @@ -4,6 +4,8 @@ /** * Class StripeObject. + * + * @property null|string $id */ class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable { diff --git a/lib/Tax/Registration.php b/lib/Tax/Registration.php index e7be1c82c..ddf60d6ac 100644 --- a/lib/Tax/Registration.php +++ b/lib/Tax/Registration.php @@ -14,6 +14,9 @@ * register to collect tax, see our guide. * + * Related guide: Using the + * Registrations API. + * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $active_from Time at which the registration becomes active. Measured in seconds since the Unix epoch. diff --git a/lib/Tax/Settings.php b/lib/Tax/Settings.php index a2d96b581..a8bacb405 100644 --- a/lib/Tax/Settings.php +++ b/lib/Tax/Settings.php @@ -8,13 +8,14 @@ * You can use Tax Settings to manage configurations used by Stripe * Tax calculations. * - * Related guide: Account - * settings. + * Related guide: Using the + * Settings API. * * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \Stripe\StripeObject $defaults + * @property null|\Stripe\StripeObject $head_office The place where your business is located. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. - * @property \Stripe\StripeObject[] $locations The places where your business is located. + * @property null|\Stripe\StripeObject[] $locations The deprecated places where your business is located. */ class Settings extends \Stripe\SingletonApiResource { diff --git a/lib/TaxRate.php b/lib/TaxRate.php index acf7b9ba3..80947bbac 100644 --- a/lib/TaxRate.php +++ b/lib/TaxRate.php @@ -22,6 +22,7 @@ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $description An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. * @property string $display_name The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page. + * @property null|float $effective_percentage Actual/effective tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true, this percentage does not include the statutory tax rate of non-taxable jurisdictions. * @property bool $inclusive This specifies if the tax rate is inclusive or exclusive. * @property null|string $jurisdiction The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. diff --git a/lib/Util/CaseInsensitiveArray.php b/lib/Util/CaseInsensitiveArray.php index 5e1ac7de9..262bca7ea 100644 --- a/lib/Util/CaseInsensitiveArray.php +++ b/lib/Util/CaseInsensitiveArray.php @@ -45,7 +45,7 @@ public function getIterator() #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { - $offset = static::maybeLowercase($offset); + $offset = self::maybeLowercase($offset); if (null === $offset) { $this->container[] = $value; } else { @@ -59,7 +59,7 @@ public function offsetSet($offset, $value) #[\ReturnTypeWillChange] public function offsetExists($offset) { - $offset = static::maybeLowercase($offset); + $offset = self::maybeLowercase($offset); return isset($this->container[$offset]); } @@ -70,7 +70,7 @@ public function offsetExists($offset) #[\ReturnTypeWillChange] public function offsetUnset($offset) { - $offset = static::maybeLowercase($offset); + $offset = self::maybeLowercase($offset); unset($this->container[$offset]); } @@ -80,7 +80,7 @@ public function offsetUnset($offset) #[\ReturnTypeWillChange] public function offsetGet($offset) { - $offset = static::maybeLowercase($offset); + $offset = self::maybeLowercase($offset); return isset($this->container[$offset]) ? $this->container[$offset] : null; } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index fb066c682..983b38e60 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,7 +2,7 @@ includes: - phpstan-baseline.neon parameters: - level: 1 + level: 2 bootstrapFiles: - tests/bootstrap.php diff --git a/tests/Stripe/AccountTest.php b/tests/Stripe/AccountTest.php index 5e4e723cf..61ae41317 100644 --- a/tests/Stripe/AccountTest.php +++ b/tests/Stripe/AccountTest.php @@ -209,7 +209,6 @@ public function testCanDeleteExternalAccount() '/v1/accounts/' . self::TEST_RESOURCE_ID . '/external_accounts/' . self::TEST_EXTERNALACCOUNT_ID ); $resource = Account::deleteExternalAccount(self::TEST_RESOURCE_ID, self::TEST_EXTERNALACCOUNT_ID); - static::assertTrue($resource->deleted); } public function testCanListExternalAccounts() @@ -277,7 +276,7 @@ public function testCanDeletePerson() '/v1/accounts/' . self::TEST_RESOURCE_ID . '/persons/' . self::TEST_PERSON_ID ); $resource = Account::deletePerson(self::TEST_RESOURCE_ID, self::TEST_PERSON_ID); - static::assertTrue($resource->deleted); + static::assertInstanceOf(\Stripe\Person::class, $resource); } public function testCanListPersons() @@ -290,13 +289,15 @@ public function testCanListPersons() static::compatAssertIsArray($resources->data); } + // TODO (MAJOR): Remove legal_entity/additional_owners logic. public function testSerializeNewAdditionalOwners() { + /** @var Account $obj */ $obj = Util\Util::convertToStripeObject([ 'object' => 'account', 'legal_entity' => StripeObject::constructFrom([]), ], null); - $obj->legal_entity->additional_owners = [ + $obj['legal_entity']->additional_owners = [ ['first_name' => 'Joe'], ['first_name' => 'Jane'], ]; @@ -323,7 +324,7 @@ public function testSerializeAddAdditionalOwners() ], ], ], null); - $obj->legal_entity->additional_owners[2] = ['first_name' => 'Andrew']; + $obj['legal_entity']->additional_owners[2] = ['first_name' => 'Andrew']; $expected = [ 'legal_entity' => [ @@ -346,7 +347,7 @@ public function testSerializePartiallyChangedAdditionalOwners() ], ], ], null); - $obj->legal_entity->additional_owners[1]->first_name = 'Stripe'; + $obj['legal_entity']->additional_owners[1]->first_name = 'Stripe'; $expected = [ 'legal_entity' => [ @@ -389,7 +390,7 @@ public function testSerializeUnsetAdditionalOwners() ], ], ], null); - $obj->legal_entity->additional_owners = null; + $obj['legal_entity']->additional_owners = null; // Note that the empty string that we send for this one has a special // meaning for the server, which interprets it as an array unset. @@ -414,7 +415,7 @@ public function testSerializeAdditionalOwnersDeletedItem() ], ], ], null); - unset($obj->legal_entity->additional_owners[0]); + unset($obj['legal_entity']->additional_owners[0]); $obj->serializeParameters(); } @@ -424,7 +425,7 @@ public function testSerializeExternalAccountString() $obj = Util\Util::convertToStripeObject([ 'object' => 'account', ], null); - $obj->external_account = 'btok_123'; + $obj['external_account'] = 'btok_123'; $expected = [ 'external_account' => 'btok_123', @@ -437,7 +438,7 @@ public function testSerializeExternalAccountHash() $obj = Util\Util::convertToStripeObject([ 'object' => 'account', ], null); - $obj->external_account = [ + $obj['external_account'] = [ 'object' => 'bank_account', 'routing_number' => '110000000', 'account_number' => '000123456789', @@ -462,7 +463,7 @@ public function testSerializeBankAccountString() $obj = Util\Util::convertToStripeObject([ 'object' => 'account', ], null); - $obj->bank_account = 'btok_123'; + $obj['bank_account'] = 'btok_123'; $expected = [ 'bank_account' => 'btok_123', @@ -475,7 +476,7 @@ public function testSerializeBankAccountHash() $obj = Util\Util::convertToStripeObject([ 'object' => 'account', ], null); - $obj->bank_account = [ + $obj['bank_account'] = [ 'object' => 'bank_account', 'routing_number' => '110000000', 'account_number' => '000123456789', @@ -497,6 +498,7 @@ public function testSerializeBankAccountHash() public function testSerializeNewIndividual() { + /** @var \Stripe\Account $obj */ $obj = Util\Util::convertToStripeObject([ 'object' => 'account', ], null); @@ -508,6 +510,7 @@ public function testSerializeNewIndividual() public function testSerializePartiallyChangedIndividual() { + /** @var \Stripe\Account $obj */ $obj = Util\Util::convertToStripeObject([ 'object' => 'account', 'individual' => Util\Util::convertToStripeObject([ @@ -537,6 +540,7 @@ public function testSerializeUnchangedIndividual() public function testSerializeUnsetIndividual() { + /** @var \Stripe\Account $obj */ $obj = Util\Util::convertToStripeObject([ 'object' => 'account', 'individual' => Util\Util::convertToStripeObject([ diff --git a/tests/Stripe/CustomerTest.php b/tests/Stripe/CustomerTest.php index 8cf86e4a3..d5b4f5ae2 100644 --- a/tests/Stripe/CustomerTest.php +++ b/tests/Stripe/CustomerTest.php @@ -142,6 +142,7 @@ public function testCanListSources() public function testSerializeSourceString() { + /** @var mixed $obj */ $obj = Util\Util::convertToStripeObject([ 'object' => 'customer', ], null); @@ -155,6 +156,7 @@ public function testSerializeSourceString() public function testSerializeSourceMap() { + /** @var mixed $obj */ $obj = Util\Util::convertToStripeObject([ 'object' => 'customer', ], null); diff --git a/tests/Stripe/OAuthTest.php b/tests/Stripe/OAuthTest.php index a5a45886e..e1245797b 100644 --- a/tests/Stripe/OAuthTest.php +++ b/tests/Stripe/OAuthTest.php @@ -73,7 +73,7 @@ public function testToken() 'grant_type' => 'authorization_code', 'code' => 'this_is_an_authorization_code', ]); - static::assertSame('sk_access_token', $resp->access_token); + static::assertSame('sk_access_token', $resp['access_token']); } public function testDeauthorize() @@ -97,6 +97,6 @@ public function testDeauthorize() $resp = OAuth::deauthorize([ 'stripe_user_id' => 'acct_test_deauth', ]); - static::assertSame('acct_test_deauth', $resp->stripe_user_id); + static::assertSame('acct_test_deauth', $resp['stripe_user_id']); } } diff --git a/tests/Stripe/Service/OAuthServiceTest.php b/tests/Stripe/Service/OAuthServiceTest.php index d20e471e5..951ea8176 100644 --- a/tests/Stripe/Service/OAuthServiceTest.php +++ b/tests/Stripe/Service/OAuthServiceTest.php @@ -109,7 +109,7 @@ public function testToken() 'grant_type' => 'authorization_code', 'code' => 'this_is_an_authorization_code', ]); - static::assertSame('sk_access_token', $resp->access_token); + static::assertSame('sk_access_token', $resp['access_token']); } public function testDeauthorize() @@ -135,6 +135,6 @@ public function testDeauthorize() 'client_id' => 'ca_123', 'stripe_user_id' => 'acct_test', ]); - static::assertSame('acct_test', $resp->stripe_user_id); + static::assertSame('acct_test', $resp['stripe_user_id']); } } diff --git a/tests/Stripe/SourceTest.php b/tests/Stripe/SourceTest.php index 9f34c9d95..7407e5fee 100644 --- a/tests/Stripe/SourceTest.php +++ b/tests/Stripe/SourceTest.php @@ -86,12 +86,15 @@ public function testCanSaveCardExpiryDate() $response ); - $source->card->exp_month = 12; - $source->card->exp_year = 2022; + /** @var mixed $card */ + $card = $source->card; + + $card->exp_month = 12; + $card->exp_year = 2022; $source->save(); - static::assertSame(12, $source->card->exp_month); - static::assertSame(2022, $source->card->exp_year); + static::assertSame(12, $source['card']['exp_month']); + static::assertSame(2022, $source['card']['exp_year']); } public function testIsDetachableWhenAttached() diff --git a/tests/Stripe/StripeObjectTest.php b/tests/Stripe/StripeObjectTest.php index f07c47f1e..c8e0903dd 100644 --- a/tests/Stripe/StripeObjectTest.php +++ b/tests/Stripe/StripeObjectTest.php @@ -35,6 +35,7 @@ public function setUpReflectors() public function testArrayAccessorsSemantics() { + /** @var mixed $s */ $s = new StripeObject(); $s['foo'] = 'a'; static::assertSame($s['foo'], 'a'); @@ -45,6 +46,7 @@ public function testArrayAccessorsSemantics() public function testNormalAccessorsSemantics() { + /** @var mixed $s */ $s = new StripeObject(); $s->foo = 'a'; static::assertSame($s->foo, 'a'); @@ -55,6 +57,7 @@ public function testNormalAccessorsSemantics() public function testArrayAccessorsMatchNormalAccessors() { + /** @var mixed $s */ $s = new StripeObject(); $s->foo = 'a'; static::assertSame($s['foo'], 'a'); @@ -65,6 +68,7 @@ public function testArrayAccessorsMatchNormalAccessors() public function testCount() { + /** @var mixed $s */ $s = new StripeObject(); static::assertCount(0, $s); @@ -80,6 +84,7 @@ public function testCount() public function testKeys() { + /** @var mixed $s */ $s = new StripeObject(); $s->foo = 'bar'; static::assertSame($s->keys(), ['foo']); @@ -87,6 +92,7 @@ public function testKeys() public function testValues() { + /** @var mixed $s */ $s = new StripeObject(); $s->foo = 'bar'; static::assertSame($s->values(), ['bar']); @@ -141,6 +147,7 @@ public function testNonexistentProperty() $origErrorLog = \ini_set('error_log', \stream_get_meta_data($capture)['uri']); try { + /** @var mixed $s */ $s = new StripeObject(); static::assertNull($s->nonexistent); @@ -156,12 +163,14 @@ public function testNonexistentProperty() public function testPropertyDoesNotExists() { + /** @var mixed $s */ $s = new StripeObject(); static::assertNull($s['nonexistent']); } public function testJsonEncode() { + /** @var mixed $s */ $s = new StripeObject(); $s->foo = 'a'; @@ -170,6 +179,7 @@ public function testJsonEncode() public function testToString() { + /** @var mixed $s */ $s = new StripeObject(); $s->foo = 'a'; @@ -184,6 +194,7 @@ public function testToString() public function testReplaceNewNestedUpdatable() { + /** @var mixed $s */ $s = new StripeObject(); $s->metadata = ['bar']; @@ -196,6 +207,7 @@ public function testSetPermanentAttribute() { $this->expectException(\InvalidArgumentException::class); + /** @var mixed $s */ $s = new StripeObject(); $s->id = 'abc_123'; } @@ -204,6 +216,7 @@ public function testSetEmptyStringValue() { $this->expectException(\InvalidArgumentException::class); + /** @var mixed $s */ $s = new StripeObject(); $s->foo = ''; } @@ -216,6 +229,7 @@ public function testSerializeParametersOnEmptyObject() public function testSerializeParametersOnNewObjectWithSubObject() { + /** @var mixed $obj */ $obj = new StripeObject(); $obj->metadata = ['foo' => 'bar']; static::assertSame(['metadata' => ['foo' => 'bar']], $obj->serializeParameters()); @@ -230,6 +244,7 @@ public function testSerializeParametersOnBasicObject() public function testSerializeParametersOnMoreComplexObject() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'foo' => StripeObject::constructFrom([ 'bar' => null, @@ -242,6 +257,7 @@ public function testSerializeParametersOnMoreComplexObject() public function testSerializeParametersOnArray() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'foo' => null, ]); @@ -251,6 +267,7 @@ public function testSerializeParametersOnArray() public function testSerializeParametersOnArrayThatShortens() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'foo' => ['0-index', '1-index', '2-index'], ]); @@ -260,6 +277,7 @@ public function testSerializeParametersOnArrayThatShortens() public function testSerializeParametersOnArrayThatLengthens() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'foo' => ['0-index', '1-index', '2-index'], ]); @@ -269,17 +287,21 @@ public function testSerializeParametersOnArrayThatLengthens() public function testSerializeParametersOnArrayOfHashes() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom(['foo' => null]); $obj->foo = [ StripeObject::constructFrom(['bar' => null]), ]; - $obj->foo[0]->bar = 'baz'; + /** @var mixed $first */ + $first = $obj->foo[0]; + $first->bar = 'baz'; static::assertSame(['foo' => [['bar' => 'baz']]], $obj->serializeParameters()); } public function testSerializeParametersDoesNotIncludeUnchangedValues() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'foo' => null, ]); @@ -288,6 +310,7 @@ public function testSerializeParametersDoesNotIncludeUnchangedValues() public function testSerializeParametersOnUnchangedArray() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'foo' => ['0-index', '1-index', '2-index'], ]); @@ -297,6 +320,7 @@ public function testSerializeParametersOnUnchangedArray() public function testSerializeParametersWithStripeObject() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([]); $obj->metadata = StripeObject::constructFrom(['foo' => 'bar']); @@ -306,6 +330,7 @@ public function testSerializeParametersWithStripeObject() public function testSerializeParametersOnReplacedStripeObject() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'source' => StripeObject::constructFrom(['bar' => 'foo']), ]); @@ -317,6 +342,7 @@ public function testSerializeParametersOnReplacedStripeObject() public function testSerializeParametersOnReplacedStripeObjectWhichIsMetadata() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'metadata' => StripeObject::constructFrom(['bar' => 'foo']), ]); @@ -328,6 +354,7 @@ public function testSerializeParametersOnReplacedStripeObjectWhichIsMetadata() public function testSerializeParametersOnArrayOfStripeObjects() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([]); $obj->metadata = [ StripeObject::constructFrom(['foo' => 'bar']), @@ -340,6 +367,7 @@ public function testSerializeParametersOnArrayOfStripeObjects() public function testSerializeParametersOnSetApiResource() { $customer = Customer::constructFrom(['id' => 'cus_123']); + /** @var mixed $obj */ $obj = StripeObject::constructFrom([]); // the key here is that the property is set explicitly (and therefore @@ -377,6 +405,7 @@ public function testSerializeParametersRaisesExceotionOnOtherEmbeddedApiResource // probably not what the user expected to happen. $customer = Customer::constructFrom([]); + /** @var mixed $obj */ $obj = StripeObject::constructFrom([]); $obj->customer = $customer; @@ -513,6 +542,7 @@ public function testIsDeleted() public function testDeserializeEmptyMetadata() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'metadata' => [], ]); @@ -522,11 +552,14 @@ public function testDeserializeEmptyMetadata() public function testDeserializeMetadataWithKeyNamedMetadata() { + /** @var mixed $obj */ $obj = StripeObject::constructFrom([ 'metadata' => ['metadata' => 'value'], ]); static::assertInstanceOf(\Stripe\StripeObject::class, $obj->metadata); - static::assertSame('value', $obj->metadata->metadata); + /** @var mixed $inner */ + $inner = $obj->metadata; + static::assertSame('value', $inner->metadata); } } diff --git a/tests/Stripe/StripeTelemetryTest.php b/tests/Stripe/StripeTelemetryTest.php index 3a27d2260..a76ab2483 100644 --- a/tests/Stripe/StripeTelemetryTest.php +++ b/tests/Stripe/StripeTelemetryTest.php @@ -37,7 +37,7 @@ public function testNoTelemetrySentIfNotEnabled() $requestheaders = null; $stub = $this - ->getMockBuilder('HttpClient\\ClientInterface') + ->getMockBuilder('\\Stripe\\HttpClient\\ClientInterface') ->setMethods(['request']) ->getMock() ; @@ -80,7 +80,7 @@ public function testTelemetrySetIfEnabled() $requestheaders = null; $stub = $this - ->getMockBuilder('HttpClient\\ClientInterface') + ->getMockBuilder('\\Stripe\\HttpClient\\ClientInterface') ->setMethods(['request']) ->getMock() ; diff --git a/tests/Stripe/SubscriptionTest.php b/tests/Stripe/SubscriptionTest.php index c8d0cabf7..28dc66b1f 100644 --- a/tests/Stripe/SubscriptionTest.php +++ b/tests/Stripe/SubscriptionTest.php @@ -94,6 +94,7 @@ public function testCanDeleteDiscount() public function testSerializeParametersItems() { + /** @var \Stripe\Subscription */ $obj = Util\Util::convertToStripeObject([ 'object' => 'subscription', 'items' => Util\Util::convertToStripeObject([