Skip to content

Commit fc0a1ed

Browse files
authored
Merge pull request #183 from simon-mundy/fix/176-length-column-null-length
Render length columns without a length instead of throwing ValueError
2 parents 468e214 + b613f1c commit fc0a1ed

23 files changed

Lines changed: 647 additions & 197 deletions

‎analyzer-baseline.toml‎

Lines changed: 66 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ count = 1
11731173
[[issues]]
11741174
file = "src/Adapter/Profiler/Profiler.php"
11751175
code = "invalid-property-assignment-value"
1176-
message = '''Invalid type for property `$profiles`: expected `array<array-key, array{'elapse': float|null, 'end': float|null, 'parameters': PhpDb\Adapter\ParameterContainer|null, 'sql': string, 'start': float}>`, but got `array<array-key, array{'elapse': float|null, 'end': float|null, 'parameters': PhpDb\Adapter\ParameterContainer|null, 'sql': null|string, 'start': float}>`.'''
1176+
message = '''Invalid type for property `$profiles`: expected `array<array-key, array{'elapse': float|null, 'end': float|null, 'parameters': PhpDb\Adapter\ParameterContainer|null, 'sql': string, 'start': float}>`, but got `non-empty-array<array-key, array{'elapse': float|null, 'end': float|null, 'parameters': PhpDb\Adapter\ParameterContainer|null, 'sql': null|string, 'start': float}>`.'''
11771177
count = 1
11781178

11791179
[[issues]]
@@ -1194,24 +1194,6 @@ code = "missing-property-type"
11941194
message = "Property `$profiles` is missing a type hint."
11951195
count = 1
11961196

1197-
[[issues]]
1198-
file = "src/Adapter/Profiler/Profiler.php"
1199-
code = "possibly-null-operand"
1200-
message = "Right operand in arithmetic operation might be `null` (type `float|null`)."
1201-
count = 1
1202-
1203-
[[issues]]
1204-
file = "src/Adapter/Profiler/Profiler.php"
1205-
code = "possibly-undefined-int-array-index"
1206-
message = '''Possibly undefined array key `int` accessed on `array<array-key, array{'elapse': float|null, 'end': float|null, 'parameters': PhpDb\Adapter\ParameterContainer|null, 'sql': string, 'start': float}>`.'''
1207-
count = 1
1208-
1209-
[[issues]]
1210-
file = "src/Adapter/Profiler/Profiler.php"
1211-
code = "possibly-undefined-string-array-index"
1212-
message = '''Possibly undefined array key accessed on `array{'elapse': float|null, 'end': float, 'parameters': PhpDb\Adapter\ParameterContainer|null, 'sql': string, 'start': float}|array{'end': float}`.'''
1213-
count = 1
1214-
12151197
[[issues]]
12161198
file = "src/Adapter/Profiler/Profiler.php"
12171199
code = "unhandled-thrown-type"
@@ -2076,6 +2058,12 @@ code = "class-must-be-final"
20762058
message = 'Class `PhpDb\RowGateway\Exception\RuntimeException` should be declared `final`.'
20772059
count = 1
20782060

2061+
[[issues]]
2062+
file = "src/RowGateway/Feature/FeatureSet.php"
2063+
code = "unused-property"
2064+
message = "Property `$magicSpecifications` is never used."
2065+
count = 1
2066+
20792067
[[issues]]
20802068
file = "src/RowGateway/RowGateway.php"
20812069
code = "class-must-be-final"
@@ -2142,12 +2130,6 @@ code = "invalid-iterator"
21422130
message = "The expression provided to `foreach` is not iterable. It resolved to type `mixed`, which is not iterable."
21432131
count = 1
21442132

2145-
[[issues]]
2146-
file = "src/Sql/AbstractSql.php"
2147-
code = "invalid-member-selector"
2148-
message = "Invalid type `array-key` used as a member selector; a string is expected."
2149-
count = 1
2150-
21512133
[[issues]]
21522134
file = "src/Sql/AbstractSql.php"
21532135
code = "invalid-operand"
@@ -2187,7 +2169,7 @@ count = 1
21872169
[[issues]]
21882170
file = "src/Sql/AbstractSql.php"
21892171
code = "less-specific-nested-argument-type"
2190-
message = "Argument type mismatch for argument #2 of `vsprintf`: expected `array<array-key, Stringable|null|scalar>`, but provided type `array{}|non-empty-list<mixed>` is less specific."
2172+
message = "Argument type mismatch for argument #2 of `vsprintf`: expected `array<array-key, Stringable|null|scalar>`, but provided type `list<mixed>` is less specific."
21912173
count = 1
21922174

21932175
[[issues]]
@@ -2376,6 +2358,12 @@ code = "string-member-selector"
23762358
message = "This member selector uses a non-literal string type (`non-empty-string`); its specific value cannot be statically determined."
23772359
count = 1
23782360

2361+
[[issues]]
2362+
file = "src/Sql/AbstractSql.php"
2363+
code = "string-member-selector"
2364+
message = "This member selector uses a non-literal string type (`string`); its specific value cannot be statically determined."
2365+
count = 1
2366+
23792367
[[issues]]
23802368
file = "src/Sql/AbstractSql.php"
23812369
code = "unhandled-thrown-type"
@@ -3219,7 +3207,13 @@ count = 1
32193207
[[issues]]
32203208
file = "src/Sql/Ddl/CreateTable.php"
32213209
code = "possibly-undefined-string-array-index"
3222-
message = "Possibly undefined array key `string('combinedBy')` accessed on `array<array-key, array<array-key, mixed>|string>`."
3210+
message = "Possibly undefined array key `string('combinedBy')` accessed on `array<array-key, array<array-key, mixed>>`."
3211+
count = 1
3212+
3213+
[[issues]]
3214+
file = "src/Sql/Ddl/CreateTable.php"
3215+
code = "possibly-undefined-string-array-index"
3216+
message = "Possibly undefined array key `string('combinedBy')` accessed on `array<array-key, string>`."
32233217
count = 1
32243218

32253219
[[issues]]
@@ -3900,12 +3894,6 @@ code = "class-must-be-final"
39003894
message = 'Class `PhpDb\Sql\Platform\Platform` should be declared `final`.'
39013895
count = 1
39023896

3903-
[[issues]]
3904-
file = "src/Sql/Platform/Platform.php"
3905-
code = "imprecise-type"
3906-
message = "Type `array` in return type of `getDecorators` is imprecise, equivalent to `array<array-key, mixed>`."
3907-
count = 1
3908-
39093897
[[issues]]
39103898
file = "src/Sql/Platform/Platform.php"
39113899
code = "invalid-iterator"
@@ -4251,7 +4239,7 @@ count = 1
42514239
[[issues]]
42524240
file = "src/Sql/Predicate/PredicateSet.php"
42534241
code = "less-specific-nested-argument-type"
4254-
message = "Argument type mismatch for argument #2 of `implode`: expected `array<array-key, Stringable|null|scalar>|null`, but provided type `array{}|non-empty-list<mixed>` is less specific."
4242+
message = "Argument type mismatch for argument #2 of `implode`: expected `array<array-key, Stringable|null|scalar>|null`, but provided type `list<mixed>` is less specific."
42554243
count = 1
42564244

42574245
[[issues]]
@@ -4263,7 +4251,7 @@ count = 1
42634251
[[issues]]
42644252
file = "src/Sql/Predicate/PredicateSet.php"
42654253
code = "less-specific-nested-return-statement"
4266-
message = '''Returned type `array{'spec': string, 'values': array{}|list<mixed>}` is less specific than the declared return type `array{'spec': string, 'values': array<array-key, PhpDb\Sql\ArgumentInterface>}` for function `PhpDb\Sql\Predicate\PredicateSet::getExpressionData` due to nested 'mixed'.'''
4254+
message = '''Returned type `array{'spec': string, 'values': list<mixed>}` is less specific than the declared return type `array{'spec': string, 'values': array<array-key, PhpDb\Sql\ArgumentInterface>}` for function `PhpDb\Sql\Predicate\PredicateSet::getExpressionData` due to nested 'mixed'.'''
42674255
count = 1
42684256

42694257
[[issues]]
@@ -4518,12 +4506,6 @@ code = "invalid-property-assignment-value"
45184506
message = 'Invalid type for property `$joins`: expected `PhpDb\Sql\Join`, but got `null`.'
45194507
count = 1
45204508

4521-
[[issues]]
4522-
file = "src/Sql/Select.php"
4523-
code = "invalid-property-assignment-value"
4524-
message = "Invalid type for property `$specifications`: expected `array<array-key, array<array-key, mixed>>|array<array-key, string>`, but got `array<array-key, array<array-key, mixed>|string>`."
4525-
count = 1
4526-
45274509
[[issues]]
45284510
file = "src/Sql/Select.php"
45294511
code = "invalid-property-assignment-value"
@@ -5218,36 +5200,6 @@ count = 1
52185200
file = "src/TableGateway/AbstractTableGateway.php"
52195201
code = "impossible-condition"
52205202
message = "This condition (type `false`) will always evaluate to false."
5221-
count = 7
5222-
5223-
[[issues]]
5224-
file = "src/TableGateway/AbstractTableGateway.php"
5225-
code = "impossible-type-comparison"
5226-
message = "Impossible type assertion: `$deleteState['table']` of type `string` can never be `array<array-key, mixed>`."
5227-
count = 1
5228-
5229-
[[issues]]
5230-
file = "src/TableGateway/AbstractTableGateway.php"
5231-
code = "impossible-type-comparison"
5232-
message = "Impossible type assertion: `$insertState['table']` of type `string` can never be `array<array-key, mixed>`."
5233-
count = 1
5234-
5235-
[[issues]]
5236-
file = "src/TableGateway/AbstractTableGateway.php"
5237-
code = "impossible-type-comparison"
5238-
message = "Impossible type assertion: `$this->table` of type `string` can never be `array<array-key, mixed>`."
5239-
count = 1
5240-
5241-
[[issues]]
5242-
file = "src/TableGateway/AbstractTableGateway.php"
5243-
code = "impossible-type-comparison"
5244-
message = "Impossible type assertion: `$this->table` of type `string` can never be `object`."
5245-
count = 1
5246-
5247-
[[issues]]
5248-
file = "src/TableGateway/AbstractTableGateway.php"
5249-
code = "impossible-type-comparison"
5250-
message = "Impossible type assertion: `$updateState['table']` of type `string` can never be `array<array-key, mixed>`."
52515203
count = 1
52525204

52535205
[[issues]]
@@ -5294,9 +5246,9 @@ count = 1
52945246

52955247
[[issues]]
52965248
file = "src/TableGateway/AbstractTableGateway.php"
5297-
code = "invalid-clone"
5298-
message = "Invalid `clone` operation on non-cloneable type `never`."
5299-
count = 1
5249+
code = "invalid-array-access"
5250+
message = 'Cannot access array index on object `PhpDb\Sql\TableIdentifier` that does not implement `ArrayAccess`.'
5251+
count = 3
53005252

53015253
[[issues]]
53025254
file = "src/TableGateway/AbstractTableGateway.php"
@@ -5328,6 +5280,12 @@ code = "invalid-return-statement"
53285280
message = 'Invalid return type for function `PhpDb\TableGateway\AbstractTableGateway::getSql`: expected `PhpDb\Sql\Sql`, but found `PhpDb\Sql\Sql|null`.'
53295281
count = 1
53305282

5283+
[[issues]]
5284+
file = "src/TableGateway/AbstractTableGateway.php"
5285+
code = "invalid-return-statement"
5286+
message = 'Invalid return type for function `PhpDb\TableGateway\AbstractTableGateway::getTable`: expected `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|string`, but found `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|null|string`.'
5287+
count = 1
5288+
53315289
[[issues]]
53325290
file = "src/TableGateway/AbstractTableGateway.php"
53335291
code = "missing-api-or-internal"
@@ -5430,24 +5388,6 @@ code = "mixed-return-statement"
54305388
message = 'Could not infer a precise return type for function `PhpDb\TableGateway\AbstractTableGateway::executeUpdate`. Saw type `mixed`.'
54315389
count = 1
54325390

5433-
[[issues]]
5434-
file = "src/TableGateway/AbstractTableGateway.php"
5435-
code = "no-value"
5436-
message = "Argument #1 passed to function `array_values` has type `never`, meaning it cannot produce a value."
5437-
count = 3
5438-
5439-
[[issues]]
5440-
file = "src/TableGateway/AbstractTableGateway.php"
5441-
code = "no-value"
5442-
message = "Argument #1 passed to function `count` has type `never`, meaning it cannot produce a value."
5443-
count = 1
5444-
5445-
[[issues]]
5446-
file = "src/TableGateway/AbstractTableGateway.php"
5447-
code = "no-value"
5448-
message = "Argument #1 passed to function `reset` has type `never`, meaning it cannot produce a value."
5449-
count = 1
5450-
54515391
[[issues]]
54525392
file = "src/TableGateway/AbstractTableGateway.php"
54535393
code = "nullable-return-statement"
@@ -5472,6 +5412,12 @@ code = "nullable-return-statement"
54725412
message = 'Function `PhpDb\TableGateway\AbstractTableGateway::getSql` is declared to return `PhpDb\Sql\Sql` but possibly returns a nullable value (inferred as `PhpDb\Sql\Sql|null`).'
54735413
count = 1
54745414

5415+
[[issues]]
5416+
file = "src/TableGateway/AbstractTableGateway.php"
5417+
code = "nullable-return-statement"
5418+
message = 'Function `PhpDb\TableGateway\AbstractTableGateway::getTable` is declared to return `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|string` but possibly returns a nullable value (inferred as `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|null|string`).'
5419+
count = 1
5420+
54755421
[[issues]]
54765422
file = "src/TableGateway/AbstractTableGateway.php"
54775423
code = "overly-wide-return-type"
@@ -5498,15 +5444,15 @@ count = 1
54985444

54995445
[[issues]]
55005446
file = "src/TableGateway/AbstractTableGateway.php"
5501-
code = "redundant-comparison"
5502-
message = "Redundant `===` comparison: left-hand side is never identical to right-hand side."
5503-
count = 2
5447+
code = "possibly-undefined-string-array-index"
5448+
message = "Possibly undefined array key `string('table')` accessed on `array<array-key, mixed>`."
5449+
count = 3
55045450

55055451
[[issues]]
55065452
file = "src/TableGateway/AbstractTableGateway.php"
5507-
code = "redundant-logical-operation"
5508-
message = "Redundant `&&` operation: left operand is always falsy and right operand is not evaluated."
5509-
count = 2
5453+
code = "redundant-comparison"
5454+
message = "Redundant `===` comparison: left-hand side is never identical to right-hand side."
5455+
count = 1
55105456

55115457
[[issues]]
55125458
file = "src/TableGateway/Exception/ExceptionInterface.php"
@@ -5527,27 +5473,39 @@ message = 'Class `PhpDb\TableGateway\Exception\RuntimeException` should be decla
55275473
count = 1
55285474

