From 27171a32a4e3f2f67369be938eaae95a2ff48584 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 18:47:16 +0000 Subject: [PATCH 1/3] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e029231..2c0b269 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-4615e5953fac5a76724144fc2e1f9f675a9722dc05adaeab23e4d09c9577086b.yml -openapi_spec_hash: 6db98497c4dda09b575d5ee12371ef83 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-0482ee5f9cf2cd09691221500b562dab1092df43e774e92b714ccebebf618b1b.yml +openapi_spec_hash: 3f1b98e772d86cca81fa3186198a6937 config_hash: b24ba63471a818520cec39b4695e1825 From c7d0ee80af07ef8dfcfcda54883400efae1e49ab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 25 Apr 2026 02:40:52 +0000 Subject: [PATCH 2/3] fix: revert enum parsing change that lead to unconditional failure --- src/Core/Conversion/EnumOf.php | 20 ++--------- tests/Core/ModelTest.php | 62 ---------------------------------- 2 files changed, 3 insertions(+), 79 deletions(-) diff --git a/src/Core/Conversion/EnumOf.php b/src/Core/Conversion/EnumOf.php index d65d78a..bc96b74 100644 --- a/src/Core/Conversion/EnumOf.php +++ b/src/Core/Conversion/EnumOf.php @@ -19,12 +19,9 @@ final class EnumOf implements Converter /** * @param list $members - * @param class-string<\BackedEnum>|null $class */ - public function __construct( - private readonly array $members, - private readonly ?string $class = null, - ) { + public function __construct(private readonly array $members) + { $type = 'NULL'; foreach ($this->members as $member) { $type = gettype($member); @@ -36,24 +33,13 @@ public function __construct( public static function fromBackedEnum(string $enum): self { // @phpstan-ignore-next-line argument.type - return self::$cache[$enum] ??= new self( - array_column($enum::cases(), column_key: 'value'), - class: $enum, - ); + return self::$cache[$enum] ??= new self(array_column($enum::cases(), column_key: 'value')); } public function coerce(mixed $value, CoerceState $state): mixed { $this->tally($value, state: $state); - if ($value instanceof \BackedEnum) { - return $value; - } - - if (null !== $this->class && (is_int($value) || is_string($value))) { - return ($this->class)::tryFrom($value) ?? $value; - } - return $value; } diff --git a/tests/Core/ModelTest.php b/tests/Core/ModelTest.php index 80d6973..2215cfc 100644 --- a/tests/Core/ModelTest.php +++ b/tests/Core/ModelTest.php @@ -47,30 +47,6 @@ public function __construct( } } -enum TicketPriority: string -{ - case Low = 'low'; - case High = 'high'; -} - -class Ticket implements BaseModel -{ - /** @use SdkModel> */ - use SdkModel; - - #[Required(enum: TicketPriority::class)] - public TicketPriority $priority; - - /** @var list */ - #[Required(list: TicketPriority::class)] - public array $labels; - - public function __construct() - { - $this->initialize(); - } -} - /** * @internal * @@ -165,42 +141,4 @@ public function testSerializeModelWithExplicitNull(): void json_encode($model) ); } - - #[Test] - public function testScalarEnumCoercesToInstance(): void - { - $model = Ticket::fromArray(['priority' => 'low', 'labels' => []]); - $this->assertSame(TicketPriority::Low, $model->priority); - } - - #[Test] - public function testListOfEnumCoercesElementsToInstances(): void - { - $model = Ticket::fromArray(['priority' => 'low', 'labels' => ['low', 'high']]); - $this->assertCount(2, $model->labels); - $this->assertSame(TicketPriority::Low, $model->labels[0]); - $this->assertSame(TicketPriority::High, $model->labels[1]); - } - - #[Test] - public function testEnumInstancePassesThrough(): void - { - $model = Ticket::fromArray(['priority' => TicketPriority::High, 'labels' => []]); - $this->assertSame(TicketPriority::High, $model->priority); - } - - #[Test] - public function testInvalidEnumScalarFallsBackToData(): void - { - $model = Ticket::fromArray(['priority' => 'urgent', 'labels' => []]); - $this->assertSame('urgent', $model['priority']); - } - - #[Test] - public function testEnumWireFormatStableAcrossConstruction(): void - { - $fromScalar = Ticket::fromArray(['priority' => 'low', 'labels' => ['high']]); - $fromInstance = Ticket::fromArray(['priority' => TicketPriority::Low, 'labels' => [TicketPriority::High]]); - $this->assertSame(json_encode($fromScalar), json_encode($fromInstance)); - } } From 833a36724d199aebcbe5b180dca68473a126594b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 25 Apr 2026 02:41:22 +0000 Subject: [PATCH 3/3] release: 0.121.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- src/Version.php | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4bab996..a951ac3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.121.0" + ".": "0.121.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 41abf0c..afe156a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.121.1 (2026-04-25) + +Full Changelog: [v0.121.0...v0.121.1](https://github.com/Increase/increase-php/compare/v0.121.0...v0.121.1) + +### Bug Fixes + +* revert enum parsing change that lead to unconditional failure ([c7d0ee8](https://github.com/Increase/increase-php/commit/c7d0ee80af07ef8dfcfcda54883400efae1e49ab)) + ## 0.121.0 (2026-04-22) Full Changelog: [v0.120.0...v0.121.0](https://github.com/Increase/increase-php/compare/v0.120.0...v0.121.0) diff --git a/README.md b/README.md index 6a03a53..bcdd165 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ``` -composer require "increase/increase 0.121.0" +composer require "increase/increase 0.121.1" ``` diff --git a/src/Version.php b/src/Version.php index d56d578..3f2411d 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace Increase; // x-release-please-start-version -const VERSION = '0.121.0'; +const VERSION = '0.121.1'; // x-release-please-end