Skip to content

PHPantom reports a valid namespaced function as undefined #318

Description

@yankewei

Verified on latest main

  • I have confirmed this bug still occurs when built from the latest main branch.

PHPantom version / commit

phpantom_lsp 815a400

Installation method

Pre-built binary from GitHub Releases

Operating system

macOS aarch64 (Apple Silicon)

Editor

Zed

Bug description

PHPantom reports a valid namespaced function as undefined, although the function is provided by an installed Composer dependency and works correctly at runtime.

Steps to reproduce

Minimal reproduction

composer.json:

{
    "require": {
        "thecodingmachine/safe": "^3.4"
    }
}

src/main.php:

<?php

require_once __DIR__ . '/../vendor/autoload.php';

$encoded = base64_encode('Hello');
$decoded = \Safe\base64_decode($encoded);

After running composer install:

  • PHP executes the code successfully.
  • PHPantom reports Function 'Safe\base64_decode' not found.

Error output or panic trace


.phpantom.toml

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions