>
> The tricky part is that PHP is a highly dynamic language, so there's a lot
> of cases where the analysis can only return "maybe". My understanding is
> that this is what a lot of the work on Hack is doing: creating a language
> which looks a lot like PHP, but doesn't have as many ambiguous cases which
> can't be analysed statically.
>

Quite a lot of code that apparently cannot be statically analysed
could be if the static analyser was programmable. To give a simple
example:

$result = mysqli_query ($conn, 'select * from some_table');
$arr = mysqli_fetch_assoc ($result);

The contents of '$arr' cannot be known using only the data provided in
this code, however it's contents is statically knowable. If a static
analyser were programmable, it could parse the SQL query and query the
database to find out what keys exist in some_table. Thus it could
check for references to non-existing keys.

I suspect this is the case for a lot of 'non analysable code', it can
only function within a known set of states, but the type system is
unaware of those states.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to