@@ -54,8 +54,13 @@ public function testFromUnexpectedIntTypeError(): void
5454
5555 public function testFromUnexpectedNullTypeError (): void
5656 {
57- $ class = PHP_VERSION_ID >= 80000 ? EmulatedStringEnum::class : BasicStringEnum::class;
58- $ type = PHP_VERSION_ID >= 80000 ? 'string|int ' : 'string ' ;
57+ if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100 ) {
58+ $ class = EmulatedStringEnum::class;
59+ $ type = 'string|int ' ;
60+ } else {
61+ $ class = BasicStringEnum::class;
62+ $ type = 'string ' ;
63+ }
5964
6065 $ this ->expectException ('TypeError ' );
6166 $ this ->expectExceptionMessage ("{$ class }::from(): Argument #1 ( \$value) must be of type {$ type }, null given " );
@@ -66,8 +71,13 @@ public function testFromUnexpectedNullTypeError(): void
6671
6772 public function testFromUnexpectedBoolTypeError (): void
6873 {
69- $ class = PHP_VERSION_ID >= 80000 ? EmulatedStringEnum::class : BasicStringEnum::class;
70- $ type = PHP_VERSION_ID >= 80000 ? 'string|int ' : 'string ' ;
74+ if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100 ) {
75+ $ class = EmulatedStringEnum::class;
76+ $ type = 'string|int ' ;
77+ } else {
78+ $ class = BasicStringEnum::class;
79+ $ type = 'string ' ;
80+ }
7181
7282 $ this ->expectException ('TypeError ' );
7383 $ this ->expectExceptionMessage ("{$ class }::from(): Argument #1 ( \$value) must be of type {$ type }, bool given " );
@@ -78,8 +88,13 @@ public function testFromUnexpectedBoolTypeError(): void
7888
7989 public function testFromUnexpectedFloatTypeError (): void
8090 {
81- $ class = PHP_VERSION_ID >= 80000 ? EmulatedStringEnum::class : BasicStringEnum::class;
82- $ type = PHP_VERSION_ID >= 80000 ? 'string|int ' : 'string ' ;
91+ if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100 ) {
92+ $ class = EmulatedStringEnum::class;
93+ $ type = 'string|int ' ;
94+ } else {
95+ $ class = BasicStringEnum::class;
96+ $ type = 'string ' ;
97+ }
8398
8499 $ this ->expectException ('TypeError ' );
85100 $ this ->expectExceptionMessage ("{$ class }::from(): Argument #1 ( \$value) must be of type {$ type }, float given " );
@@ -90,8 +105,13 @@ public function testFromUnexpectedFloatTypeError(): void
90105
91106 public function testFromUnexpectedObjTypeError (): void
92107 {
93- $ class = PHP_VERSION_ID >= 80000 ? EmulatedStringEnum::class : BasicStringEnum::class;
94- $ type = PHP_VERSION_ID >= 80000 ? 'string|int ' : 'string ' ;
108+ if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100 ) {
109+ $ class = EmulatedStringEnum::class;
110+ $ type = 'string|int ' ;
111+ } else {
112+ $ class = BasicStringEnum::class;
113+ $ type = 'string ' ;
114+ }
95115
96116 $ this ->expectException ('TypeError ' );
97117 $ this ->expectExceptionMessage ("{$ class }::from(): Argument #1 ( \$value) must be of type {$ type }, stdClass given " );
@@ -129,8 +149,13 @@ public function testTryFromUnexpectedIntTypeError(): void
129149
130150 public function testTryFromUnexpectedNullTypeError (): void
131151 {
132- $ class = PHP_VERSION_ID >= 80000 ? EmulatedStringEnum::class : BasicStringEnum::class;
133- $ type = PHP_VERSION_ID >= 80000 ? 'string|int ' : 'string ' ;
152+ if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100 ) {
153+ $ class = EmulatedStringEnum::class;
154+ $ type = 'string|int ' ;
155+ } else {
156+ $ class = BasicStringEnum::class;
157+ $ type = 'string ' ;
158+ }
134159
135160 $ this ->expectException ('TypeError ' );
136161 $ this ->expectExceptionMessage ("{$ class }::tryFrom(): Argument #1 ( \$value) must be of type {$ type }, null given " );
@@ -141,8 +166,13 @@ public function testTryFromUnexpectedNullTypeError(): void
141166
142167 public function testTryFromUnexpectedBoolTypeError (): void
143168 {
144- $ class = PHP_VERSION_ID >= 80000 ? EmulatedStringEnum::class : BasicStringEnum::class;
145- $ type = PHP_VERSION_ID >= 80000 ? 'string|int ' : 'string ' ;
169+ if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100 ) {
170+ $ class = EmulatedStringEnum::class;
171+ $ type = 'string|int ' ;
172+ } else {
173+ $ class = BasicStringEnum::class;
174+ $ type = 'string ' ;
175+ }
146176
147177 $ this ->expectException ('TypeError ' );
148178 $ this ->expectExceptionMessage ("{$ class }::tryFrom(): Argument #1 ( \$value) must be of type {$ type }, bool given " );
@@ -153,8 +183,13 @@ public function testTryFromUnexpectedBoolTypeError(): void
153183
154184 public function testTryFromUnexpectedFloatTypeError (): void
155185 {
156- $ class = PHP_VERSION_ID >= 80000 ? EmulatedStringEnum::class : BasicStringEnum::class;
157- $ type = PHP_VERSION_ID >= 80000 ? 'string|int ' : 'string ' ;
186+ if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100 ) {
187+ $ class = EmulatedStringEnum::class;
188+ $ type = 'string|int ' ;
189+ } else {
190+ $ class = BasicStringEnum::class;
191+ $ type = 'string ' ;
192+ }
158193
159194 $ this ->expectException ('TypeError ' );
160195 $ this ->expectExceptionMessage ("{$ class }::tryFrom(): Argument #1 ( \$value) must be of type {$ type }, float given " );
@@ -165,8 +200,13 @@ public function testTryFromUnexpectedFloatTypeError(): void
165200
166201 public function testTryFromUnexpectedObjTypeError (): void
167202 {
168- $ class = PHP_VERSION_ID >= 80000 ? EmulatedStringEnum::class : BasicStringEnum::class;
169- $ type = PHP_VERSION_ID >= 80000 ? 'string|int ' : 'string ' ;
203+ if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100 ) {
204+ $ class = EmulatedStringEnum::class;
205+ $ type = 'string|int ' ;
206+ } else {
207+ $ class = BasicStringEnum::class;
208+ $ type = 'string ' ;
209+ }
170210
171211 $ this ->expectException ('TypeError ' );
172212 $ this ->expectExceptionMessage ("{$ class }::tryFrom(): Argument #1 ( \$value) must be of type {$ type }, stdClass given " );
0 commit comments