Skip to content

php-scoper doesn't know functions introduced in PHP 8.5 #1142

@takaram

Description

@takaram

Bug report

Question Answer
PHP-Scoper version 0.18.18
PHP version 8.5.1
Platform with version Ubuntu (WSL)
Github Repo -

Functions newly added in PHP 8.5, such as array_first and array_last, are not recognized as internal functions.
So they are prefixed unlike other internal functions.

Related to #1105

test.php
<?php

use function array_keys;
use function array_first;
use function array_last;

array_keys([]);
array_first([]);
array_last([]);
Result
<?php

namespace _PhpScopere94132a29af9;

use function array_keys;
use function _PhpScopere94132a29af9\array_first;
use function _PhpScopere94132a29af9\array_last;
array_keys([]);
array_first([]);
array_last([]);

work around

You can add this line to the require section of composer.json:
"jetbrains/phpstorm-stubs": "dev-master as v2024.x-dev"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions