Skip to editor
Psalm
Docs
Playground
Plugins
Blog
Paid support
Share
Fix issues
Show original
PHP
Settings
<?php class Animal {} class Dog extends Animal {} class Cat extends Animal {} /** * @template-covariant T */ class Collection { /** * @var array<int, T> */ public array $list; /** * @param array<int, T> $list */ public function __construct(array $list) { $this->list = $list; } /** * @param T $t */ public function add($t) : void { $this->list[] = $t; } } /** * @param Collection<Animal> $collection */ function addAnimal(Collection $collection) : void { $collection->add(new Cat()); } /** * @param Collection<Dog> $dog_collection */ function takesDogList(Collection $dog_collection) : void { addAnimal($dog_collection); }
Issues
Types
idle
Saved Dec 19 2019 10:29 UTC
⌘/Ctrl+Enter
run
⌘/Ctrl+S
share
F8
/
⇧F8
next/prev issue