feat(generated): OrganizationMembership (batch e471ddef)#404
feat(generated): OrganizationMembership (batch e471ddef)#404workos-sdk-automation[bot] wants to merge 2 commits into
Conversation
Greptile SummaryThis PR regenerates the PHP SDK from the latest spec. The main changes are:
Confidence Score: 2/5The regenerated membership resources introduce runtime compatibility breaks in deserialization and public construction paths.
lib/Resource/OrganizationMembership.php and lib/Resource/UserOrganizationMembership.php
What T-Rex did
Prompt To Fix All With AIFix the following 4 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 4
lib/Resource/OrganizationMembership.php:61
**Missing Roles Crashes Parsing**
When an existing membership payload has `role` but no new `roles` key, this reads an undefined index and passes `null` to `array_map()`. Older stored webhook payloads or API responses can now fail deserialization instead of returning an `OrganizationMembership`.
### Issue 2 of 4
lib/Resource/UserOrganizationMembership.php:61
**Missing Roles Crashes Parsing**
When a user organization membership payload still contains only the existing `role` field, this reads the new `roles` key unconditionally and sends `null` into `array_map()`. That makes older list/get responses or stored webhook data throw during SDK parsing.
### Issue 3 of 4
lib/Resource/OrganizationMembership.php:36
**Constructor Arguments Rebind**
This inserts a new required `array $roles` parameter before the existing `$user` parameter. A consumer that directly constructs this public resource with the old positional argument order now binds the `User` object to `roles` and gets a runtime `TypeError`; named-argument callers that omit `roles` also get an argument error.
### Issue 4 of 4
lib/Resource/UserOrganizationMembership.php:36
**Constructor Arguments Rebind**
This new required `roles` parameter is inserted in the middle of the public constructor, before `$user`. Existing callers that pass the previous positional argument list now send a `User` object into `array $roles`, causing a runtime `TypeError` instead of constructing the resource.
Reviews (1): Last reviewed commit: "chore(generated): add release notes frag..." | Re-trigger Greptile |
| createdAt: new \DateTimeImmutable($data['created_at']), | ||
| updatedAt: new \DateTimeImmutable($data['updated_at']), | ||
| role: SlimRole::fromArray($data['role']), | ||
| roles: array_map(fn ($item) => SlimRole::fromArray($item), $data['roles']), |
There was a problem hiding this comment.
When an existing membership payload has role but no new roles key, this reads an undefined index and passes null to array_map(). Older stored webhook payloads or API responses can now fail deserialization instead of returning an OrganizationMembership.
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/Resource/OrganizationMembership.php
Line: 61
Comment:
**Missing Roles Crashes Parsing**
When an existing membership payload has `role` but no new `roles` key, this reads an undefined index and passes `null` to `array_map()`. Older stored webhook payloads or API responses can now fail deserialization instead of returning an `OrganizationMembership`.
How can I resolve this? If you propose a fix, please make it concise.| createdAt: new \DateTimeImmutable($data['created_at']), | ||
| updatedAt: new \DateTimeImmutable($data['updated_at']), | ||
| role: SlimRole::fromArray($data['role']), | ||
| roles: array_map(fn ($item) => SlimRole::fromArray($item), $data['roles']), |
There was a problem hiding this comment.
When a user organization membership payload still contains only the existing role field, this reads the new roles key unconditionally and sends null into array_map(). That makes older list/get responses or stored webhook data throw during SDK parsing.
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/Resource/UserOrganizationMembership.php
Line: 61
Comment:
**Missing Roles Crashes Parsing**
When a user organization membership payload still contains only the existing `role` field, this reads the new `roles` key unconditionally and sends `null` into `array_map()`. That makes older list/get responses or stored webhook data throw during SDK parsing.
How can I resolve this? If you propose a fix, please make it concise.| * The list of roles assigned to the user within the organization. | ||
| * @var array<\WorkOS\Resource\SlimRole> | ||
| */ | ||
| public array $roles, |
There was a problem hiding this comment.
This inserts a new required array $roles parameter before the existing $user parameter. A consumer that directly constructs this public resource with the old positional argument order now binds the User object to roles and gets a runtime TypeError; named-argument callers that omit roles also get an argument error.
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/Resource/OrganizationMembership.php
Line: 36
Comment:
**Constructor Arguments Rebind**
This inserts a new required `array $roles` parameter before the existing `$user` parameter. A consumer that directly constructs this public resource with the old positional argument order now binds the `User` object to `roles` and gets a runtime `TypeError`; named-argument callers that omit `roles` also get an argument error.
How can I resolve this? If you propose a fix, please make it concise.| * The list of roles assigned to the user within the organization. | ||
| * @var array<\WorkOS\Resource\SlimRole> | ||
| */ | ||
| public array $roles, |
There was a problem hiding this comment.
This new required roles parameter is inserted in the middle of the public constructor, before $user. Existing callers that pass the previous positional argument list now send a User object into array $roles, causing a runtime TypeError instead of constructing the resource.
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/Resource/UserOrganizationMembership.php
Line: 36
Comment:
**Constructor Arguments Rebind**
This new required `roles` parameter is inserted in the middle of the public constructor, before `$user`. Existing callers that pass the previous positional argument list now send a `User` object into `array $roles`, causing a runtime `TypeError` instead of constructing the resource.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Regenerated SDK from spec changes.
Triggered by workos/openapi-spec@75604c7