* Add completions for functions
Provide autocompletions in the LSP for all global functions and functions from namespaces used in the current context.
* Uncomment code
* PHPCS
* Simplify functions map
Co-authored-by: Matthew Brown <github@muglug.com>
* Switch to storing lowercase function string in array key
* Fix spacing
Co-authored-by: Matthew Brown <github@muglug.com>
* Track references on global variables
Add global type references to the type map, and fix up unused detection on global variables.
* Add null assertions
* PHPCS
* Add constant fetch to reference map
To support showing constant types on hover of constant references, we need to add them to the ref map.
* Fix root constants
* PHPCBF
* Add completions for known array keys
* Use dynamic gap value
* Provide completions for known type contexts
* Fix formatting
* Remove trailing comma
* PHPCS fixes
* Remove support for literal floats
* Fix test for floats
* Support compleitions on class references
This provides completions on class references (as opposed to initiated objects via the type map), so you can do `MyClass::` and get completitions for static methods and constants etc.
* Only provide completions for references that don't exist
* Support global functions in getSymbolInformation and getSymbolLocation
Currently codebase-wide defined function are not found in `Codebase::getSymbolLocation` or `Codebase::getSymbolInformation`. This means hovers via the LSP on functions not in the current file, or "go to definition" do not work for non-locally defined functions.
It looks to me that this might have been an oversight, as methods do support this.
For stubbed functions, "go to definition" will open the stub file, which is also quite hadny.
* No need to catch expections, they are already in a try block.
* Add empty checks returning null
Co-authored-by: Matthew Brown <github@muglug.com>
cc @ragboyjr – this makes Psalm unstable, as method return types cannot change midway through analysis (as it means results would be dependent on file analysis order)
- Added detection for when we can infer
closure types from parent fn return types
- Implemented functionality for infering types of
returned closures
- Added ability to infer type of return from typed
closures
- Added a new getFunctionLikeStorage method in
Codebase to support easily getting a function
despite being a method, closure, or function
- Added some utilities to the MethodIdentifier
to facilitate creating MethodIdentifier's from
string method references
Closes#2896
Signed-off-by: RJ Garcia <rj@bighead.net>