The Latest Peachpie Analytics

We have been working on additional diagnostics and analytics tools in Peachpie, which you can use in our Visual Studio Code extension now. This article describes the latest features.


In case you don’t know, Peachpie is the modern PHP compiler to .NET and .NET Core. It is a complete re-implementation of the PHP language based on the Microsoft Roslyn compiler platform, allowing PHP to run on the .NET runtime.

New diagnostics

Our free Visual Studio Code extension allows you to work with Peachpie in an intuitive and efficient manner. It enables you to quickly create a new Peachpie project and provides syntax error underlining and various tooltips when hovering over a variable, class, interface, constant, function parameter, magic constant or function:


The tooltips and underlining are features of the sophisticated Peachpie diagnostics and analytics tools and provide you with invaluable information on your project that are otherwise not available.

News in type analysis

  • Functions newly reflected in type analysis: is_int, is_float (and aliases: is_integer, is_long, is_double, is_real), is_bool, is_string, is_resource, is_null, is_array, is_object, is_numeric, is_callable
  • Also isset() now behaves as !is_null() if the variable is certain to be initialized (assigned into)
  • Operators: logical negation, equality with null (==, ===, !=, !==)
  • These checks are attempted to be computed during the compilation time => if successful, the condition is marked to return a constant value => this can then be used to report unreachable code.

Unreachable code analysis

There are two reasons for code unreachability:

  • Structure of the code (such as a command right after a return statement)
  • Conditions computed during compile time (as mentioned before) – e.g. is_int($x) is always true if we know that $x can only be an integer

Type analysis tests

Our new type analysis tests can serve to better understand what the aforementioned analysis are capable of. The tests can be found in the Peachpie repository under the folder /src/Tests/Peachpie.DiagnosticTests/tests. Further changes are that type_analysis_*.php is aimed mainly at the type analysis and 3012_unreachable_code_*.php primarily targets unreachable code. Furthermore, we are testing other diagnostics, e.g. XXXX_diagnostic_name_*.php, where XXXX is its code.

As mentioned in an earlier blog, we are working on some bigger tasks in parallel, such as new frameworks to run on Peachpie or mobile applications. Stay tuned for more updates on the project!

Posted on June 13, 2017, in category News, tags: , , , , , ,