From 778ecf67f3150b4cb0c3d6243425f47a678163e8 Mon Sep 17 00:00:00 2001 From: Florin Babes Date: Thu, 23 Aug 2018 18:33:43 +0300 Subject: [PATCH 1/4] return new static so you can extend the class and override methods --- src/Taggable/TaggablePSR6PoolAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Taggable/TaggablePSR6PoolAdapter.php b/src/Taggable/TaggablePSR6PoolAdapter.php index 3c784f4f..d684e9d0 100644 --- a/src/Taggable/TaggablePSR6PoolAdapter.php +++ b/src/Taggable/TaggablePSR6PoolAdapter.php @@ -75,7 +75,7 @@ public static function makeTaggable(CacheItemPoolInterface $cachePool, CacheItem return $cachePool; } - return new self($cachePool, $tagStorePool); + return new static($cachePool, $tagStorePool); } /** From 29c7391395c198e997f9db710063979dad5f4403 Mon Sep 17 00:00:00 2001 From: Florin Babes Date: Thu, 23 Aug 2018 18:35:31 +0300 Subject: [PATCH 2/4] allow access to pools for method calling, but no override the pool --- src/Taggable/TaggablePSR6PoolAdapter.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Taggable/TaggablePSR6PoolAdapter.php b/src/Taggable/TaggablePSR6PoolAdapter.php index d684e9d0..d26e5dbf 100644 --- a/src/Taggable/TaggablePSR6PoolAdapter.php +++ b/src/Taggable/TaggablePSR6PoolAdapter.php @@ -304,4 +304,20 @@ private function removeTagEntries($item) $this->removeListItem($this->getTagKey($tag), $item->getKey()); } } + + /** + * @return CacheItemPoolInterface + */ + protected function getCachePool() + { + return $this->cachePool; + } + + /** + * @return CacheItemPoolInterface + */ + protected function getTagStorePool() + { + return $this->tagStorePool; + } } From c214cb80a280c3a3f1a7dfff0a2d2f78c2b443d0 Mon Sep 17 00:00:00 2001 From: Florin Babes Date: Thu, 23 Aug 2018 19:02:30 +0300 Subject: [PATCH 3/4] allow access to cachepool and tagstore pool for extension --- src/Taggable/TaggablePSR6PoolAdapter.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/Taggable/TaggablePSR6PoolAdapter.php b/src/Taggable/TaggablePSR6PoolAdapter.php index d26e5dbf..7f54e530 100644 --- a/src/Taggable/TaggablePSR6PoolAdapter.php +++ b/src/Taggable/TaggablePSR6PoolAdapter.php @@ -42,12 +42,12 @@ class TaggablePSR6PoolAdapter implements TaggableCacheItemPoolInterface /** * @type CacheItemPoolInterface */ - private $cachePool; + protected $cachePool; /** * @type CacheItemPoolInterface */ - private $tagStorePool; + protected $tagStorePool; /** * @param CacheItemPoolInterface $cachePool @@ -304,20 +304,4 @@ private function removeTagEntries($item) $this->removeListItem($this->getTagKey($tag), $item->getKey()); } } - - /** - * @return CacheItemPoolInterface - */ - protected function getCachePool() - { - return $this->cachePool; - } - - /** - * @return CacheItemPoolInterface - */ - protected function getTagStorePool() - { - return $this->tagStorePool; - } } From c5ab3c9052b65667c0a0978bd5d85336b5029317 Mon Sep 17 00:00:00 2001 From: Florin Babes Date: Thu, 23 Aug 2018 19:10:02 +0300 Subject: [PATCH 4/4] update changelog --- src/Taggable/Changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Taggable/Changelog.md b/src/Taggable/Changelog.md index ab36a67a..e7f540e0 100644 --- a/src/Taggable/Changelog.md +++ b/src/Taggable/Changelog.md @@ -3,7 +3,9 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. ## UNRELEASED - +###Changed +* Use late static binding when creating a new instance +* Allow access to the pools ## 1.0.0 ### Added