Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrutinizer and data types #125

Closed
pavarnos opened this issue Jan 26, 2017 · 7 comments
Closed

Scrutinizer and data types #125

pavarnos opened this issue Jan 26, 2017 · 7 comments

Comments

@pavarnos
Copy link
Contributor

pavarnos commented Jan 26, 2017

So i've been fiddling with Scrutinizer a bit. Got an interesting message I don't know how to resolve.

scrutinizer

where $this->database is an instance of

class Database {
    /**
     * @return QueryFactory
     */
    protected function getQueryFactory()
    {
        if (empty($this->queryFactory)) {
            $this->queryFactory = new QueryFactory($this->isSqlite() ? 'sqlite' : 'mysql');
        }
        return $this->queryFactory;
    }

    /**
     * @return UpdateInterface
     */
    public function update()
    {
        return $this->getQueryFactory()->newUpdate();
    }

Seems like Scrutinizer is looking through the @return type declaration of Auras newUpdate() to the @return type declaration of newInstance('Update').

Is this a scrutiniser problem or something Aura can fix by changing type declarations?

@harikt
Copy link
Member

harikt commented Feb 9, 2017

Hey @pavarnos ,

You have already found the problem.

* @return AbstractQuery

The QueryFactory is having @return AbstractQuery , but it can be an instance of Insert, Update, Delete or Select interfaces. So the return type declared is wrong. I guess if we fix the return type, it will work as expected.

@pavarnos
Copy link
Contributor Author

pavarnos commented Feb 9, 2017

OK. What should the return type be?

@harikt
Copy link
Member

harikt commented Feb 9, 2017

@pavarnos I am not sure whether we can write something like this.

@return Common\SelectInterface|Common\InsertInterface|Common\UpdateInterface|Common\DeleteInterface

There is multiple return type in this case, ie why. . This will work, I have tested with phpdocumentator and apigen .

@harikt
Copy link
Member

harikt commented Feb 9, 2017

@pavarnos if you have time, do send a PR. Else I will look sending one.

Thank you.

@pmjones
Copy link
Member

pmjones commented Mar 22, 2017

@harikt @pavarnos Any PRs as a result of this issue?

@pavarnos
Copy link
Contributor Author

pavarnos commented Mar 22, 2017 via email

@harikt
Copy link
Member

harikt commented Mar 22, 2017

PR : #135

pmjones pushed a commit that referenced this issue Mar 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants