Skip to content

Dead code and unreachable branches (coverage pass) #77

Description

@tyrsson

Context

Coverage-improvement pass on the improve-coverage branch (refs #57). Statement coverage raised to 91.1% (1081/1186). Remaining uncovered statements are unreachable or defensive; captured here rather than force-covered.

Data

Dead code (never executed):

  • PhpDb\Mysql\Metadata\Source::loadConstraintDataNames() — no caller; not declared in AbstractSource; 55 statements.
  • PhpDb\Mysql\Pdo\Driver::__construct() addFeatures() branch — Driver never implements DriverFeatureProviderInterface; the $features argument is silently ignored.
  • PhpDb\Mysql\Driver::checkEnvironment() throw branch — mysqli always loaded.
  • PhpDb\Mysql\Statement::prepare() InvalidQueryException branch — mysqli->prepare() throws mysqli_sql_exception (PHP 8.1+), never returns non-mysqli_stmt.
  • PhpDb\Mysql\Statement::execute() failure throw — unreachable for valid prepared statements.
  • PhpDb\Mysql\Result::next() position++ — dead; position already advanced inside valid()/current().
  • PhpDb\Mysql\Result::initialize() default => $this->isBuffered arm — no call path produces mysqli_stmt + 0 rows + null isBuffered.
  • PhpDb\Mysql\Metadata\Source self::DEFAULT_SCHEMA === $schema branches — defaultSchema resolves to the live database name, never the __DEFAULT_SCHEMA__ sentinel.

Defensive branches (need simulated failure to cover):

  • PhpDb\Mysql\Connection — connect-error, execute-failure, getCurrentSchema error, driver-null, rollback-not-connected.
  • PhpDb\Mysql\Pdo\Connection — connect-error, getCurrentSchema non-statement/false branches.
  • PhpDb\Mysql\Result::loadDataFromMysqliStatement()result_metadata() false / fetch() error branches.
  • Sql\Ddl decorators — getSqlInsertOffsets() REFERENCES/UNIQUE/PRIMARY branches (column SQL never contains those keywords), no-columns/no-platform throws.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions