We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing an event payload like so:
[ 'data' => [ 'previous_attributes' => [], ], 'object' => 'event', ]
to Event::constructFrom will create an Event whose event->data->previous_attributes member is an array, whereas passing an event payload like so:
Event::constructFrom
Event
event->data->previous_attributes
array
[ 'data' => [ 'previous_attributes' => [ 'foo' => 'bar', ], ], 'object' => 'event', ]
will create an Event whose event->data->previous_attributes member is a StripeObject.
StripeObject
It feels like this should be consistent, with this member being a StripeObject in both cases.
assert(Stripe\Event::constructFrom(['data'=>['previous_attributes'=>[]],'object'=>'event'])->data->previous_attributes instanceof Stripe\StripeObject);
The assertion to be upheld.
<?php use PHPUnit\Framework\TestCase; use Stripe\Event; use Stripe\StripeObject; class Test extends TestCase { /** * @dataProvider previousAttributesProvider */ function test_constructFrom(array $previousAttributes): void { $event = Event::constructFrom([ 'data' => [ 'previous_attributes' => $previousAttributes, ], 'object' => 'event', ]); $this->assertInstanceOf( StripeObject::class, $event->data->previous_attributes, ); } function previousAttributesProvider(): iterable { yield [['foo' => 'bar']]; yield [[]]; } }
macOS
8.3
v7.128.0
na
No response
The text was updated successfully, but these errors were encountered:
Thanks for the report! We've filed this internally as DEVSDK-2297 and will take a look.
DEVSDK-2297
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Passing an event payload like so:
to
Event::constructFrom
will create anEvent
whoseevent->data->previous_attributes
member is anarray
, whereas passing an event payload like so:will create an
Event
whoseevent->data->previous_attributes
member is aStripeObject
.It feels like this should be consistent, with this member being a
StripeObject
in both cases.To Reproduce
Expected behavior
The assertion to be upheld.
Code snippets
OS
macOS
PHP version
8.3
Library version
v7.128.0
API version
na
Additional context
No response
The text was updated successfully, but these errors were encountered: