Req #75082 [NEW]: Add interface for SplObjectStorage and use that instead bounding to the class
| From: | adaliszk at gmail dot com | Date: | Thu, 17 Aug 2017 08:02:38 +0000 |
| Subject: | Req #75082 [NEW]: Add interface for SplObjectStorage and use that instead bounding to the class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210701@lists.php.net to get a copy of this message | ||
From: adaliszk at gmail dot com
Operating system: Irrelevant
PHP version: 7.1.8
Package: SPL related
Bug Type: Feature/Change Request
Bug description:Add interface for SplObjectStorage and use that instead bounding to the class
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 bug report at https://bugs.php.net/bug.php?id=75082&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75082&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75082&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75082&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75082&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75082&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75082&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75082&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75082&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75082&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75082&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75082&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75082&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75082&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75082&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75082&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75082&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75082&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75082&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75082&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75082&r=mysqlcfg