mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Merge pull request #6979 from orklah/6975
don't accept unresolved literal string as valid callable-strings
This commit is contained in:
commit
fdf3a8dbb8
@ -582,6 +582,11 @@ class ScalarTypeComparator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$input_callable) {
|
||||||
|
//we could not find a callable for the input type, so the input is not contained in the container
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1219,6 +1219,18 @@ class CallableTest extends TestCase
|
|||||||
}',
|
}',
|
||||||
'error_message' => 'InvalidScalarArgument',
|
'error_message' => 'InvalidScalarArgument',
|
||||||
],
|
],
|
||||||
|
'inexistantCallableinCallableString' => [
|
||||||
|
'<?php
|
||||||
|
/**
|
||||||
|
* @param callable-string $c
|
||||||
|
*/
|
||||||
|
function c(string $c): void {
|
||||||
|
$c();
|
||||||
|
}
|
||||||
|
|
||||||
|
c("hii");',
|
||||||
|
'error_message' => 'InvalidArgument',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -973,6 +973,7 @@ class TypeParseTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @psalm-suppress InvalidArgument Psalm couldn't detect the function exists */
|
||||||
$reflectionFunc = new \ReflectionFunction('Psalm\Tests\someFunction');
|
$reflectionFunc = new \ReflectionFunction('Psalm\Tests\someFunction');
|
||||||
$reflectionParams = $reflectionFunc->getParameters();
|
$reflectionParams = $reflectionFunc->getParameters();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user