Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 93 additions & 63 deletions analysis-baseline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ code = "possibly-invalid-argument"
message = 'Possible argument type mismatch for argument #1 of `PhpDb\Mysql\AdapterPlatform::quoteViaDriver`: expected `string`, but possibly received `bool|float|int|string`.'
count = 1

[[issues]]
file = "src/Connection.php"
code = "ambiguous-object-method-access"
message = "Cannot statically verify method call on a generic `object` type."
count = 7

[[issues]]
file = "src/Connection.php"
code = "ambiguous-object-property-access"
message = "Cannot statically verify property access on a generic `object` type."
count = 3

[[issues]]
file = "src/Connection.php"
code = "invalid-iterator"
Expand All @@ -32,63 +44,87 @@ count = 1

[[issues]]
file = "src/Connection.php"
code = "invalid-property-assignment-value"
message = "Invalid type for property `$resource`: expected `mysqli`, but got `null`."
code = "invalid-method-access"
message = "Attempting to call method `autocommit()` on type `null|object|resource`, which can be `resource`."
count = 3

[[issues]]
file = "src/Connection.php"
code = "invalid-method-access"
message = "Attempting to call method `commit()` on type `null|object|resource`, which can be `resource`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #1 of `mysqli::options`: expected `int`, but found `mixed`."
code = "invalid-method-access"
message = "Attempting to call method `query()` on type `null|object|resource`, which can be `resource`."
count = 2

[[issues]]
file = "src/Connection.php"
code = "invalid-method-access"
message = "Attempting to call method `rollback()` on type `null|object|resource`, which can be `resource`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #1 of `mysqli::set_charset`: expected `string`, but found `mixed`."
code = "invalid-property-access"
message = "Attempting to access property `$error` on type `null|object|resource`, which can be `resource`."
count = 2

[[issues]]
file = "src/Connection.php"
code = "invalid-property-access"
message = "Attempting to access property `$insert_id` on type `null|object|resource`, which can be `resource`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #1 of `mysqli::ssl_set`: expected `null|string`, but found `nonnull`."
message = "Invalid argument type for argument #1 of `Exception::__construct`: expected `string`, but found `mixed`."
count = 2

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = 'Invalid argument type for argument #1 of `PhpDb\Adapter\Driver\DriverInterface::createResult`: expected `object|resource`, but found `mixed`.'
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #2 of `mysqli::options`: expected `int|string`, but found `mixed`."
message = "Invalid argument type for argument #1 of `mysqli::options`: expected `int`, but found `mixed`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #2 of `mysqli::real_connect`: expected `null|string`, but found `mixed`."
count = 2
message = "Invalid argument type for argument #1 of `mysqli::set_charset`: expected `string`, but found `mixed`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #2 of `mysqli::ssl_set`: expected `null|string`, but found `nonnull`."
message = "Invalid argument type for argument #1 of `mysqli::ssl_set`: expected `null|string`, but found `nonnull`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #3 of `mysqli::real_connect`: expected `null|string`, but found `mixed`."
count = 2
message = "Invalid argument type for argument #2 of `mysqli::options`: expected `int|string`, but found `mixed`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #3 of `mysqli::ssl_set`: expected `null|string`, but found `nonnull`."
message = "Invalid argument type for argument #2 of `mysqli::ssl_set`: expected `null|string`, but found `nonnull`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-argument"
message = "Invalid argument type for argument #4 of `mysqli::real_connect`: expected `null|string`, but found `mixed`."
count = 2
message = "Invalid argument type for argument #3 of `mysqli::ssl_set`: expected `null|string`, but found `nonnull`."
count = 1

[[issues]]
file = "src/Connection.php"
Expand All @@ -106,7 +142,7 @@ count = 1
file = "src/Connection.php"
code = "mixed-assignment"
message = "Assigning `mixed` type to a variable may lead to unexpected behavior."
count = 7
count = 6

