mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 22:01:48 +01:00
Merge branch '5.x' into upstream-master
This commit is contained in:
commit
1945e92b85
@ -247,4 +247,9 @@ return [
|
||||
'hash_update_stream' => true,
|
||||
// unserialize
|
||||
'unserialize' => true,
|
||||
// openssl
|
||||
'openssl_csr_export_to_file' => true,
|
||||
'openssl_pkcs12_export_to_file' => true,
|
||||
'openssl_pkey_export_to_file' => true,
|
||||
'openssl_x509_export_to_file' => true,
|
||||
];
|
||||
|
@ -533,11 +533,10 @@ class ArithmeticOpAnalyzer
|
||||
$has_valid_right_operand = true;
|
||||
}
|
||||
|
||||
$result_type = Type::getArray();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($parent instanceof PhpParser\Node\Expr\BinaryOp\Plus) {
|
||||
$has_valid_right_operand = true;
|
||||
$has_valid_left_operand = true;
|
||||
|
||||
@ -625,6 +624,7 @@ class ArithmeticOpAnalyzer
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (($left_type_part instanceof TNamedObject && strtolower($left_type_part->value) === 'gmp')
|
||||
|| ($right_type_part instanceof TNamedObject && strtolower($right_type_part->value) === 'gmp')
|
||||
|
@ -17,6 +17,7 @@ use UnexpectedValueException;
|
||||
use function in_array;
|
||||
|
||||
use const FILTER_NULL_ON_FAILURE;
|
||||
use const FILTER_SANITIZE_URL;
|
||||
use const FILTER_VALIDATE_BOOLEAN;
|
||||
use const FILTER_VALIDATE_DOMAIN;
|
||||
use const FILTER_VALIDATE_EMAIL;
|
||||
@ -78,6 +79,7 @@ class FilterVarReturnTypeProvider implements FunctionReturnTypeProviderInterface
|
||||
case FILTER_VALIDATE_URL:
|
||||
case FILTER_VALIDATE_EMAIL:
|
||||
case FILTER_VALIDATE_DOMAIN:
|
||||
case FILTER_SANITIZE_URL:
|
||||
$filter_type = Type::getString();
|
||||
break;
|
||||
}
|
||||
|
@ -1022,6 +1022,58 @@ class BinaryOperationTest extends TestCase
|
||||
'$a===' => 'float(9.2233720368548E+18)',
|
||||
],
|
||||
],
|
||||
'invalidArrayOperations' => [
|
||||
'code' => <<<'PHP'
|
||||
<?php
|
||||
|
||||
$a1 = 1 + [];
|
||||
$a2 = [] + 1;
|
||||
// This is the one exception to this rule
|
||||
$a3 = [] + [];
|
||||
|
||||
$b1 = 1 - [];
|
||||
$b2 = [] - 1;
|
||||
$b3 = [] - [];
|
||||
|
||||
$c1 = 1 * [];
|
||||
$c2 = [] * 1;
|
||||
$c3 = [] * [];
|
||||
|
||||
$d1 = 1 / [];
|
||||
$d2 = [] / 1;
|
||||
$d3 = [] / [];
|
||||
|
||||
$e1 = 1 ** [];
|
||||
$e2 = [] ** 1;
|
||||
$e3 = [] ** [];
|
||||
|
||||
$f1 = 1 % [];
|
||||
$f2 = [] % 1;
|
||||
$f3 = [] % [];
|
||||
|
||||
PHP,
|
||||
'assertions' => [
|
||||
'$a1' => 'float|int',
|
||||
'$a2' => 'float|int',
|
||||
'$a3' => 'array<never, never>',
|
||||
'$b1' => 'float|int',
|
||||
'$b2' => 'float|int',
|
||||
'$b3' => 'float|int',
|
||||
'$c1' => 'float|int',
|
||||
'$c2' => 'float|int',
|
||||
'$c3' => 'float|int',
|
||||
'$d1' => 'float|int',
|
||||
'$d2' => 'float|int',
|
||||
'$d3' => 'float|int',
|
||||
'$e1' => 'float|int',
|
||||
'$e2' => 'float|int',
|
||||
'$e3' => 'float|int',
|
||||
'$f1' => 'float|int',
|
||||
'$f2' => 'float|int',
|
||||
'$f3' => 'float|int',
|
||||
],
|
||||
'ignored_issues' => ['InvalidOperand'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user