Azakur4 / autocomplete-php

Autocomplete provider for PHP - Atom
MIT License
22 stars 13 forks source link

userFunc.test === null #32

Closed UziTech closed 1 year ago

UziTech commented 8 years ago

Found a weird bug.

When two classes are defined in the same file and the second one's constructor has no parameters the @userSuggestions.user_functions[1].text === null which causes an error at povider.coffee#L167

<?php

class test1 {
    public function __construct() {
    }
}

class test2 {
    public function __construct() {
    }
}

@userSuggestions.user_functions is

[
  {
    "text": "__construct",
    "type": "function",
    "snippet": "__construct()${99}"
  },
  {
    "text": null,
    "type": "function",
    "snippet": "()${99}"
  }
]

I fixed it by changing userFunc.text.toLowerCase().indexOf(lowerCasePrefix) to userFunc.text?.toLowerCase().indexOf(lowerCasePrefix) but there is probably some underlying bug that should be fixed.

UziTech commented 8 years ago

also getting Undefined offset: 0 in php error logs from get_user_all.php#L83

UziTech commented 8 years ago

Looks like it is because technically there are 2 functions with the same name which should usually be an error but in this case is valid PHP