File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1111class Matcher implements MatcherInterface
1212{
1313 /**
14- * @var \SplObjectStorage <ItemInterface, bool>
14+ * @var \WeakMap <ItemInterface, bool>
1515 */
16- private \SplObjectStorage $ cache ;
16+ private \WeakMap $ cache ;
1717
1818 /**
1919 * @var iterable|VoterInterface[]
@@ -26,7 +26,7 @@ class Matcher implements MatcherInterface
2626 public function __construct ($ voters = [])
2727 {
2828 $ this ->voters = $ voters ;
29- $ this ->cache = new \SplObjectStorage ();
29+ $ this ->cache = new \WeakMap ();
3030 }
3131
3232 public function isCurrent (ItemInterface $ item ): bool
@@ -36,7 +36,7 @@ public function isCurrent(ItemInterface $item): bool
3636 return $ current ;
3737 }
3838
39- if ($ this ->cache ->contains ($ item )) {
39+ if ($ this ->cache ->offsetExists ($ item )) {
4040 return $ this ->cache [$ item ];
4141 }
4242
@@ -71,6 +71,6 @@ public function isAncestor(ItemInterface $item, ?int $depth = null): bool
7171
7272 public function clear (): void
7373 {
74- $ this ->cache = new \SplObjectStorage ();
74+ $ this ->cache = new \WeakMap ();
7575 }
7676}
You can’t perform that action at this time.
0 commit comments