Skip to content

Sublime Text 4: phpactor does not recognize standards PHP functions and classes #2813

Closed

Description

@srbetasign

Hello,

Happy new year !!!

First, thank you for this amazing Phpactor which has turned my Sublime Text into a real and impressive IDE !

But as described in the title, i have an issue on a Symfony 7 project, about standard functions like implode() or array_column()and standard classes like \RuntimeException or \DateTimeImmutable: they are marked as "not found".

I am using the latest version of Sublime Text 4 (Build 4189) and the latest version of Phpactor:

$ /path/to/phpactor.phar status
Version: 2024.11.28.1
Filesystems: git, simple, composer
Working directory: /home/zempa/www/c2b-api

Config files (missing is not bad):

  ✘ /home/dev/.config/phpactor/phpactor.json
  ✘ /home/dev/.config/phpactor/phpactor.yml
  ✔ /home/dev/www/sf7/.phpactor.json
  ✘ /home/dev/www/sf7/.phpactor.yml

Diagnostics:

  ✔ Composer detected - Phpactor could work faster without an index
  ✔ Git detected - enables faster refactorings in your repository scope!
  ✔ XDebug is disabled. XDebug has a negative effect on performance.

I have installed the LSP plugin for Sublime Text with the following settings:

{
    "clients": {
        "phpactor": {
            "enabled": true,
            "command": ["/path/to/phpactor.phar", "language-server"],
            "selector": "embedding.php",
            "priority_selector": "source.php",
            "languageId": "php",
            "scopes":
            [
                "source.php",
                "embedding.php"
            ],
        }
    }
}

And here is the .phpactor.json configuration file:

{
    "$schema": "/phpactor.schema.json",
    "language_server_phpstan.enabled": true,
    "language_server_php_cs_fixer.enabled": false,
    "behat.enabled": true,
    "behat.symfony.di_xml_path": "var/cache/test/App_KernelTestDebugContainer.xml",
    "symfony.enabled": true,
    "indexer.exclude_patterns": [
        "/vendor/**/Tests/**/*",
        "/vendor/**/tests/**/*",
        "/var/cache/**/*",
        "/vendor/composer/**/*"
    ]
}

But when, i run phpactor in command line on a PHP file with the "Not found" errors, no one is displayed:

$ /path/to/phpactor.phar worse:analyse src/Classes/MyPhpClass.php 
Analysing files...

    0 [->--------------------------]

0 problems in 0.0126 seconds with 21,682,448b memory

So i suppose there is something wrong in .phpactor.json or the settings of the LSP plugin.

But i cannot figure it out :/

So if you have any advice or solution, it would be nice.

Thank you.

Best Regards.

Sam

Activity

  1. dantleech commented on Jan 3, 2025

    @dantleech
    Collaborator

    It's been a very long time since I tested with Sublime Text, but you'd probably need to "open folder" to "tell the LSP" what the project root is. Otherwise you could figure out how to send the /phpactor/debug/config command to the the LSP server from Sublime to dump the resolved configuration and see what's going on or, easier, enable logging and see if you can see any hints there.

  2. srbetasign commented on Jan 3, 2025

    @srbetasign
    Author

    @dantleech thank you for your answer !

    I have tried to run the command "LSP: Troubleshoot server" and it appears it has found the project directory:

    image

    I am keeping on looking for a solution. I will post it there when if I find out.

  3. srbetasign commented on May 9, 2025

    @srbetasign
    Author

    After updating phpactor to the latest version 2025.04.17.0, my issues disappear : the standards functions are now recognized as expected !

    Here is my settings ($HOME/.config/sublime-text-3/Packages/User/LSP.sublime-settings):

    // Settings in here override those in "LSP/LSP.sublime-settings"
    {
        "log_debug": true,
        "clients": {
            "phpactor": {
                "enabled": true,
                "command": ["/path/to/phpactor", "language-server"],
                "selector": "embedding.php",
                "priority_selector": "source.php",
            }
        }
    }
    
  4. srbetasign commented on Nov 4, 2025

    @srbetasign
    Author

    Hello, the same issue still remained on one project.

    I tried to set the file .phpactor.json from another project where there were no problem.

    But finally, i find out : i have cleaned the cache via phpactor index:clean.

    Once the index rebuild, this issue disappears !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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