<depends>com.jetbrains.php</depends>
PHP PSIcom.jetbrains.php.lang.psi.elements.*;
PhpFilePathUtils
com.jetbrains.php.lang.psi.elements.impl.PhpFilePathUtils
contains helper methods for working with paths from PSI elements.
getFileName()
returns a constant string representation of the path from the PSI element.
For example, for the expression:
// in file: /bin/folder/file.php __DIR__ . "/file2.php";
it returns "/bin/folder/file2.php"
.
Note that the element passed as an argument can contain any expression that can be statically evaluated to a constant.
getReferences()
returns all path references from the PSI element.
Using this method in conjunction with PsiReferenceContributor you can add autocompletion for string literals in the specific contexts. For example, if certain PHP functions in your code accept paths, you can autocomplete them when writing arguments.
Note that PhpStorm automatically adds references for concatenation expressions with __DIR__
or dirname(__FILE__)
function call.
See PHP Extension Point and Listener List for the complete list.
06 February 2025
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4