Skip to content

Commit 9ad877b

Browse files
Merge pull request #20447 from kamil-tekiela/Pass-Statement-in-Result
Pass Statement in Result
2 parents e4f03b6 + 553e642 commit 9ad877b

4 files changed

Lines changed: 78 additions & 172 deletions

File tree

‎phpstan-baseline.neon‎

Lines changed: 8 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -4809,64 +4809,34 @@ parameters:
48094809
count: 1
48104810
path: src/Dbal/MysqliResult.php
48114811

4812-
-
4813-
message: '#^Access to an undefined property PhpMyAdmin\\SqlParser\\Statement\:\:\$expr\.$#'
4814-
identifier: property.notFound
4815-
count: 1
4816-
path: src/Display/Results.php
4817-
4818-
-
4819-
message: '#^Access to an undefined property PhpMyAdmin\\SqlParser\\Statement\:\:\$from\.$#'
4820-
identifier: property.notFound
4821-
count: 2
4822-
path: src/Display/Results.php
4823-
4824-
-
4825-
message: '#^Access to an undefined property PhpMyAdmin\\SqlParser\\Statement\:\:\$limit\.$#'
4826-
identifier: property.notFound
4827-
count: 1
4828-
path: src/Display/Results.php
4829-
4830-
-
4831-
message: '#^Access to an undefined property PhpMyAdmin\\SqlParser\\Statement\:\:\$where\.$#'
4832-
identifier: property.notFound
4833-
count: 1
4834-
path: src/Display/Results.php
4835-
4836-
-
4837-
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
4838-
identifier: foreach.nonIterable
4839-
count: 4
4840-
path: src/Display/Results.php
4841-
48424812
-
48434813
message: '#^Binary operation "%%" between int\<1, max\> and mixed results in an error\.$#'
48444814
identifier: binaryOp.invalid
48454815
count: 1
48464816
path: src/Display/Results.php
48474817

48484818
-
4849-
message: '#^Binary operation "\+" between mixed and int results in an error\.$#'
4819+
message: '#^Binary operation "\+" between int\|string and int results in an error\.$#'
48504820
identifier: binaryOp.invalid
48514821
count: 1
48524822
path: src/Display/Results.php
48534823

48544824
-
4855-
message: '#^Binary operation "\+" between mixed and int\|numeric\-string results in an error\.$#'
4825+
message: '#^Binary operation "\+" between int\|string and int\|string results in an error\.$#'
48564826
identifier: binaryOp.invalid
48574827
count: 1
48584828
path: src/Display/Results.php
48594829

48604830
-
4861-
message: '#^Binary operation "\+" between mixed and mixed results in an error\.$#'
4831+
message: '#^Binary operation "\+" between mixed and int\|numeric\-string results in an error\.$#'
48624832
identifier: binaryOp.invalid
48634833
count: 1
48644834
path: src/Display/Results.php
48654835

48664836
-
4867-
message: '#^Binary operation "\-" between \(array\|float\|int\) and 1 results in an error\.$#'
4837+
message: '#^Binary operation "\-" between mixed and 1 results in an error\.$#'
48684838
identifier: binaryOp.invalid
4869-
count: 1
4839+
count: 2
48704840
path: src/Display/Results.php
48714841

48724842
-
@@ -4959,12 +4929,6 @@ parameters:
49594929
count: 1
49604930
path: src/Display/Results.php
49614931

4962-
-
4963-
message: '#^Cannot access offset 0 on mixed\.$#'
4964-
identifier: offsetAccess.nonOffsetAccessible
4965-
count: 1
4966-
path: src/Display/Results.php
4967-
49684932
-
49694933
message: '#^Cannot access offset int\<0, max\> on mixed\.$#'
49704934
identifier: offsetAccess.nonOffsetAccessible
@@ -4977,12 +4941,6 @@ parameters:
49774941
count: 4
49784942
path: src/Display/Results.php
49794943

4980-
-
4981-
message: '#^Cannot access property \$alias on mixed\.$#'
4982-
identifier: property.nonObject
4983-
count: 1
4984-
path: src/Display/Results.php
4985-
49864944
-
49874945
message: '#^Cannot access property \$column on PhpMyAdmin\\SqlParser\\Components\\Expression\|null\.$#'
49884946
identifier: property.nonObject
@@ -4995,30 +4953,6 @@ parameters:
49954953
count: 3
49964954
path: src/Display/Results.php
49974955

