Skip to editor
Psalm
Docs
Playground
Plugins
Blog
Paid support
Share
Fix issues
Show original
PHP
Settings
<?php abstract class Animal { abstract public function getNoise() : string; } class Dog extends Animal { public function getNoise() : string { return "woof"; } } class Cat extends Animal { public function getNoise() : string { return "miaow"; } } /** * @template-covariant T */ class Collection { /** @var array<int, T> */ public array $list = []; } /** * @param Collection<Animal> $collection */ function getNoises(Collection $collection) : void { foreach ($collection->list as $animal) { echo $animal->getNoise(); } } /** * @param Collection<Dog> $dog_collection */ function takesDogList(Collection $dog_collection) : void { getNoises($dog_collection); }
Issues
Types
idle
Saved Dec 19 2019 10:27 UTC
⌘/Ctrl+Enter
run
⌘/Ctrl+S
share
F8
/
⇧F8
next/prev issue