[[issues]]
file = "src/Connection.php"
Expand All @@ -123,32 +159,50 @@ count = 1
[[issues]]
file = "src/Connection.php"
code = "mixed-return-statement"
message = "Could not infer a precise return type for function `{closure:src/Connection.php:119:31}`. Saw type `nonnull`."
message = 'Could not infer a precise return type for function `PhpDb\Mysql\Connection::getLastGeneratedValue`. Saw type `mixed`.'
count = 1

[[issues]]
file = "src/Connection.php"
code = "mixed-return-statement"
message = "Could not infer a precise return type for function `{closure:src/Connection.php:118:31}`. Saw type `nonnull`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "possible-method-access-on-null"
message = "Attempting to call a method on `null`."
count = 7

[[issues]]
file = "src/Connection.php"
code = "possibly-null-argument"
message = "Argument #1 of method `Exception::__construct` is possibly `null`, but parameter type `string` does not accept it."
count = 1

[[issues]]
file = "src/Connection.php"
code = "possibly-null-property-access"
message = "Attempting to access a property on a possibly `null` value."
count = 3

[[issues]]
file = "src/Connection.php"
code = "possibly-undefined-string-array-index"
message = "Possibly undefined array key `string('charset')` accessed on `array<array-key, mixed>`."
message = "Possibly undefined array key `string('charset')` accessed on `array<string, mixed>`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "possibly-undefined-string-array-index"
message = "Possibly undefined array key `string('driver_options')` accessed on `array<array-key, mixed>`."
message = "Possibly undefined array key `string('driver_options')` accessed on `array<string, mixed>`."
count = 1

[[issues]]
file = "src/Connection.php"
code = "redundant-condition"
message = "This condition (type `true`) will always evaluate to true."
count = 2
code = "unfulfilled-expect"
message = "This pragma was not used and may be removed."
count = 1

[[issues]]
file = "src/Container/ConnectionInterfaceFactory.php"
Expand Down Expand Up @@ -249,13 +303,13 @@ count = 1
[[issues]]
file = "src/Driver.php"
code = "incompatible-parameter-type"
message = 'Parameter `$resource` of `PhpDb\Mysql\Driver::createresult()` expects type `mysqli|mysqli_result|mysqli_stmt` but parent `PhpDb\Adapter\Driver\DriverInterface::createresult()` expects type `resource`'
message = 'Parameter `$resource` of `PhpDb\Mysql\Driver::createresult()` expects type `mysqli|mysqli_result|mysqli_stmt` but parent `PhpDb\Adapter\Driver\DriverInterface::createresult()` expects type `object|resource`'
count = 1

[[issues]]
file = "src/Driver.php"
code = "incompatible-parameter-type"
message = 'Parameter `$sqlOrResource` of `PhpDb\Mysql\Driver::createstatement()` expects type `mysqli|mysqli_stmt|string` but parent `PhpDb\Adapter\Driver\DriverInterface::createstatement()` expects type `resource|string`'
message = 'Parameter `$sqlOrResource` of `PhpDb\Mysql\Driver::createstatement()` expects type `mysqli_stmt|null|string` but parent `PhpDb\Adapter\Driver\DriverInterface::createstatement()` expects type `null|object|resource|string`'
count = 1

