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

added failling PdoStatementObjectType test #323

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

added failling PdoStatementObjectType test #323

wants to merge 1 commit into from

Conversation

staabm
Copy link
Owner

@staabm staabm commented Mar 3, 2022

refs #282 (comment)

this should also make phpstan-dba analysis possible across method boundaries.
atm all parts required for the inference need to be accessible from a single method.

I guess cases like

    public function querySelected(PDO $pdo): PDOStatement
    {
        return $pdo->query('SELECT email, adaid, gesperrt, freigabe1u1 FROM ada');
    }

    public function fetch(PDO $pdo):array {
       $stmt = $this->querySelected($pdo);
       return $stmt->fetch();
    }

    public function workWithData(PDO $pdo) {
       $data = $this->fetch($pdo);
       assertType('string', $data['email']);
    }

should work after we use the ObjectType properly

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

Successfully merging this pull request may close these issues.

None yet

2 participants