1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

fix failing tests and shepherd

This commit is contained in:
kkmuffme 2023-07-02 08:33:43 +02:00
parent 09a3b4b32c
commit c2388b4d90
4 changed files with 15 additions and 6 deletions

View File

@ -250,6 +250,10 @@ final class Creator
}
foreach ($paths as $path) {
if (!is_string($path)) {
continue;
}
if ($path === '') {
$nodes = [...$nodes, ...self::guessPhpFileDirs($current_dir)];

View File

@ -57,12 +57,12 @@ class FileFilter
protected $fq_classlike_names = [];
/**
* @var array<string>
* @var array<non-empty-string>
*/
protected $fq_classlike_patterns = [];
/**
* @var array<string>
* @var array<non-empty-string>
*/
protected $method_ids = [];
@ -443,6 +443,10 @@ class FileFilter
private static function isRegularExpression(string $string): bool
{
if ($string === '') {
return false;
}
set_error_handler(
static fn(): bool => true,
E_WARNING,

View File

@ -473,7 +473,7 @@ class FunctionCallTest extends TestCase
*/
function route($callback) {
if (!is_callable($callback)) { }
$a = preg_match("", "", $b);
$a = preg_match("//", "", $b);
if ($b[0]) {}
}',
'assertions' => [],
@ -507,7 +507,7 @@ class FunctionCallTest extends TestCase
* @param string[] $s
* @return string[]
*/
function foo($s): string {
function foo($s): array {
return preg_replace("/hello/", "", $s);
}',
],
@ -1689,7 +1689,7 @@ class FunctionCallTest extends TestCase
*/
function(array $ids): array {
return \preg_replace_callback(
"",
"//",
fn (array $matches) => $matches[4],
$ids
);
@ -1824,6 +1824,7 @@ class FunctionCallTest extends TestCase
'writeArgsAllowed' => [
'code' => '<?php
/**
* @param non-empty-string $pattern
* @param 0|256|512|768 $flags
* @return false|int
*/

View File

@ -54,7 +54,7 @@ class InternalCallMapHandlerTest extends TestCase
* large ignore list for extension functions have invalid reflection
* or are not maintained.
*
* @var list<string>
* @var list<non-empty-string>
*/
private static array $skippedPatterns = [
'/\'\d$/', // skip alternate signatures