-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
phan/phan
#4930Description
I was using the following test file:
<?php
function doSomethingNice(
int $param
): void {
return;
}That was checked using the following code
<?php
$contents = \file_get_contents('test.php');
$ast = \ast\parse_code($contents, 90);
$parmLineDeclarion = $ast->children[0]->children['params']->children[0]->lineno;
echo 'PHP version: ' . phpversion() . ' php-ast version: ' . (new \ReflectionExtension('ast'))->getVersion() . PHP_EOL;
echo 'Param declared on line #' . $parmLineDeclarion . PHP_EOL;And different results were produced for PHP 8.2 vs PHP 8.4. Seems like PHP 8.4 wrongly returns 4 instead of 3:
PHP version: 8.2.18 php-ast version: 1.1.0
Param declared on line #3
PHP version: 8.4.7 php-ast version: 1.1.2
Param declared on line #4
Once test file is changed so function declaration ends on the same line where the $params is defined, the same result is returned in both cases:
<?php
function doSomethingNice(
int $param): void {
return;
}=>
PHP version: 8.2.18 php-ast version: 1.1.0
Param declared on line #3
and
PHP version: 8.4.7 php-ast version: 1.1.2
Param declared on line #3
Metadata
Metadata
Assignees
Labels
No labels