php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #75082 Add interface for SplObjectStorage and use that instead bounding to the class
Submitted: 2017-08-17 08:02 UTC Modified: -
From: adaliszk at gmail dot com Assigned:
Status: Open Package: SPL related
PHP Version: 7.1.8 OS: Irrelevant
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-08-17 08:02 UTC] 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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC