1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Line index.php
54 Call to an undefined method object::getVersion().
[ERROR] Found 1 error
<?php
class ForExample
{
public function getVersion():string
{
return "v.1.2.3";
}
}
/**
* @template T of string|int
* @template K of object
*/
class Arraylist
{
/**
* @var array<T,K>
*/
private array $arrayList = [];
/**
* @param T $key
* @param K $object
*/
public function put(int|string $key, object $object): void
{
$this->arrayList[$key] = $object;
}
/**
* @param T $key
* @return K
*/
public function get(int|string $key):object
{
return $this->arrayList[$key];
}
/**
* @return array<T,K>
*/
public function getArrayList(): array
{
return $this->arrayList;
}
}
$arrayList = new Arraylist();
$arrayList->put(0, new ForExample());
echo $arrayList->get(0)->getVersion();
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Line index.php
54 Call to an undefined method object::getVersion().
[ERROR] Found 1 error