Skip to content

Adapter::getDriver has wrong return type #45

Description

@InvisibleSmiley

Package Version

2.22.0

Php Version

8.3

Database Engine

None

Basic Information

Commit 631f035 changed the return type of Adapter::getDriver to DriverInterface|array. This is wrong because while this is the correct type for the constructor parameter, the property and therefore also the getter is just DriverInterface.

This change became part of the 2.22.0 pre-release which I required in my project which uses PHPStan. This then reported the following error:

Cannot call method getConnection() on array|Laminas\Db\Adapter\Driver\DriverInterface

Steps to Reproduce

  1. Set up a project with this package as a dependency
  2. Set up static type analysis like PHPStan or Psalm
  3. Add code that calls getConnection on Adapter::getDriver

Expected Behavior

No errors

Actual behavior?

Errors from static analysers

Additional Info

No response

Metadata

Metadata

Labels

confirmedHas been confirmed by maintainers

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions