You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All properties are currently initialized with the OpenApi\UNDEFINED constant (a string value). I know the reason for this is to distinguish null and undefined.
But this is pretty ugly as working with the code requires checking every property for this undefined constant before using it.
This also makes static analysers complain for every property access as the phpdoc type does not reflect this.
It will also be incompatible with PHP 7.4 property types.
But with property types we shouldn't need the undefined init anymore. Typed properties are un-initialized and swagger-php can use this to distinguish null and undefined.
Unfortunately switching all the properties to uninitialized is kind of a bc break as other code currently checks properties against the constant instead of checking if they are set (ussing isset). But I think it's the right way forward.
What do you think? Do you have plans in this regard?
The text was updated successfully, but these errors were encountered:
No real plans but PR #928 already reduces UNDEFINED to a single class const. I agree that the type conflicts that the const creates is not nice; we'll just have to wait until 7.4 is the lowest supported version ...
All properties are currently initialized with the OpenApi\UNDEFINED constant (a string value). I know the reason for this is to distinguish null and undefined.
But this is pretty ugly as working with the code requires checking every property for this undefined constant before using it.
This also makes static analysers complain for every property access as the phpdoc type does not reflect this.
It will also be incompatible with PHP 7.4 property types.
But with property types we shouldn't need the undefined init anymore. Typed properties are un-initialized and swagger-php can use this to distinguish null and undefined.
Unfortunately switching all the properties to uninitialized is kind of a bc break as other code currently checks properties against the constant instead of checking if they are set (ussing isset). But I think it's the right way forward.
What do you think? Do you have plans in this regard?
The text was updated successfully, but these errors were encountered: