mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 13:51:54 +01:00
The function in a callable-array is a non-empty-string
This commit is contained in:
parent
df6b5fbb75
commit
889bdca461
@ -2304,7 +2304,7 @@ class SimpleAssertionReconciler extends Reconciler
|
||||
} elseif ($type instanceof TCallable) {
|
||||
$array_types[] = new TCallableKeyedArray([
|
||||
new Union([new TClassString, new TObject]),
|
||||
Type::getString(),
|
||||
Type::getNonEmptyString(),
|
||||
]);
|
||||
|
||||
$redundant = false;
|
||||
@ -2428,7 +2428,7 @@ class SimpleAssertionReconciler extends Reconciler
|
||||
} elseif ($type instanceof TCallable) {
|
||||
$array_types[] = new TCallableKeyedArray([
|
||||
new Union([new TClassString, new TObject]),
|
||||
Type::getString(),
|
||||
Type::getNonEmptyString(),
|
||||
]);
|
||||
|
||||
$redundant = false;
|
||||
|
@ -1190,7 +1190,7 @@ class SimpleNegatedAssertionReconciler extends Reconciler
|
||||
} elseif ($type instanceof TCallable) {
|
||||
$non_object_types[] = new TCallableKeyedArray([
|
||||
new Union([new TClassString, new TObject]),
|
||||
Type::getString(),
|
||||
Type::getNonEmptyString(),
|
||||
]);
|
||||
$non_object_types[] = new TCallableString();
|
||||
$redundant = false;
|
||||
@ -1589,7 +1589,7 @@ class SimpleNegatedAssertionReconciler extends Reconciler
|
||||
} elseif ($type instanceof TCallable) {
|
||||
$non_string_types[] = new TCallableKeyedArray([
|
||||
new Union([new TClassString, new TObject]),
|
||||
Type::getString(),
|
||||
Type::getNonEmptyString(),
|
||||
]);
|
||||
$non_string_types[] = new TCallableObject();
|
||||
$redundant = false;
|
||||
|
@ -266,7 +266,7 @@ abstract class Atomic implements TypeNode
|
||||
true,
|
||||
);
|
||||
$object = new TObject(true);
|
||||
$string = new TString(true);
|
||||
$string = new TNonEmptyString(true);
|
||||
return new TCallableKeyedArray([
|
||||
new Union([$classString, $object]),
|
||||
new Union([$string]),
|
||||
|
@ -156,7 +156,7 @@ class ReconcilerTest extends TestCase
|
||||
'nullableClassStringTruthy' => ['class-string<SomeClass>', new Truthy(), 'class-string<SomeClass>|null'],
|
||||
'iterableToArray' => ['array<int, int>', new IsType(new TArray([Type::getArrayKey(), Type::getMixed()])), 'iterable<int, int>'],
|
||||
'iterableToTraversable' => ['Traversable<int, int>', new IsType(new TNamedObject('Traversable')), 'iterable<int, int>'],
|
||||
'callableToCallableArray' => ['callable-array{class-string|object, string}', new IsType(new TArray([Type::getArrayKey(), Type::getMixed()])), 'callable'],
|
||||
'callableToCallableArray' => ['callable-array{class-string|object, non-empty-string}', new IsType(new TArray([Type::getArrayKey(), Type::getMixed()])), 'callable'],
|
||||
'SmallKeyedArrayAndCallable' => ['array{test: string}', new IsType(new TKeyedArray(['test' => Type::getString()])), 'callable'],
|
||||
'BigKeyedArrayAndCallable' => ['array{foo: string, test: string, thing: string}', new IsType(new TKeyedArray(['foo' => Type::getString(), 'test' => Type::getString(), 'thing' => Type::getString()])), 'callable'],
|
||||
'callableOrArrayToCallableArray' => ['array<array-key, mixed>', new IsType(new TArray([Type::getArrayKey(), Type::getMixed()])), 'callable|array'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user