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