llaville / php-compatinfo

Library that find out the minimum version and the extensions required for a piece of code to run
https://llaville.github.io/php-compatinfo/7.1/
Other
373 stars 20 forks source link

Cannot detect First-class Callable (anonymous functions) syntax #378

Closed llaville closed 4 hours ago

llaville commented 3 days ago

PHP 8.1 feature First-class Callable syntax could not be detected due to an error in AST parsing.

For example with source file :

<?php

function fromCallable(callable $callback): void
{
    $closure = $callback(...);
}

Analysis lead to such error :


 [ERROR] Cannot analyse data source "issue.php" for following reason(s)

 * Object of class PhpParser\Node\Expr\Variable could not be converted to string from file "phar:///phpcompatinfo-7.1.phar/src/Application/DataCollector/Normalizer/NodeNormalizer.php" at line 153

 ! [NOTE] Issue found by phpCompatInfo version 7.1.4@9875282 with DB version 6.5.0@542ea75
llaville commented 3 days ago

This issue is related to Anonymous functions syntax only. Other syntax forms are well detected !

llaville commented 2 days ago

Requires PHP CompatInfo DB 6.13.1 to work as expected !

llaville commented 4 hours ago

As PHP CompatInfo DB 6.13.1 is now available, this issue is considered as fixed !