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
The problem is that generateComputedProperty takes a ?string and is used throughout the application, not just with Spatie so we didn't want to have to handle Optional here -- and it looks like Optional is an empty placeholder anyways.
That could be part of the Optional API to make it accessible (and no pollute globals) so you could Optional::unwrap($startTime) and get the ?string out of it.
edit: if the unwrap solution is sensible I'm happy to make a PR for it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We ran into an issue with our linter today. We had a Data definition like:
And we wanted to add a computed value using a service function so we added:
The problem is that
generateComputedProperty
takes a?string
and is used throughout the application, not just with Spatie so we didn't want to have to handleOptional
here -- and it looks likeOptional
is an empty placeholder anyways.The only we could find to "unwrap" it was:
Does the library provide a way to cleanly unwrap optional values? I threw this together quickly and it worked:
That could be part of the
Optional
API to make it accessible (and no pollute globals) so you couldOptional::unwrap($startTime)
and get the?string
out of it.edit: if the
unwrap
solution is sensible I'm happy to make a PR for it.Beta Was this translation helpful? Give feedback.
All reactions