Vscode-intelephense: Symbol '$variable' is declared but not used.intelephense(10010)

Created on 2 Mar 2019  路  6Comments  路  Source: bmewburn/vscode-intelephense

Trouble

<?php
$variable = end($array);
$variable++;

image

resolved in 1.0.5

Most helpful comment

I have the same issue when trying to update global variables within function.
Here is sample snippet to reproduce problem:

<?php
function test() {

    global $scripts, $styles;

    $scripts = new Scripts();
    $styles = new Styles();

}

And result:
2019-03-02 11 56 07

--
vscode 1.31.1
os x 10.11.6
intelephense 1.0.4

All 6 comments

I have the same issue when trying to update global variables within function.
Here is sample snippet to reproduce problem:

<?php
function test() {

    global $scripts, $styles;

    $scripts = new Scripts();
    $styles = new Styles();

}

And result:
2019-03-02 11 56 07

--
vscode 1.31.1
os x 10.11.6
intelephense 1.0.4

@xiaohuilam should $last be considered used though? In the example it's just a variable that gets declared then incremented.

@xiaohuilam should $last be considered used though? In the example it's just a variable that gets declared then incremented.

$last ++;

means

$last = $last + 1;

Right, I see it fails in cases like this.

function fn() {
    $i = 0;
    return ++$i;
}

Similar problem with array.

<?php
function test() {

    $array = array();
    $array['one'] = 1;
    $array['two'] = 2;

}

袟薪褨屑芯泻 械泻褉邪薪邪 2019-03-19 芯 12 58 01

image
I think im having a similair problem? im not a very good PHP coder. but this shouldnt say its unused in my opinion?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vanasis picture vanasis  路  4Comments

nn-hh picture nn-hh  路  3Comments

dgunay picture dgunay  路  3Comments

mushmelty picture mushmelty  路  4Comments

superadmini picture superadmini  路  4Comments