@@ -139,76 +139,6 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfResolverThrowsExceptio
139139 $ this ->assertSame (0 , gc_collect_cycles ());
140140 }
141141
142- /**
143- * Test that checks number of garbage cycles after throwing from a canceller
144- * that explicitly uses a reference to the promise. This is rather synthetic,
145- * actual use cases often have implicit (hidden) references which ought not
146- * to be stored in the stack trace.
147- *
148- * Reassigned arguments only show up in the stack trace in PHP 7, so we can't
149- * avoid this on legacy PHP. As an alternative, consider explicitly unsetting
150- * any references before throwing.
151- *
152- * @test
153- * @requires PHP 7
154- */
155- public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException (): void
156- {
157- gc_collect_cycles ();
158- /** @var Promise<never> $promise */
159- $ promise = new Promise (function () {}, function () use (&$ promise ) {
160- assert ($ promise instanceof Promise);
161- throw new \Exception ('foo ' );
162- });
163- $ promise ->cancel ();
164- unset($ promise );
165-
166- $ this ->assertSame (0 , gc_collect_cycles ());
167- }
168-
169- /**
170- * @test
171- * @requires PHP 7
172- * @see self::shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException
173- */
174- public function shouldRejectWithoutCreatingGarbageCyclesIfResolverWithReferenceThrowsException (): void
175- {
176- gc_collect_cycles ();
177- /** @var Promise<never> $promise */
178- $ promise = new Promise (function () use (&$ promise ) {
179- assert ($ promise instanceof Promise);
180- throw new \Exception ('foo ' );
181- });
182-
183- $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
184-
185- unset($ promise );
186-
187- $ this ->assertSame (0 , gc_collect_cycles ());
188- }
189-
190- /**
191- * @test
192- * @requires PHP 7
193- * @see self::shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException
194- */
195- public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerHoldsReferenceAndResolverThrowsException (): void
196- {
197- gc_collect_cycles ();
198- /** @var Promise<never> $promise */
199- $ promise = new Promise (function () {
200- throw new \Exception ('foo ' );
201- }, function () use (&$ promise ) {
202- assert ($ promise instanceof Promise);
203- });
204-
205- $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
206-
207- unset($ promise );
208-
209- $ this ->assertSame (0 , gc_collect_cycles ());
210- }
211-
212142 /** @test */
213143 public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPromise (): void
214144 {
0 commit comments