Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

ConnectionInterface docblock is wrong or implementation is wrong.. #3469

Closed
cdekok opened this issue Jan 17, 2013 · 4 comments
Closed

ConnectionInterface docblock is wrong or implementation is wrong.. #3469

cdekok opened this issue Jan 17, 2013 · 4 comments
Assignees
Milestone

Comments

@cdekok
Copy link
Contributor

cdekok commented Jan 17, 2013

Interface..

    /**
     * Connect
     *
     * @return ConnectionInterface
     */
    public function connect();

Pgsql connection returns nothing..

    /**
     * Connect to the database
     *
     * @return void
     * @throws Exception\RuntimeException on failure
     */
    public function connect()
@Maks3w
Copy link
Member

Maks3w commented Jan 17, 2013

@ralphschindler ping

@weierophinney
Copy link
Member

While interfaces can indicate via the docblock what they expect an implementation to return, this is not binding. I would always check to see what the given implementation defines in its own docblock.

In looking through the various concrete implementations, some return the connection, some do not; in some cases, what is returned is based on what occurs within the internals of the implementation within logic branches.

Considering this would be defining a fluent interface at best, I'm not sure it's important. If you feel it is, please feel free to submit a pull request that makes the behavior consistent across the various implementations.

@weierophinney
Copy link
Member

Re-opening after discussion with @Maks3w

What should likely happen is one of the following:

  • Change the interface to indicate a "null" return value, and ensure all concrete interfaces enforce that, or
  • Change the concrete interfaces to always do a return $this, and to have the docblock indicate the concrete class returned.

@weierophinney weierophinney reopened this Jan 18, 2013
@Maks3w
Copy link
Member

Maks3w commented Jan 18, 2013

I suggest implement the fluent interface for preserve the backward compatibility.

@mech7 If you want send a contribution for fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants