File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -52,15 +52,18 @@ public function detach(): int
5252 $ flags |= ScopeInterface::INACTIVE ;
5353 }
5454
55+ static $ detached ;
56+ $ detached ??= (new \ReflectionClass (self ::class))->newInstanceWithoutConstructor ();
57+
5558 if ($ this === $ this ->head ->node ) {
56- assert ($ this ->previous !== $ this );
59+ assert ($ this ->previous !== $ detached );
5760 $ this ->head ->node = $ this ->previous ;
58- $ this ->previous = $ this ;
61+ $ this ->previous = $ detached ;
5962
6063 return $ flags ;
6164 }
6265
63- if ($ this ->previous === $ this ) {
66+ if ($ this ->previous === $ detached ) {
6467 return $ flags | ScopeInterface::DETACHED ;
6568 }
6669
@@ -71,7 +74,7 @@ public function detach(): int
7174 assert ($ n ->previous !== null );
7275 }
7376 $ n ->previous = $ this ->previous ;
74- $ this ->previous = $ this ;
77+ $ this ->previous = $ detached ;
7578
7679 return $ flags | ScopeInterface::MISMATCH | $ depth ;
7780 }
You can’t perform that action at this time.
0 commit comments