4998-
-
4999-
message: '#^Cannot access property \$identifiers on mixed\.$#'
5000-
identifier: property.nonObject
5001-
count: 1
5002-
path: src/Display/Results.php
5003-
5004-
-
5005-
message: '#^Cannot access property \$offset on mixed\.$#'
5006-
identifier: property.nonObject
5007-
count: 1
5008-
path: src/Display/Results.php
5009-
5010-
-
5011-
message: '#^Cannot access property \$rowCount on mixed\.$#'
5012-
identifier: property.nonObject
5013-
count: 1
5014-
path: src/Display/Results.php
5015-
5016-
-
5017-
message: '#^Cannot access property \$table on mixed\.$#'
5018-
identifier: property.nonObject
5019-
count: 2
5020-
path: src/Display/Results.php
5021-
50224956
-
50234957
message: '#^Cannot access property \$type on PhpMyAdmin\\SqlParser\\Token\|null\.$#'
50244958
identifier: property.nonObject
@@ -5040,7 +4974,7 @@ parameters:
50404974
-
50414975
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
50424976
identifier: empty.notAllowed
5043-
count: 23
4977+
count: 18
50444978
path: src/Display/Results.php
50454979

50464980
-
@@ -5109,24 +5043,12 @@ parameters:
51095043
count: 1
51105044
path: src/Display/Results.php
51115045

5112-
-
5113-
message: '#^Only numeric types are allowed in \-, \(array\|float\|int\) given on the left side\.$#'
5114-
identifier: minus.leftNonNumeric
5115-
count: 1
5116-
path: src/Display/Results.php
5117-
51185046
-
51195047
message: '#^Parameter \#1 \$array of function array_shift expects array, mixed given\.$#'
51205048
identifier: argument.type
51215049
count: 1
51225050
path: src/Display/Results.php
51235051

5124-
-
5125-
message: '#^Parameter \#1 \$db of method PhpMyAdmin\\ConfigStorage\\Relation\:\:getComments\(\) expects string, mixed given\.$#'
5126-
identifier: argument.type
5127-
count: 1
5128-
path: src/Display/Results.php
5129-
51305052
-
51315053
message: '#^Parameter \#1 \$db of method PhpMyAdmin\\ConfigStorage\\Relation\:\:getDisplayField\(\) expects string, string\|null given\.$#'
51325054
identifier: argument.type
@@ -5160,7 +5082,7 @@ parameters:
51605082
-
51615083
message: '#^Parameter \#1 \$value of function count expects array\|Countable, mixed given\.$#'
51625084
identifier: argument.type
5163-
count: 2
5085+
count: 1
51645086
path: src/Display/Results.php
51655087

51665088
-
@@ -5187,18 +5109,6 @@ parameters:
51875109
count: 1
51885110
path: src/Display/Results.php
51895111

5190-
-
5191-
message: '#^Parameter \#2 \$string2 of function strcasecmp expects string, mixed given\.$#'
5192-
identifier: argument.type
5193-
count: 1
5194-
path: src/Display/Results.php
5195-
5196-
-
5197-
message: '#^Parameter \#2 \$table of method PhpMyAdmin\\ConfigStorage\\Relation\:\:getComments\(\) expects string, mixed given\.$#'
5198-
identifier: argument.type
5199-
count: 1
5200-
path: src/Display/Results.php
5201-
52025112
-
52035113
message: '#^Parameter \#2 \$table of method PhpMyAdmin\\ConfigStorage\\Relation\:\:getDisplayField\(\) expects string, string\|null given\.$#'
52045114
identifier: argument.type
@@ -5238,13 +5148,7 @@ parameters:
52385148
-
52395149
message: '#^Possibly invalid array key type mixed\.$#'
52405150
identifier: offsetAccess.invalidOffset
5241-
count: 16
5242-
path: src/Display/Results.php
5243-
5244-
-
5245-
message: '#^Property PhpMyAdmin\\FieldMetadata\:\:\$name \(string\) does not accept mixed\.$#'
5246-
identifier: assign.propertyType
5247-
count: 1
5151+
count: 15
52485152
path: src/Display/Results.php
52495153

