Valinor/tests/StaticAnalysis/can-infer-tree-mapper-results.php
Marco Pivetta 7a49f45175 test: configure vimeo/psalm to verify type inference
This is mostly to include type inference in regression tests: out-of-the
box type inference for 99% of usages is based on
`TreeMapper#map(class-string<T>, mixed): T`, and it is worth preserving
that behavior without the need of plugins.

This test covers that.
2022-01-13 19:55:20 +01:00

15 lines
314 B
PHP

<?php
declare(strict_types=1);
namespace CuyZ\Valinor\Tests\StaticAnalysis;
use CuyZ\Valinor\Mapper\TreeMapper;
use CuyZ\Valinor\Tests\StaticAnalysis\Stub\A;
/** @param mixed $input */
function mappingClassWillInferObjectOfSameType(TreeMapper $mapper, $input): A
{
return $mapper->map(A::class, $input);
}