mirror of
https://github.com/danog/Valinor.git
synced 2024-11-26 20:24:40 +01:00
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.
This commit is contained in:
parent
822865876d
commit
7a49f45175
14
psalm.xml
Normal file
14
psalm.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="1"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="tests/StaticAnalysis" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
</psalm>
|
9
tests/StaticAnalysis/Stub/A.php
Normal file
9
tests/StaticAnalysis/Stub/A.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace CuyZ\Valinor\Tests\StaticAnalysis\Stub;
|
||||
|
||||
final class A
|
||||
{
|
||||
}
|
14
tests/StaticAnalysis/can-infer-tree-mapper-results.php
Normal file
14
tests/StaticAnalysis/can-infer-tree-mapper-results.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user