Assigning new empty SplObjectStorage #10818
-
I'm getting errors when initialising a readonly SplObjectStorage property typed as a generic with specific key/val type: I just saw that this relates to #5810, so I didn't open a bug report. Interestingly, from a practical point of view, the last example is actually the riskiest one, since in any case, there are no real assertions that the passed parameter is correct (whereas an empty SplObjectStorage defined in the class is guaranteed to be safe). Am I missing something? 🤔 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Last example (DictionaryD_no_defaults) isn't risky. There's no error, you're simply describing what's allowed to be passed into the constructor. When you do |
Beta Was this translation helpful? Give feedback.
And about the other errors: we'll be able to get rid of them once this suggestion is implemented #6732 (comment)