55295475
[[issues]]
5530-
file = "src/TableGateway/TableGateway.php"
5531-
code = "class-must-be-final"
5532-
message = 'Class `PhpDb\TableGateway\TableGateway` should be declared `final`.'
5476+
file = "src/TableGateway/Feature/MetadataFeature.php"
5477+
code = "mixed-assignment"
5478+
message = "Assigning `mixed` type to a variable may lead to unexpected behavior."
55335479
count = 1
55345480

55355481
[[issues]]
5536-
file = "src/TableGateway/TableGateway.php"
5537-
code = "imprecise-type"
5538-
message = "Type `array` in parameter `$features` is imprecise, equivalent to `array<array-key, mixed>`."
5482+
file = "src/TableGateway/Feature/MetadataFeature.php"
5483+
code = "mixed-assignment"
5484+
message = "Assigning `nonnull` type to a variable may lead to unexpected behavior."
5485+
count = 1
5486+
5487+
[[issues]]
5488+
file = "src/TableGateway/Feature/RowGatewayFeature.php"
5489+
code = "mixed-assignment"
5490+
message = "Assigning `mixed` type to a variable may lead to unexpected behavior."
5491+
count = 1
5492+
5493+
[[issues]]
5494+
file = "src/TableGateway/Feature/SequenceFeature.php"
5495+
code = "mixed-assignment"
5496+
message = "Assigning `mixed` type to a variable may lead to unexpected behavior."
55395497
count = 1
55405498

55415499
[[issues]]
55425500
file = "src/TableGateway/TableGateway.php"
5543-
code = "imprecise-type"
5544-
message = "Type `array` in parameter `$table` is imprecise, equivalent to `array<array-key, mixed>`."
5501+
code = "class-must-be-final"
5502+
message = 'Class `PhpDb\TableGateway\TableGateway` should be declared `final`.'
55455503
count = 1
55465504

55475505
[[issues]]
55485506
file = "src/TableGateway/TableGateway.php"
5549-
code = "invalid-property-assignment-value"
5550-
message = 'Invalid type for property `$table`: expected `string`, but got `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|string`.'
5507+
code = "imprecise-type"
5508+
message = "Type `array` in parameter `$table` is imprecise, equivalent to `array<array-key, mixed>`."
55515509
count = 1
55525510

55535511
[[issues]]
@@ -5567,28 +5525,3 @@ file = "src/TableGateway/TableGatewayInterface.php"
55675525
code = "missing-api-or-internal"
55685526
message = 'Interface `PhpDb\TableGateway\TableGatewayInterface` is missing an `@api` or `@internal` annotation.'
55695527
count = 1
5570-
5571-
[[issues]]
5572-
file = "src/TableGateway/AbstractTableGateway.php"
5573-
code = "nullable-return-statement"
5574-
message = 'Function `PhpDb\TableGateway\AbstractTableGateway::getTable` is declared to return `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|string` but possibly returns a nullable value (inferred as `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|null|string`).'
5575-
count = 1
5576-
5577-
[[issues]]
5578-
file = "src/TableGateway/AbstractTableGateway.php"
5579-
code = "invalid-return-statement"
5580-
message = 'Invalid return type for function `PhpDb\TableGateway\AbstractTableGateway::getTable`: expected `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|string`, but found `PhpDb\Sql\TableIdentifier|array<array-key, mixed>|null|string`.'
5581-
count = 1
5582-
5583-
5584-
[[issues]]
5585-
file = "src/TableGateway/AbstractTableGateway.php"
5586-
code = "invalid-array-access"
5587-
message = 'Cannot access array index on object `PhpDb\Sql\TableIdentifier` that does not implement `ArrayAccess`.'
5588-
count = 3
5589-
5590-
[[issues]]
5591-
file = "src/TableGateway/AbstractTableGateway.php"
5592-
code = "possibly-undefined-string-array-index"
5593-
message = "Possibly undefined array key `string('table')` accessed on `array<array-key, mixed>`."
5594-
count = 3

0 commit comments

Comments
 (0)