|
21 | 21 | use Zenstruck\Browser\Session\Driver\BrowserKitDriver;
|
22 | 22 | use Zenstruck\Callback\Parameter;
|
23 | 23 | use Zenstruck\Foundry\Factory;
|
24 |
| -use Zenstruck\Foundry\Proxy; |
| 24 | +use Zenstruck\Foundry\Persistence\Proxy; |
| 25 | +use Zenstruck\Foundry\Proxy As LegacyProxy; |
25 | 26 |
|
26 | 27 | /**
|
27 | 28 | * @author Kevin Bond <[email protected]>
|
@@ -138,11 +139,14 @@ public function actingAs(object $user, ?string $firewall = null): self
|
138 | 139 | $user = $user->create(); // @phpstan-ignore-line
|
139 | 140 | }
|
140 | 141 |
|
141 |
| - if ($user instanceof Proxy) { // @phpstan-ignore-line |
142 |
| - trigger_deprecation('zenstruck/browser', '1.9', 'Passing a Proxy to actingAs() is deprecated, pass the real object instead.'); |
| 142 | + if ($user instanceof LegacyProxy) { // @phpstan-ignore-line |
143 | 143 | $user = $user->object(); // @phpstan-ignore-line
|
144 | 144 | }
|
145 | 145 |
|
| 146 | + if ($user instanceof Proxy) { // @phpstan-ignore-line |
| 147 | + $user = $user->_real(); // @phpstan-ignore-line |
| 148 | + } |
| 149 | + |
146 | 150 | if (!$user instanceof UserInterface) {
|
147 | 151 | throw new \LogicException(\sprintf('%s() requires the user be an instance of %s.', __METHOD__, UserInterface::class));
|
148 | 152 | }
|
@@ -178,11 +182,14 @@ public function assertAuthenticated($as = null): self
|
178 | 182 | $as = $as->create(); // @phpstan-ignore-line
|
179 | 183 | }
|
180 | 184 |
|
181 |
| - if ($as instanceof Proxy) { // @phpstan-ignore-line |
182 |
| - trigger_deprecation('zenstruck/browser', '1.9', 'Passing a Proxy to assertAuthenticated() is deprecated, pass the real object instead.'); |
| 185 | + if ($as instanceof LegacyProxy) { // @phpstan-ignore-line |
183 | 186 | $as = $as->object(); // @phpstan-ignore-line
|
184 | 187 | }
|
185 | 188 |
|
| 189 | + if ($as instanceof Proxy) { // @phpstan-ignore-line |
| 190 | + $as = $as->_real(); // @phpstan-ignore-line |
| 191 | + } |
| 192 | + |
186 | 193 | if ($as instanceof UserInterface) {
|
187 | 194 | $as = $as->getUserIdentifier();
|
188 | 195 | }
|
|
0 commit comments