Remember what "type" a name in a PHP scope is.

Previously, PHP's ability to dynamically fiddle with scopes meant that we could
get odd results (and unfortunate performance) when looking up a name from
Python. This patch makes things more deterministic.

The idea is that the first time a name is looked up in a PHP scope, the
"internal type" of the name is then fixed. If, for example, 'n' returns a
function the first time it is looked up, then in all subsequent lookups we
guarantee that a function will be returned.