mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Make test reconciler names better
This commit is contained in:
parent
cafbdb6831
commit
fe9eb6d91e
@ -28,8 +28,11 @@ class ReconcilerTest extends \Psalm\Tests\TestCase
|
||||
|
||||
$this->addFile('newfile.php', '
|
||||
<?php
|
||||
class SomeClass {}
|
||||
class SomeChildClass extends SomeClass {}
|
||||
class A {}
|
||||
class B extends A {}
|
||||
class B {}
|
||||
interface SomeInterface {}
|
||||
');
|
||||
$this->project_analyzer->getCodebase()->scanFiles();
|
||||
}
|
||||
@ -81,35 +84,35 @@ class ReconcilerTest extends \Psalm\Tests\TestCase
|
||||
public function providerTestReconcilation(): array
|
||||
{
|
||||
return [
|
||||
'notNullWithObject' => ['MyObject', '!null', 'MyObject'],
|
||||
'notNullWithObjectPipeNull' => ['MyObject', '!null', 'MyObject|null'],
|
||||
'notNullWithMyObjectPipeFalse' => ['MyObject|false', '!null', 'MyObject|false'],
|
||||
'notNullWithObject' => ['SomeClass', '!null', 'SomeClass'],
|
||||
'notNullWithObjectPipeNull' => ['SomeClass', '!null', 'SomeClass|null'],
|
||||
'notNullWithSomeClassPipeFalse' => ['SomeClass|false', '!null', 'SomeClass|false'],
|
||||
'notNullWithMixed' => ['mixed', '!null', 'mixed'],
|
||||
|
||||
'notEmptyWithMyObject' => ['MyObject', '!falsy', 'MyObject'],
|
||||
'notEmptyWithMyObjectPipeNull' => ['MyObject', '!falsy', 'MyObject|null'],
|
||||
'notEmptyWithMyObjectPipeFalse' => ['MyObject', '!falsy', 'MyObject|false'],
|
||||
'notEmptyWithSomeClass' => ['SomeClass', '!falsy', 'SomeClass'],
|
||||
'notEmptyWithSomeClassPipeNull' => ['SomeClass', '!falsy', 'SomeClass|null'],
|
||||
'notEmptyWithSomeClassPipeFalse' => ['SomeClass', '!falsy', 'SomeClass|false'],
|
||||
'notEmptyWithMixed' => ['non-empty-mixed', '!falsy', 'mixed'],
|
||||
// @todo in the future this should also work
|
||||
//'notEmptyWithMyObjectFalseTrue' => ['MyObject|true', '!falsy', 'MyObject|bool'],
|
||||
//'notEmptyWithSomeClassFalseTrue' => ['SomeClass|true', '!falsy', 'SomeClass|bool'],
|
||||
|
||||
'nullWithMyObjectPipeNull' => ['null', 'null', 'MyObject|null'],
|
||||
'nullWithSomeClassPipeNull' => ['null', 'null', 'SomeClass|null'],
|
||||
'nullWithMixed' => ['null', 'null', 'mixed'],
|
||||
|
||||
'falsyWithMyObject' => ['mixed', 'falsy', 'MyObject'],
|
||||
'falsyWithMyObjectPipeFalse' => ['false', 'falsy', 'MyObject|false'],
|
||||
'falsyWithMyObjectPipeBool' => ['false', 'falsy', 'MyObject|bool'],
|
||||
'falsyWithSomeClass' => ['mixed', 'falsy', 'SomeClass'],
|
||||
'falsyWithSomeClassPipeFalse' => ['false', 'falsy', 'SomeClass|false'],
|
||||
'falsyWithSomeClassPipeBool' => ['false', 'falsy', 'SomeClass|bool'],
|
||||
'falsyWithMixed' => ['empty-mixed', 'falsy', 'mixed'],
|
||||
'falsyWithBool' => ['false', 'falsy', 'bool'],
|
||||
'falsyWithStringOrNull' => ['""|"0"|null', 'falsy', 'string|null'],
|
||||
'falsyWithScalarOrNull' => ['empty-scalar', 'falsy', 'scalar'],
|
||||
|
||||
'notMyObjectWithMyObjectPipeBool' => ['bool', '!MyObject', 'MyObject|bool'],
|
||||
'notMyObjectWithMyObjectPipeNull' => ['null', '!MyObject', 'MyObject|null'],
|
||||
'notMyObjectWithMyObjectAPipeMyObjectB' => ['MyObjectB', '!MyObjectA', 'MyObjectA|MyObjectB'],
|
||||
'notSomeClassWithSomeClassPipeBool' => ['bool', '!SomeClass', 'SomeClass|bool'],
|
||||
'notSomeClassWithSomeClassPipeNull' => ['null', '!SomeClass', 'SomeClass|null'],
|
||||
'notSomeClassWithAPipeB' => ['B', '!A', 'A|B'],
|
||||
|
||||
'myObjectWithMyObjectPipeBool' => ['MyObject', 'MyObject', 'MyObject|bool'],
|
||||
'myObjectWithMyObjectAPipeMyObjectB' => ['MyObjectA', 'MyObjectA', 'MyObjectA|MyObjectB'],
|
||||
'myObjectWithSomeClassPipeBool' => ['SomeClass', 'SomeClass', 'SomeClass|bool'],
|
||||
'myObjectWithAPipeB' => ['A', 'A', 'A|B'],
|
||||
|
||||
'array' => ['array<array-key, mixed>', 'array', 'array|null'],
|
||||
|
||||
@ -120,9 +123,9 @@ class ReconcilerTest extends \Psalm\Tests\TestCase
|
||||
'nullableClassString' => ['null', 'falsy', '?class-string'],
|
||||
'mixedOrNullNotFalsy' => ['non-empty-mixed', '!falsy', 'mixed|null'],
|
||||
'mixedOrNullFalsy' => ['empty-mixed|null', 'falsy', 'mixed|null'],
|
||||
'nullableClassStringFalsy' => ['null', 'falsy', 'class-string<A>|null'],
|
||||
'nullableClassStringEqualsNull' => ['null', '=null', 'class-string<A>|null'],
|
||||
'nullableClassStringTruthy' => ['class-string<A>', '!falsy', 'class-string<A>|null'],
|
||||
'nullableClassStringFalsy' => ['null', 'falsy', 'class-string<SomeClass>|null'],
|
||||
'nullableClassStringEqualsNull' => ['null', '=null', 'class-string<SomeClass>|null'],
|
||||
'nullableClassStringTruthy' => ['class-string<SomeClass>', '!falsy', 'class-string<SomeClass>|null'],
|
||||
'iterableToArray' => ['array<int, int>', 'array', 'iterable<int, int>'],
|
||||
'iterableToTraversable' => ['Traversable<int, int>', 'Traversable', 'iterable<int, int>'],
|
||||
'callableToCallableArray' => ['callable-array{0: class-string|object, 1: string}', 'array', 'callable'],
|
||||
@ -147,10 +150,10 @@ class ReconcilerTest extends \Psalm\Tests\TestCase
|
||||
'arrayContainsWithArrayOfStrings' => ['array<string>', 'array'],
|
||||
'arrayContainsWithArrayOfExceptions' => ['array<Exception>', 'array'],
|
||||
'arrayOfIterable' => ['array', 'iterable'],
|
||||
'arrayOfIterableWithType' => ['array<A>', 'iterable<A>'],
|
||||
'arrayOfIterableWithSubclass' => ['array<B>', 'iterable<A>'],
|
||||
'arrayOfSubclassOfParent' => ['array<B>', 'array<A>'],
|
||||
'subclassOfParent' => ['B', 'A'],
|
||||
'arrayOfIterableWithType' => ['array<SomeClass>', 'iterable<SomeClass>'],
|
||||
'arrayOfIterableWithSubclass' => ['array<SomeChildClass>', 'iterable<SomeClass>'],
|
||||
'arrayOfSubclassOfParent' => ['array<SomeChildClass>', 'array<SomeClass>'],
|
||||
'subclassOfParent' => ['SomeChildClass', 'SomeClass'],
|
||||
'unionContainsWithstring' => ['string', 'string|false'],
|
||||
'unionContainsWithFalse' => ['false', 'string|false'],
|
||||
'objectLikeTypeWithPossiblyUndefinedToGeneric' => [
|
||||
|
Loading…
Reference in New Issue
Block a user