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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
16 views

Intelephense / Livewire - Decorators are not valid here

I'm using the vscode intelephense extension, and writing some JS logic using laravel livewire. My objective is to send an event at a specific time to refresh some data. To achieve this, my logic is ...
Brian Hannay's user avatar
0 votes
1 answer
30 views

Vscode Intelephense doesn't recongnise any module in my codebase

I've opened vscode today and intelephense didn't recongnise any of my imports/modules. Laravel pint which I also have installed is erroring out exectuable not readable or lacks permissions pint. I am ...
Yusuf Bouzekri's user avatar
2 votes
2 answers
81 views

Handling '0 references' for php callbacks in visuel studiio code when

When editing wordpress code in Visual Studio Code, if I have a function definition and than I use it as a callback for a call to add_action or add_filter like this: function myCallback() { //do ...
epeleg's user avatar
  • 10.5k
0 votes
1 answer
83 views

How to fix code completion using DocBlock type hints with Intelephense?

I'm trying to get better completion with the VSCode extension Intelephense and some things aren't making sense. To start here is some example code: <?php declare(strict_types=1); // "square/...
JSP's user avatar
  • 557
0 votes
2 answers
68 views

Intelephense cannot find a certain class in App/Helpers

I have created a class in App\Helpers\IdTransformer theres just two functions there. I have registered it in aliases array in my app.php in config\app 'aliases' => Facade::defaultAliases()->...
Rex Zednelab's user avatar
0 votes
1 answer
272 views

Laravel 10 helper functions VS code intelephense issues

I recently updated my laravel project from 9.x to 10.x. Ever since the PHP intelephense extension in VS code is not able to find the global helper functions like view(), app(), resolve(), ... . They ...
SenneVP's user avatar
  • 35
0 votes
1 answer
30 views

Undefined property '$M_Auth'.intelephense(1014) on Codeigniter 4

I'm going to make login page, but it keep telling me Undefined property '$M_Auth' when I'm trying to define my model, it's work well in my last project, but now when I open the last project this ...
Arsya's user avatar
  • 7
1 vote
0 answers
54 views

PHP: Redis::subscribe hover has wrong information

Setup PHP 8.2 Redis 5.3.7 VSCode 1.79.0 Intelephense 1.9.5 Problem When using Redis::subscribe I get an error, because according to the hover subscribe only takes strings as parameters. But it ...
Percy Downing's user avatar
1 vote
0 answers
24 views

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 ...
DmnkVD's user avatar
  • 75
0 votes
0 answers
26 views

VSCODE Extension for PHP 5 [duplicate]

I am working on an old project which is based on PHP5. I am using PHP intelephense as the VsCode extesnion but it showing me error lines in all the mysql functions because of mysqli funtions. Can ...
Saurabh Bhardwaj's user avatar
0 votes
0 answers
44 views

How to identify incorrect use of sizeof in PHP 7.4+?

We have a project created in CodeIgniter that was started with PHP 5.6, then migrated to PHP 7.0 and now we are migrating to PHP 8. However, our code has several places that use the sizeof function to ...
Tom's user avatar
  • 707
2 votes
2 answers
620 views

Undefined method 'hasRole'.intelephense(1013)

if (auth()->check() && (auth()->user()->hasRole('Admin'))) { $people = Person::latest()->paginate(5); } else { $people = Person::where('user_id', $user->id)->latest()-...
Mario's user avatar
  • 21
0 votes
0 answers
131 views

why shouldReceive method not recognize in Laravel unit test?

I need to test unit my service in Laravel app. When i writing this code: <?php namespace Tests\Unit; use App\Http\Requests\LoginUserRequest; use App\Models\User; use App\Repositories\...
MISIU's user avatar
  • 19
1 vote
4 answers
396 views

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 ...
JacobTheDev's user avatar
  • 17.6k
0 votes
0 answers
48 views

Php formatter not working on remote files

I'm using macOS Ventura, with PHP Intelephense installed, option + shift + f on remote files says "There is no formatter for 'php' files installed." On local files, everything is fine. Why ...
Kerimcan Ayaz's user avatar
0 votes
1 answer
158 views

Expected type 'bool'. Found 'Illuminate\Auth\Access\Response'.intelephense(1006)

I am working on a Laravel 10 on Visual Studio Code with intelephense extension installed. I am getting error on my policy classes saying, "Expected type 'bool'. Found 'Illuminate\Auth\Access\...
Ayenew Yihune's user avatar
0 votes
1 answer
3k views

Laravel 9: Undefined type 'Illuminate\Support\Facades\Route'. Intelephense 1009

Can anyone help me? I'm still a beginner in Laravel. So, this error appeared when I just did a git clone project. After that I opened the project with vsCode and immediately got lots of errors. Error :...
Beginner Laravel's user avatar
1 vote
0 answers
278 views

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 ...
lluisma's user avatar
  • 101
0 votes
1 answer
315 views

Some PHP Function Flagged as Error in VSCode

I am a beginner and am developing a specific web system using PHP 8.2, Codeigniter 4 and XAMPP in VSCode. However, in my Controller, some PHP functions are marked as errors, such as password_verify(), ...
firewalker's user avatar
11 votes
1 answer
9k views

Intelephense (1014)

It bothers me because with the most recent update to PHP Intelephense that I received today, the intelephense keeps displaying an error for an unknown property, functions. Intelephense (1014) and this ...
James Matthew Luyon's user avatar
-2 votes
1 answer
321 views

PHP Undefined variable [duplicate]

When I test an easy PHP program , I found that there is a strange problem. The code is in fllow: <?php $a = "abc"; function Test() { global $a; $b .= $a."e"; return ...
gameplayer47's user avatar
1 vote
2 answers
3k views

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's user avatar
0 votes
0 answers
61 views

Why does Intelephense dislike my custom helper class?

I am trying to write some custom helper functions for my Laravel 9 app using the advice given in the second answer (written by heisian) to this question. I think I've imitated everything faithfully ...
Henry's user avatar
  • 1,431
2 votes
1 answer
4k views

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 ...
max256's user avatar
  • 45
0 votes
1 answer
2k views

intelephense undefined constant/ vscode

code completion doesn't work (vscode on mac) when php open/ closing tags are on one line. code completion works when three lines are used. please see screenshot. how could this be resolved? php code ...
user9374991's user avatar
0 votes
0 answers
46 views

Is there a settings option for a fully expanded settings menu in VS Code?

When I open this settings menu, and others of this type, there are always some menu items hidden and I have to scroll. Is there a setting option to have these kinds of menus fully expanded without the ...
Bryan's user avatar
  • 667
3 votes
0 answers
330 views

PHP Intelephense 'undefined method' issues

I recently switched to an IDE that supports PHP's Intelephense. There are two issues showing up that I don't know how to resolve (note, however, that the code executes correctly). #1. Undefined ...
Merricat's user avatar
  • 2,623
1 vote
1 answer
1k views

undefined method 'createtoken'.intelephense(1013) laravel 8 API

I have added use Laravel\Passport\HasApiTokens; and use HasApiTokens in user model. Still intelephense is unable to recognise it in vs code. Also in postman when i run it it showns me error "...
becky's user avatar
  • 17
1 vote
1 answer
562 views

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 ...
Daniel Alexander Sara Falcon's user avatar
0 votes
1 answer
774 views

VsCode composer psr-4 autoload of external libraries does not perform code completion

I have a self-made shared library that I am including in my Laravel project. This is how the autoload part in my composer.json looks like: "autoload": { "psr-4": { ...
M.Imran Mamda's user avatar
0 votes
1 answer
2k views

Expected type 'object'. Found 'void'.intelephense(1006)

Laravel v 9.11 Livewire v 2.5 vscode v 1.67.2 intelephense v 1.8.2 In laravel project i have a livewire component with a search function model Department: <?php namespace App\Models; use ...
John Deck's user avatar
  • 807
0 votes
0 answers
580 views

Intelephense bugs in VSCode

Intelepense in VScode tells me that — Undefined variable '$name'.intelephense(1008). Same with $age. And in the inherited class, there is an error with the parent:: construct - Cannot use 'parent' in ...
Arthur Galimullin's user avatar
1 vote
0 answers
1k views

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 ...
AGX301's user avatar
  • 11
3 votes
0 answers
475 views

Visual Studio Code PHP Intelephense not hilight probably unset variables

Visual Studio Code PHP Intelephense not hilight probably unset varuables. How enable hilight probably unset varuables? PhpStorm do it. Code: foreach ($paymentCollection as $payment) { ...
websek webseker's user avatar
0 votes
1 answer
2k views

PHP : VS code + >Intelephense detect an error on references passed in foreach (and in functions)

VS Code detect errors on my php code when I try to use a reference in a foreach. This should be possible refering to PHP doc : https://www.php.net/manual/en/control-structures.foreach.php $arr = array(...
Pierre Granger's user avatar
1 vote
0 answers
200 views

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: <?php declare(strict_types=1); namespace App\Services\Database; include_once('../...
michaelT's user avatar
  • 1,593
2 votes
0 answers
3k views

vscode + PHP intelephense named arguments from PHP 8.1 shown as errors

In code written in PHP8.1 I use named arguments in a method call: // function definition public function myFunction(string $name, string $description = "") // method call with errors ->...
jave.web's user avatar
  • 14.1k
2 votes
0 answers
529 views

VSCode PHP format indentation using Intelephense

I'm currently using php intelephense (free) extension to vscode in order to format php sources. I run in the following 'strange' behaviour, could someone explain why and how to correct it? The last &...
Christian's user avatar
  • 685
7 votes
2 answers
21k views

intelephense error on VS Code: Expected type 'string'. Found 'string[]'

Suppose the following piece of code: <?php declare (strict_types = 1); define('SOURCE_PATH', 'C:\xampp\htdocs\atlantis\ProductImages\\'); $dest = explode('\\', SOURCE_PATH); $dest[count($dest) - ...
Faye D.'s user avatar
  • 905
3 votes
2 answers
10k views

Laravel 8: undefined method 'createToken' intelephense(1013)

I have a problem with PHP intelephense, the method createToken is undefined. i don't know how to fix it. but when I run it in postman it works. i don't know why vscode doesnt recognize it. i also add ...
Paul Iverson Cortez's user avatar
1 vote
1 answer
895 views

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 ...
Mahmoud Magdy's user avatar
1 vote
1 answer
268 views

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 ...
Andrew's user avatar
  • 1,755
-7 votes
2 answers
55 views

Php installation errro on windows 10 pro

Hello guys I’ve been trying to install and use php extensions on my windows 10 but up to no avail I’ve tried installing the php intelephense but it’s still showing errors but help Am getting the ...
Travon's user avatar
  • 1
4 votes
3 answers
3k views

How to fix 'layout' method undefined in Laravel 8 with livewire

I am using vscode when i make a component .. it gives me an error undefined method at layout even if i replace it with extends the intelephense plugin gives me the same error i installed ide_helper ...
John Deck's user avatar
  • 807
0 votes
1 answer
1k views

Undefined method 'notify'. intelephense(1013)

I have this peace of code: auth()->user()->notify(new TestNotification($oneParam, $twoParam)); My auth()->user() return the user logged in like: App\Models\User\User {#1094 ▼ +timestamps: ...
francisco's user avatar
  • 1,529
6 votes
4 answers
25k views

How to change the version of php in PHP Intelephense?

I'm using iis and vscode to do php work. I recently updated iis from php7.3 to php7.4. My problem is that vscode is still using php7.3. I googled how to change the version in vscode and almost all ...
jsuke06's user avatar
  • 135
0 votes
1 answer
455 views

Getting error that actually not an error in vscode while using intelephense

Getting unexpected error (Expected 1 arguments. Found 0) in vscode while using intelephense extension. When I uninstall the intelephense extesion from vscode at that time this error not showing but i ...
devang_281999's user avatar
1 vote
1 answer
2k views

PHP Intelephense not showing 'Import' option

I just instlled PHP Intelephense extension in Visual Studio code. When I hover over a class and right click, it will not show import in the option.
user avatar
1 vote
0 answers
618 views

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 ...
Ben Coffin's user avatar
3 votes
1 answer
9k views

VSCode extension Intelephense gives error "Undefined method 'xxx'. Intelephense (1013)" with polymorphism and dynamic binding

I'm developing a PHP (v7.0.33) project using VScode (v1.56). I recently installed the VSCode's extension Intelephense (v1.7.1) and started to clean my code following Intelephense suggestions. A set of ...
Ma3x's user avatar
  • 516