52505154
-

‎psalm-baseline.xml‎

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,12 +3515,8 @@
35153515
<code><![CDATA[$colVisib]]></code>
35163516
<code><![CDATA[$colVisib]]></code>
35173517
<code><![CDATA[$colVisibCurrent]]></code>
3518-
<code><![CDATA[$expr->alias]]></code>
3519-
<code><![CDATA[$field->table]]></code>
3520-
<code><![CDATA[$statementInfo->statement->from]]></code>
35213518
<code><![CDATA[(int) $this->unlimNumRows / $_SESSION['tmpval']['max_rows']]]></code>
35223519
<code><![CDATA[(int) $this->unlimNumRows / $_SESSION['tmpval']['max_rows']]]></code>
3523-
<code><![CDATA[empty($field->database) ? $this->db : $field->database]]></code>
35243520
</MixedArgument>
35253521
<MixedArrayAccess>
35263522
<code><![CDATA[$_SESSION['tmpval']['display_binary']]]></code>
@@ -3547,13 +3543,16 @@
35473543
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
35483544
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
35493545
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
3546+
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
35503547
<code><![CDATA[$_SESSION['tmpval']['pftext']]]></code>
35513548
<code><![CDATA[$_SESSION['tmpval']['pftext']]]></code>
35523549
<code><![CDATA[$_SESSION['tmpval']['pftext']]]></code>
35533550
<code><![CDATA[$_SESSION['tmpval']['pos']]]></code>
35543551
<code><![CDATA[$_SESSION['tmpval']['pos']]]></code>
35553552
<code><![CDATA[$_SESSION['tmpval']['pos']]]></code>
35563553
<code><![CDATA[$_SESSION['tmpval']['pos']]]></code>
3554+
<code><![CDATA[$_SESSION['tmpval']['pos']]]></code>
3555+
<code><![CDATA[$_SESSION['tmpval']['pos']]]></code>
35573556
<code><![CDATA[$_SESSION['tmpval']['possible_as_geometry']]]></code>
35583557
<code><![CDATA[$_SESSION['tmpval']['query']]]></code>
35593558
<code><![CDATA[$_SESSION['tmpval']['query']]]></code>
@@ -3636,14 +3635,14 @@
36363635
<code><![CDATA[$colOrder]]></code>
36373636
<code><![CDATA[$colVisib]]></code>
36383637
<code><![CDATA[$colVisibCurrent]]></code>
3639-
<code><![CDATA[$expr]]></code>
3640-
<code><![CDATA[$expr]]></code>
3641-
<code><![CDATA[$field]]></code>
3638+
<code><![CDATA[$firstShownRec]]></code>
3639+
<code><![CDATA[$firstShownRec]]></code>
36423640
<code><![CDATA[$geoOption]]></code>
36433641
<code><![CDATA[$hiddenFields['session_max_rows']]]></code>
36443642
<code><![CDATA[$i]]></code>
36453643
<code><![CDATA[$i]]></code>
36463644
<code><![CDATA[$identifier]]></code>
3645+
<code><![CDATA[$lastShownRec]]></code>
36473646
<code><![CDATA[$meta->name]]></code>
36483647
<code><![CDATA[$pftext]]></code>
36493648
<code><![CDATA[$pos]]></code>
@@ -3658,17 +3657,8 @@
36583657
<code><![CDATA[$_SESSION['tmpval']['max_rows']]]></code>
36593658
<code><![CDATA[$_SESSION['tmpval']['pos']]]></code>
36603659
<code><![CDATA[$_SESSION['tmpval']['repeat_cells']]]></code>
3660+
<code><![CDATA[$firstShownRec]]></code>
36613661
</MixedOperand>
3662-
<MixedPropertyFetch>
3663-
<code><![CDATA[$expr->alias]]></code>
3664-
<code><![CDATA[$expr->column]]></code>
3665-
<code><![CDATA[$expr->column]]></code>
3666-
<code><![CDATA[$expr->identifiers]]></code>
3667-
<code><![CDATA[$field->database]]></code>
3668-
<code><![CDATA[$field->table]]></code>
3669-
<code><![CDATA[$statementInfo->statement->from[0]->table]]></code>
3670-
<code><![CDATA[$statementInfo->statement->limit->offset]]></code>
3671-
</MixedPropertyFetch>
36723662
<MixedReturnTypeCoercion>
36733663
<code><![CDATA[[$singleSortOrder, implode(', ', $sortOrderColumns), $orderImg ?? '']]]></code>
36743664
<code><![CDATA[string[]]]></code>
@@ -3677,6 +3667,11 @@
36773667
<code><![CDATA[$this->numRows > 0 ? $this->numRows - 1 : 0]]></code>
36783668
<code><![CDATA[$this->numRows > 0 ? $this->numRows - 1 : 0]]></code>
36793669
</PossiblyInvalidArgument>
3670+
<PossiblyInvalidOperand>
3671+
<code><![CDATA[$firstShownRec]]></code>
3672+
<code><![CDATA[$firstShownRec]]></code>
3673+
<code><![CDATA[$rowCount]]></code>
3674+
</PossiblyInvalidOperand>
36803675
<PossiblyNullArgument>
36813676
<code><![CDATA[$oneKey->refTableName]]></code>
36823677
<code><![CDATA[$rel['foreign_db']]]></code>
@@ -3709,36 +3704,24 @@
37093704
<code><![CDATA[$o->expr->expr]]></code>
37103705
<code><![CDATA[$order->expr->column]]></code>
37113706
</PossiblyNullPropertyFetch>
3712-
<RedundantCondition>
3713-
<code><![CDATA[empty($statementInfo->statement->from)]]></code>
3714-
<code><![CDATA[empty($statementInfo->statement->from)]]></code>
3715-
<code><![CDATA[empty($statementInfo->statement->where)]]></code>
3716-
<code><![CDATA[empty($statementInfo->statement->where)]]></code>
3717-
</RedundantCondition>
37183707
<RiskyTruthyFalsyComparison>
37193708
<code><![CDATA[! $colVisibCurrent]]></code>
37203709
<code><![CDATA[! $colVisibElement]]></code>
37213710
<code><![CDATA[$colVisib]]></code>
37223711
<code><![CDATA[$colVisib]]></code>
37233712
<code><![CDATA[$posMimeOctetstream]]></code>
3713+
<code><![CDATA[empty($expr->alias)]]></code>
3714+
<code><![CDATA[empty($expr->column)]]></code>
3715+
<code><![CDATA[empty($field->database)]]></code>
3716+
<code><![CDATA[empty($field->table)]]></code>
37243717
<code><![CDATA[empty($linkRelations['link_dependancy_params'])]]></code>
37253718
<code><![CDATA[empty($rowInfo['routine_type'])]]></code>
37263719
<code><![CDATA[empty($statement->order)]]></code>
3720+
<code><![CDATA[empty($statementInfo->statement->from[0]->table)]]></code>
37273721
<code><![CDATA[empty($this->mediaTypeMap[$orgFullColName]['input_transformation'])]]></code>
37283722
<code><![CDATA[empty($this->mediaTypeMap[$orgFullColName]['transformation'])]]></code>
37293723
<code><![CDATA[strpos($linkRelations['default_page'], '?')]]></code>
37303724
</RiskyTruthyFalsyComparison>
3731-
<TypeDoesNotContainType>
3732-
<code><![CDATA[! empty($statementInfo->statement->expr)]]></code>
3733-
<code><![CDATA[! empty($statementInfo->statement->from)]]></code>
3734-
<code><![CDATA[! empty($statementInfo->statement->limit)]]></code>
3735-
</TypeDoesNotContainType>
3736-
<UnusedParam>
3737-
<code><![CDATA[$afterCount]]></code>
3738-
<code><![CDATA[$posNext]]></code>
3739-
<code><![CDATA[$preCount]]></code>
3740-
<code><![CDATA[$total]]></code>
3741-
</UnusedParam>
37423725
</file>
37433726
<file src="src/Encoding.php">
37443727
<DeprecatedMethod>

0 commit comments

Comments
 (0)