mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 09:37:59 +01:00
Patch
This commit is contained in:
parent
3f82312ffa
commit
c9fe76cadc
@ -1260,7 +1260,7 @@ final class ArgumentsAnalyzer
|
||||
Context $context,
|
||||
PhpParser\Node\Expr\PropertyFetch $stmt,
|
||||
string $fq_class_name,
|
||||
string $prop_name
|
||||
string $prop_name,
|
||||
): void {
|
||||
$property_id = $fq_class_name . '::$' . $prop_name;
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psalm\Internal\Provider\ReturnTypeProvider;
|
||||
|
||||
use Psalm\Internal\Analyzer\Statements\Expression\Fetch\VariableFetchAnalyzer;
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psalm\Internal\Provider\ReturnTypeProvider;
|
||||
|
||||
use PhpParser\Node\Arg;
|
||||
@ -108,12 +110,11 @@ final class FilterUtils
|
||||
return Type::getNull();
|
||||
}
|
||||
|
||||
/** @return int|Union|null */
|
||||
public static function getFilterArgValueOrError(
|
||||
Arg $filter_arg,
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
Codebase $codebase
|
||||
) {
|
||||
Codebase $codebase,
|
||||
): int|Union|null {
|
||||
$filter_arg_type = $statements_analyzer->node_data->getType($filter_arg->value);
|
||||
if (!$filter_arg_type) {
|
||||
return null;
|
||||
@ -154,8 +155,8 @@ final class FilterUtils
|
||||
Codebase $codebase,
|
||||
CodeLocation $code_location,
|
||||
string $function_id,
|
||||
int $filter_int_used
|
||||
) {
|
||||
int $filter_int_used,
|
||||
): array|Union|null {
|
||||
$options_arg_type = $statements_analyzer->node_data->getType($options_arg->value);
|
||||
if (!$options_arg_type) {
|
||||
return null;
|
||||
@ -339,7 +340,7 @@ final class FilterUtils
|
||||
string $function_id,
|
||||
CodeLocation $code_location,
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
Codebase $codebase
|
||||
Codebase $codebase,
|
||||
): Union {
|
||||
IssueBuffer::maybeAdd(
|
||||
new InvalidArgument(
|
||||
@ -397,7 +398,7 @@ final class FilterUtils
|
||||
Union $fails_type,
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
CodeLocation $code_location,
|
||||
Codebase $codebase
|
||||
Codebase $codebase,
|
||||
): ?Union {
|
||||
$all_filters = self::getFilters($codebase);
|
||||
$flags_int_used_rest = $flags_int_used;
|
||||
@ -500,7 +501,7 @@ final class FilterUtils
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
CodeLocation $code_location,
|
||||
Codebase $codebase,
|
||||
string $function_id
|
||||
string $function_id,
|
||||
): array {
|
||||
$default = null;
|
||||
$min_range = null;
|
||||
@ -605,16 +606,12 @@ final class FilterUtils
|
||||
return [$default, $min_range, $max_range, $has_range, $regexp];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float|int|null $min_range
|
||||
* @param float|int|null $max_range
|
||||
*/
|
||||
protected static function isRangeValid(
|
||||
$min_range,
|
||||
$max_range,
|
||||
float|int|null $min_range,
|
||||
float|int|null $max_range,
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
CodeLocation $code_location,
|
||||
string $function_id
|
||||
string $function_id,
|
||||
): bool {
|
||||
if ($min_range !== null && $max_range !== null && $min_range > $max_range) {
|
||||
IssueBuffer::maybeAdd(
|
||||
@ -637,8 +634,6 @@ final class FilterUtils
|
||||
*
|
||||
* @psalm-suppress ComplexMethod
|
||||
* @param Union|null $not_set_type null if undefined filtered variable will return $fails_type
|
||||
* @param float|int|null $min_range
|
||||
* @param float|int|null $max_range
|
||||
* @param non-falsy-string|true|null $regexp
|
||||
*/
|
||||
public static function getReturnType(
|
||||
@ -652,10 +647,10 @@ final class FilterUtils
|
||||
Codebase $codebase,
|
||||
string $function_id,
|
||||
bool $has_range,
|
||||
$min_range,
|
||||
$max_range,
|
||||
$regexp,
|
||||
bool $in_array_recursion = false
|
||||
float|int|null $min_range,
|
||||
float|int|null $max_range,
|
||||
string|bool|null $regexp,
|
||||
bool $in_array_recursion = false,
|
||||
): Union {
|
||||
// if we are inside a recursion of e.g. array<never, never>
|
||||
// it will never fail or change the type, so we can immediately return
|
||||
@ -1472,7 +1467,7 @@ final class FilterUtils
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
CodeLocation $code_location,
|
||||
Union $return_type,
|
||||
string $function_id
|
||||
string $function_id,
|
||||
): Union {
|
||||
if ($statements_analyzer->data_flow_graph
|
||||
&& !in_array('TaintedInput', $statements_analyzer->getSuppressedIssues())
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psalm\Issue;
|
||||
|
||||
final class RedundantFlag extends CodeIssue
|
||||
|
@ -6,5 +6,5 @@ namespace Psalm\Issue;
|
||||
|
||||
final class TaintedXpath extends TaintedInput
|
||||
{
|
||||
public const SHORTCODE = 322;
|
||||
public const SHORTCODE = 328;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psalm\Storage;
|
||||
|
||||
/**
|
||||
|
@ -281,7 +281,7 @@ final class MethodGetCompletionItemsForClassishThingTest extends TestCase
|
||||
'magicObjProp2',
|
||||
|
||||
'magicObjMethod',
|
||||
'magicStaticMethod',
|
||||
//'magicStaticMethod',
|
||||
|
||||
'publicObjProp',
|
||||
'protectedObjProp',
|
||||
@ -362,7 +362,7 @@ final class MethodGetCompletionItemsForClassishThingTest extends TestCase
|
||||
'magicObjProp2',
|
||||
|
||||
'magicObjMethod',
|
||||
'magicStaticMethod',
|
||||
//'magicStaticMethod',
|
||||
|
||||
'publicObjProp',
|
||||
'protectedObjProp',
|
||||
@ -440,7 +440,7 @@ final class MethodGetCompletionItemsForClassishThingTest extends TestCase
|
||||
'magicObjProp2',
|
||||
|
||||
'magicObjMethod',
|
||||
'magicStaticMethod',
|
||||
//'magicStaticMethod',
|
||||
|
||||
'publicObjProp',
|
||||
'protectedObjProp',
|
||||
|
Loading…
Reference in New Issue
Block a user