slackhq / hack-sql-fake

A library for testing database driven code in Hack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AsyncMysqlQueryResult::mapRows() returns NULL as ""

lexidor opened this issue · comments

This line makes all the return values strings, even the NULL values. https://github.com/slackhq/hack-sql-fake/blob/master/src/AsyncMysql/AsyncMysqlQueryResult.php#L42
According to the documentation the return type should be Vector<Map<string, string>>, but that seems off. The HHI agrees with that too. However the documentation describes string|null.
https://docs.hhvm.com/hack/reference/class/AsyncMysqlQueryResult/mapRows/#examples

Are we sure the return type isn't secretly Map<string, ?string>?

You're right! It should be nullable, I am able to get null results back from mapRows().

I'd advise using mapRowsTyped() if possible but we should still fix this to match the real behavior despite the HHI

I'll open a bug report on the offending HHI.

The HHI may very soon match the runtime behavior. facebook/hhvm#8540

Thank you for fixing! #20