File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
tests/Fixtures/TestBundle Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,12 @@ public function getId(): ?int
3333 return $ this ->id ;
3434 }
3535
36- public function getMyFloatField (): float
36+ public function getMyFloatField (): string | float
3737 {
38- return $ this ->myFloatField ;
38+ // php 8.5 emits warning unexpected NAN value was coerced to string
39+ // with symfony serializer
40+ // @see https://github.com/symfony/symfony/pull/62740
41+ return is_nan ($ this ->myFloatField ) ? 'NAN ' : $ this ->myFloatField ;
3942 }
4043
4144 public function setMyFloatField (float $ myFloatField ): void
Original file line number Diff line number Diff line change @@ -28,20 +28,26 @@ class ResourceWithFloat
2828 #[ORM \GeneratedValue(strategy: 'AUTO ' )]
2929 private ?int $ id = null ;
3030 #[ORM \Column(type: 'float ' )]
31- private float $ myFloatField = 0.0 ;
31+ private string | float $ myFloatField = 0.0 ;
3232
3333 public function getId (): ?int
3434 {
3535 return $ this ->id ;
3636 }
3737
38- public function getMyFloatField (): float
38+ public function getMyFloatField (): string | float
3939 {
40- return $ this ->myFloatField ;
40+ // php 8.5 emits warning unexpected NAN value was coerced to string
41+ // with symfony serializer
42+ // @see https://github.com/symfony/symfony/pull/62740
43+ return is_nan ($ this ->myFloatField ) ? 'NAN ' : $ this ->myFloatField ;
4144 }
4245
4346 public function setMyFloatField (float $ myFloatField ): void
4447 {
45- $ this ->myFloatField = $ myFloatField ;
48+ // When binding a NAN value to a prepared statement parameter with Doctrine,
49+ // PHP 8.5 emits a warning: "unexpected NAN value was coerced to string".
50+ // @see https://github.com/doctrine/dbal/pull/7249
51+ $ this ->myFloatField = is_nan ($ myFloatField ) ? 'NAN ' : $ myFloatField ;
4652 }
4753}
You can’t perform that action at this time.
0 commit comments