Psalm
Get started
Documentation
Paid support
Plugins
Blog
GitHub
<?php declare(strict_types = 1); class HelloWorld { /** @param array{1, 2} $array */ public static function sayHello(array $array): void { /** @psalm-trace $values */ $values = array_values($array); /** @psalm-trace $a */ $a = array_values($array)[0]; } } $a = [0 => 1, 1 => 2]; $b = [1 => 2, 0 => 1]; HelloWorld::sayHello($a); HelloWorld::sayHello($b);
Snippet created on August 31 2024 at 18:30 UTC
Settings
Get link