[[issues]]
Expand Down Expand Up @@ -300,24 +354,12 @@ code = "mixed-property-type-coercion"
message = "A value with a less specific type `array{'columns'?: array<string, array<string, array<string, array{'character_maximum_length': int|null|string, 'character_octet_length': int|null|string, 'column_default': bool|int|null|string, 'data_type': string, 'erratas': array<string, mixed>, 'is_nullable': bool|null, 'numeric_precision': int|null|string, 'numeric_scale': int|null|string, 'numeric_unsigned': bool|null, 'ordinal_position': int|null|string}>>>, 'constraint_keys'?: array<string, list<array{'column_name': string, 'constraint_name': string, 'ordinal_position': int, 'table_name': string}>>, 'constraint_references': non-empty-array<string, list<array<string, mixed>|array{'constraint_name': mixed, 'delete_rule': mixed, 'referenced_column_name': mixed, 'referenced_table_name': mixed, 'update_rule': mixed}>>, 'constraints'?: array<string, array<string, array<string, array{'check_clause'?: string, 'columns'?: list<string>, 'constraint_type'?: string, 'delete_rule'?: string, 'match_option'?: string, 'referenced_columns'?: list<string>, 'referenced_table_name'?: string, 'referenced_table_schema'?: string, 'update_rule'?: string}>>>, 'schemas'?: list<string>, 'table_names'?: array<string, array<string, array{'check_option'?: null|string, 'is_updatable'?: bool|null, 'table_type': string, 'view_definition'?: null|string}>>, 'triggers'?: array<string, array<string, array{'action_condition': null|string, 'action_order': string, 'action_orientation': string, 'action_reference_new_row': string, 'action_reference_new_table': null|string, 'action_reference_old_row': string, 'action_reference_old_table': null|string, 'action_statement': string, 'action_timing': string, 'created': DateTime|null, 'event_manipulation': string, 'event_object_catalog': string, 'event_object_schema': string, 'event_object_table': string}>>}` is being assigned to property `$data` (array{'columns'?: array<string, array<string, array<string, array{'character_maximum_length': int|null|string, 'character_octet_length': int|null|string, 'column_default': bool|int|null|string, 'data_type': string, 'erratas': array<string, mixed>, 'is_nullable': bool|null, 'numeric_precision': int|null|string, 'numeric_scale': int|null|string, 'numeric_unsigned': bool|null, 'ordinal_position': int|null|string}>>>, 'constraint_keys'?: array<string, list<array{'column_name': string, 'constraint_name': string, 'ordinal_position': int, 'table_name': string}>>, 'constraint_references'?: array<string, list<array{'constraint_name': string, 'delete_rule': string, 'referenced_column_name': string, 'referenced_table_name': string, 'update_rule': string}>>, 'constraints'?: array<string, array<string, array<string, array{'check_clause'?: string, 'columns'?: list<string>, 'constraint_type'?: string, 'delete_rule'?: string, 'match_option'?: string, 'referenced_columns'?: list<string>, 'referenced_table_name'?: string, 'referenced_table_schema'?: string, 'update_rule'?: string}>>>, 'schemas'?: list<string>, 'table_names'?: array<string, array<string, array{'check_option'?: null|string, 'is_updatable'?: bool|null, 'table_type': string, 'view_definition'?: null|string}>>, 'triggers'?: array<string, array<string, array{'action_condition': null|string, 'action_order': string, 'action_orientation': string, 'action_reference_new_row': string, 'action_reference_new_table': null|string, 'action_reference_old_row': string, 'action_reference_old_table': null|string, 'action_statement': string, 'action_timing': string, 'created': DateTime|null, 'event_manipulation': string, 'event_object_catalog': string, 'event_object_schema': string, 'event_object_table': string}>>})."
count = 1

[[issues]]
file = "src/Metadata/Source.php"
code = "possibly-invalid-argument"
message = "Possible argument type mismatch for argument #2 of `implode`: expected `array<array-key, Stringable|null|scalar>|null`, but possibly received `non-empty-list<void>`."
count = 7

[[issues]]
file = "src/Metadata/Source.php"
code = "possibly-null-argument"
message = "Argument #2 of function `preg_match_all` is possibly `null`, but parameter type `string` does not accept it."
count = 1

[[issues]]
file = "src/Metadata/Source.php"
code = "possibly-null-argument"
message = "Argument #3 of function `str_replace` is possibly `null`, but parameter type `array<array-key, string>|string` does not accept it."
count = 1

[[issues]]
file = "src/Metadata/Source.php"
code = "possibly-null-operand"
Expand All @@ -330,12 +372,6 @@ code = "possibly-null-operand"
message = "Possibly null right operand used in string concatenation (type `null|string`)."
count = 1

