Questions tagged [intelephense]

This tag should be used to discuss the PHP static code analysis and language tools provided by the Intelephense vscode plugin, including questions related to improving its effectiveness or correcting issues related to its installation, configuration, or potential bugs and shortcomings.

Intelephense is a high performance PHP language server packed full of essential features for productive PHP development. It provides PHP code intelligence for the Visual Studio Code editor.

78 questions
1
vote
0 answers

How to keep PHP opening tags left-aligned in VScode code formatting?

I'm trying to setup a VSCode formatting rule which would keep all opening PHP tags on the leftmost side of the editor (no tabs), while formatting the rest of the code accordingly... I am currently using Intelephense to format the code. Before: …
DmnkVD
  • 75
  • 7
1
vote
4 answers

How can I document types in a multidimensional array to fix type hinting?

I have some template files that have default arguments defined at the top of each file. I can't get type hinting for these values to work correctly; it just says there is no reference. I am including the WordPress core files in Intelephense, so it…
JacobTheDev
  • 17,318
  • 25
  • 95
  • 158
1
vote
0 answers

Visual Studio Code PHP Intelephense does not show error when a class has not been imported

I'm doing my first tests in sonarqube with one of my repositories (in Laravel) and it caught an error about an undefined Exception class: Create class "Exception" in namespace or check correct import of class Which is correct. I use Intelephense in…
lluisma
  • 101
  • 1
  • 6
1
vote
1 answer

Undefined type 'Validator'.intelephense(1009)

Can anyone help me with this error? Im new to laravel and i was making a productController file but im getting this error from Validator: I have called use Validator; What else can i do
Lirik Rexhepi
  • 67
  • 1
  • 7
1
vote
1 answer

VS Code intelephense shows incorrect error: Undefined method 'save'

I'm using the intelephense v1.8.2 extension in VS Code and I'm working on a laravel project. As I get the user using Auth::user(); and call $user->save(); the intelephonse keep showing incorrect error Undefined method 'save'. Is there a way to fix…
max256
  • 35
  • 3
  • 8
1
vote
1 answer

intelephense keeps prefixing mi functions with "global" in vscode php

Every time i use the autocomplete with intelephense for my functions, they are prefixed with "global" and its annoying to changed it every time. For example i declared this function in mi file: function countDigit($n) { $count = 0; while ($n !=…
1
vote
0 answers

Expected type 'object'. Found 'string|false'.intelephense(1006) on json_encode()

Please find my code sample below where I take the POST input data and convert into JSON after which I check if the data has the required info or not. I'm using Visual Studio with PHP Intelephense. It provides the error mentioned "Expected type…
AGX301
  • 11
  • 3
1
vote
0 answers

VSC / PHP Intelephense does not know postgres typings

I am working on a PHP class that provides functions for my postgres database. My class Database looks like this:
michaelT
  • 1,533
  • 12
  • 41
1
vote
1 answer

how check entire folder against problems in vscode php?

I am using PHP Intelephense I want to check the entire project for problems but it seems to run only on opened files. I tried to open multiple files using other plugins but it is not efficient to do so as I have to go through each folder one by…
1
vote
1 answer

Do I need to Declare a Variable to be used in a bind_result() Statement?

When writing prepared statement and binding the results using a bind_result() statement (referenced here), considering the example below, do I need to declare $a, $b or $c before it's bound in the statement? $a = ""; //does this declaration need to…
Andrew
  • 1,745
  • 1
  • 21
  • 29
1
vote
0 answers

VS Code w/ PHP > Go to Declaration

config.php class one { function __construct(){ echo "hello from class one."; } } require_once("class.php"); $two = new two(); class.php class two { function sayHello(){ echo "hello from class two"; …
Ben Coffin
  • 483
  • 4
  • 13
1
vote
1 answer

VS Code PHP Intelephense objects in array not showing properties and functions to -> operator

I am new to VS Code, so I don't know what's happening here. I have a fresh Intelephense installation, and have disabled basic PHP suggestions, but when I type out an array, in which are objects, after I type the -> operator, the object properties…
Shadow0013
  • 61
  • 7
1
vote
1 answer

Why is intelephense not recognizing mysql_pconnect when aimed at php v5.3?

I am working on an older codebase. When I set intelephense with the following in .vscode/settings.json: { "intelephense.environment.phpVersion": "5.3", "[php]": { "editor.defaultFormatter": "bmewburn.vscode-intelephense-client" } } ...…
Magnus
  • 3,086
  • 2
  • 29
  • 51
1
vote
0 answers

VS Code Intelephense wrong path completion in html

I'm using Intelephense for code completion in VS Code. Works pretty good. But path completion isn't working correct. When I try to get the path to a picture it shows me the wrong picture selection. Like this: But it…
wolf
  • 11
  • 2
1
vote
0 answers

Annoying intelisense warning in VS Code for Laravel's built in commands

The image above is self explanatory, I always get Undefined method [every built in laravel method] every time I create a Laravel project. I'm using PHP Intelephense extension to help me with autocompletion and stuffs. This kind of annoying since…
Yura
  • 1,937
  • 2
  • 19
  • 47