feat(generated): OrganizationMembership (batch 4a353f07)#405
feat(generated): OrganizationMembership (batch 4a353f07)#405workos-sdk-automation[bot] wants to merge 2 commits into
Conversation
Greptile SummaryThis PR regenerates PHP SDK resources and fixtures for organization membership updates. The main changes are:
Confidence Score: 2/5The generated organization membership deserializers can reject existing role-only payloads, and the public constructor signatures changed in a way that can break positional callers.
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 Break Deserialization**
When a membership payload still has the existing singular `role` field but no additive `roles` array, this line reads a missing key and passes `null` into `array_map`. Existing API, webhook, or stored fixture payloads with the old shape can now fail during SDK deserialization instead of producing an `OrganizationMembership`.
### Issue 2 of 4
lib/Resource/UserOrganizationMembership.php:61
**Missing Roles Break List Items**
When a user organization membership item still contains only `role`, this direct `roles` lookup turns a previously valid list response into a deserialization failure. SDK callers listing memberships can receive a runtime error before they can read the membership data.
### Issue 3 of 4
lib/Resource/OrganizationMembership.php:36
**Constructor Argument Order Breaks**
This adds a required `$roles` parameter before the existing required `$user` parameter on a public resource constructor. Code that constructs `OrganizationMembership` positionally with the old argument order will now pass a `User` where an array is required, or omit the new argument, and fail during upgrade.
### Issue 4 of 4
lib/Resource/UserOrganizationMembership.php:36
**Constructor Argument Order Breaks**
This public constructor now requires `$roles` before `$user`, so existing positional construction with the previous signature no longer lines up. Consumers can hit an argument count or type error even when they do not use the new multi-role field.
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.
Missing Roles Break Deserialization
When a membership payload still has the existing singular role field but no additive roles array, this line reads a missing key and passes null into array_map. Existing API, webhook, or stored fixture payloads with the old shape can now fail during SDK deserialization instead of producing 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 Break Deserialization**
When a membership payload still has the existing singular `role` field but no additive `roles` array, this line reads a missing key and passes `null` into `array_map`. Existing API, webhook, or stored fixture payloads with the old shape can now fail during SDK deserialization instead of producing 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.
Missing Roles Break List Items
When a user organization membership item still contains only role, this direct roles lookup turns a previously valid list response into a deserialization failure. SDK callers listing memberships can receive a runtime error before they can read the membership data.
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/Resource/UserOrganizationMembership.php
Line: 61
Comment:
**Missing Roles Break List Items**
When a user organization membership item still contains only `role`, this direct `roles` lookup turns a previously valid list response into a deserialization failure. SDK callers listing memberships can receive a runtime error before they can read the membership data.
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.
Constructor Argument Order Breaks
This adds a required $roles parameter before the existing required $user parameter on a public resource constructor. Code that constructs OrganizationMembership positionally with the old argument order will now pass a User where an array is required, or omit the new argument, and fail during upgrade.
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/Resource/OrganizationMembership.php
Line: 36
Comment:
**Constructor Argument Order Breaks**
This adds a required `$roles` parameter before the existing required `$user` parameter on a public resource constructor. Code that constructs `OrganizationMembership` positionally with the old argument order will now pass a `User` where an array is required, or omit the new argument, and fail during upgrade.
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.
Constructor Argument Order Breaks
This public constructor now requires $roles before $user, so existing positional construction with the previous signature no longer lines up. Consumers can hit an argument count or type error even when they do not use the new multi-role field.
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/Resource/UserOrganizationMembership.php
Line: 36
Comment:
**Constructor Argument Order Breaks**
This public constructor now requires `$roles` before `$user`, so existing positional construction with the previous signature no longer lines up. Consumers can hit an argument count or type error even when they do not use the new multi-role field.
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@053f61e