MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / mixedGuard

Method mixedGuard

examples/demo.php:374–383  ·  view source on GitHub ↗

Positive instanceof + early return on a mixed parameter. */

(mixed $value)

Source from the content-addressed store, hash-verified

372
373 /** Positive instanceof + early return on a mixed parameter. */
374 public function mixedGuard(mixed $value): void
375 {
376 if ($value instanceof Banana) {
377 return; // $value is Banana → exit
378 }
379 // After the guard, $value is NOT Banana.
380 if ($value instanceof Rock) {
381 $value->crush(); // narrowed to Rock (not Banana)
382 }
383 }
384}
385
386

Callers

nothing calls this directly

Calls 1

crushMethod · 0.80

Tested by

no test coverage detected