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

Method demo

examples/demo.php:299–318  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

297class AssertNarrowingDemo
298{
299 public function demo(): void
300 {
301 $unknown = getUnknownValue();
302 assertRock($unknown); // @phpstan-assert Rock $value
303 $unknown->crush();
304
305 $sample = pickRockOrBanana();
306 if (isRock($sample)) { // @phpstan-assert-if-true Rock
307 $sample->crush();
308 } else {
309 $sample->peel();
310 }
311
312 $maybe = pickRockOrBanana();
313 if (isNotRock($maybe)) { // @phpstan-assert-if-false Rock
314 $maybe->peel();
315 } else {
316 $maybe->crush();
317 }
318 }
319}
320
321

Callers

nothing calls this directly

Calls 7

getUnknownValueFunction · 0.85
assertRockFunction · 0.85
pickRockOrBananaFunction · 0.85
isRockFunction · 0.85
isNotRockFunction · 0.85
crushMethod · 0.80
peelMethod · 0.80

Tested by

no test coverage detected