Req #75082 [Fbk->NoF]: Add interface for SplObjectStorage and use that instead bounding to the class
Edit report at https://bugs.php.net/bug.php?id=75082&edit=1
ID: 75082
Updated by: php-bugs@lists.php.net
Reported by: adaliszk at gmail dot com
Summary: Add interface for SplObjectStorage and use that
instead bounding to the class
-Status: Feedback
+Status: No Feedback
Type: Feature/Change Request
Package: SPL related
Operating System: Irrelevant
PHP Version: 7.1.8
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2017-10-19 21:40:36] nikic@php.net
This description is very confusing to me, because I don't understand how having an interface
for SplObjectStorage will help you with a ProductCollection based on SplObjectStorage. The
ProductCollection will still have to satisfy that interface, which is not possible if you restrict
the types of accepted objects and our LSP checks will prohibit it. Something akin to this is only
possible using generics. Am I misunderstand this request?
------------------------------------------------------------------------
[2017-08-17 08:02:32] adaliszk at gmail dot com
Description:
------------
So basically if I build my datastructures using SplObjectStorage logic I cannot define properly an
interface for my each collection and force usage of a subtype for each of the attach/detach and
add/remove methods.
For example I want to build a ProductCollection which expect working with only the same type when
adding and removing and also has a boundary to only accept ProductEntity I cannot define the
interface properly since the SplObjectStorage is bound to itself not to an interface.
Sure you can do it with abstract classes and define this boundaries but then each of your collection
abstractions would be separated from your other interfaces and you loose polymorphic dependencies or
you need to drop your architecture and care this differently.
This change should not provide any BC issues, since it's just add interface around the
ObjectStorage but it will allow polymorphic interfaces and more tools to design your architecture
without implementing code.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75082&edit=1
Thread (3 messages)