[[issues]]
file = "src/Metadata/Source.php"
code = "possibly-undefined-int-array-index"
message = "Possibly undefined array index accessed on `list<array<array-key, string>>`."
count = 1

[[issues]]
file = "src/Metadata/Source.php"
code = "possibly-undefined-int-array-index"
Expand Down Expand Up @@ -366,12 +402,6 @@ code = "redundant-null-coalesce"
message = "Redundant null coalesce: left-hand side is always `null`."
count = 1

[[issues]]
file = "src/Metadata/Source.php"
code = "reference-constraint-violation"
message = "Invalid assignment to by-reference parameter `$c`."
count = 7

[[issues]]
file = "src/Metadata/Source.php"
code = "unused-method"
Expand All @@ -384,12 +414,6 @@ code = "invalid-type-cast"
message = "Casting `mixed` to `array`."
count = 1

[[issues]]
file = "src/Pdo/Connection.php"
code = "less-specific-argument"
message = "Argument type mismatch for argument #1 of `strtolower`: expected `string`, but provided type `array-key` is less specific."
count = 1

[[issues]]
file = "src/Pdo/Connection.php"
code = "mixed-argument"
Expand All @@ -415,9 +439,9 @@ message = "Assigning `mixed` type to a variable may lead to unexpected behavior.
count = 3

[[issues]]
file = "src/Pdo/Driver.php"
code = "incompatible-parameter-type"
message = 'Parameter `$resource` of `PhpDb\Mysql\Pdo\Driver::createresult()` expects type `PDOStatement` but parent `PhpDb\Adapter\Driver\DriverInterface::createresult()` expects type `resource`'
file = "src/Pdo/Connection.php"
code = "unhandled-thrown-type"
message = 'Potentially unhandled exception `PDOException` in `PhpDb\Mysql\Pdo\Connection::__construct`.'
count = 1

[[issues]]
Expand All @@ -426,6 +450,12 @@ code = "invalid-property-assignment-value"
message = 'Invalid type for property `$connection`: expected `(PhpDb\Adapter\Driver\PdoConnectionInterface&PhpDb\Adapter\Driver\AbstractConnection&PhpDb\Adapter\Driver\PdoDriverAwareInterface)|PDO`, but got `(PhpDb\Adapter\Driver\PdoConnectionInterface&PhpDb\Adapter\Driver\PdoDriverAwareInterface)|PDO`.'
count = 1

[[issues]]
file = "src/Pdo/Driver.php"
code = "unhandled-thrown-type"
message = 'Potentially unhandled exception `PhpDb\Adapter\Exception\RuntimeException` in `PhpDb\Mysql\Pdo\Driver::createResult`.'
count = 1

[[issues]]
file = "src/Result.php"
code = "missing-constructor"
Expand All @@ -439,15 +469,15 @@ message = "Property `$numberOfRows` is never used."
count = 1

[[issues]]
file = "src/Sql/SelectDecorator.php"
code = "write-only-property"
message = "Property `$subject` is written to but never read."
file = "src/Statement.php"
code = "mixed-assignment"
message = "Assigning `mixed` type to a variable may lead to unexpected behavior."
count = 1

[[issues]]
file = "src/Statement.php"
code = "mixed-assignment"
message = "Assigning `mixed` type to a variable may lead to unexpected behavior."
code = "unfulfilled-expect"
message = "This pragma was not used and may be removed."
count = 1

[[issues]]
Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@
"config-provider": "PhpDb\\Mysql\\ConfigProvider"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/php-db/phpdb"
}
],
"require": {
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
"php-db/phpdb": "^0.6.x-dev"
"php-db/phpdb": "dev-rfc/256-statement-factory as 0.6.x-dev"
},
"require-dev": {
"ext-mysqli": "*",
Expand Down
Loading
Loading