Documentation
¶
Index ¶
- Constants
- func AssistantArgumentReference(ctx context.Context, node *phpsyntax.Node, tag string) (cst.TextRange, bool)
- func AssistantArgumentTags(ctx context.Context, node *phpsyntax.Node, tags ...string) (cst.TextRange, []string)
- func AssistantSiblingStringArgument(ctx context.Context, node *phpsyntax.Node, tag string) (string, bool)
- func DebugAST(filePath string)
- func GuessedControllerTemplate(root, method *phpsyntax.Node) string
- func ReferenceAt(document *semantic.Document, offset uint32) (semantic.Reference, bool)
- func SymbolAt(document *semantic.Document, snapshot *semantic.Snapshot, offset uint32) (semantic.Symbol, bool)
- type EmbeddedCSSSelector
- type EmbeddedJSONLiteral
- type EmbeddedLanguage
- type EmbeddedLanguageString
- type EmbeddedPHPString
- type EmbeddedXPathExpression
- type NameResolver
- type PHPContext
- type PHPIndex
- func (p *PHPIndex) AddAnalyzedDocumentContext(ctx context.Context, node *phpsyntax.Node, document *semantic.Document) context.Context
- func (p *PHPIndex) AddAnalyzedSnapshotContext(ctx context.Context, node *phpsyntax.Node, document *semantic.Document, ...) context.Context
- func (p *PHPIndex) AddContext(ctx context.Context, node *phpsyntax.Node, documentContent []byte) context.Context
- func (p *PHPIndex) AddDocumentContext(ctx context.Context, path string, version int, node *phpsyntax.Node, ...) context.Context
- func (p *PHPIndex) AddParsedFileContext(ctx context.Context, file *indexer.ParsedFile, node *phpsyntax.Node) context.Context
- func (idx *PHPIndex) AnalyzeDocument(path string, version int, root *phpsyntax.Node) *semantic.Document
- func (idx *PHPIndex) AnalyzeParsedFile(file *indexer.ParsedFile) *semantic.Document
- func (idx *PHPIndex) BeginIndexingBatch(candidateFiles []string)
- func (idx *PHPIndex) ClassNames() []string
- func (idx *PHPIndex) ClassNamesView() []string
- func (idx *PHPIndex) ClassSymbols() []semantic.Symbol
- func (idx *PHPIndex) ClassSymbolsIn(path string) []semantic.Symbol
- func (idx *PHPIndex) ClassSymbolsView() []semantic.Symbol
- func (idx *PHPIndex) Clear() error
- func (idx *PHPIndex) ClearIn(mutation *indexer.Mutation) error
- func (idx *PHPIndex) Close() error
- func (idx *PHPIndex) ConfigureProject(root string) error
- func (idx *PHPIndex) ConfigureProjectWithExtensions(root string, enabled, disabled []string) error
- func (idx *PHPIndex) ConstantSymbolName(symbol semantic.Symbol) string
- func (idx *PHPIndex) ConstantSymbols() []semantic.Symbol
- func (idx *PHPIndex) Constants(className string) []semantic.Symbol
- func (idx *PHPIndex) EndIndexingBatch() error
- func (idx *PHPIndex) FindClass(name string) (semantic.Symbol, bool)
- func (idx *PHPIndex) FindConstants(className, constantName string) []semantic.Symbol
- func (idx *PHPIndex) FindGlobalConstants(name string) []semantic.Symbol
- func (idx *PHPIndex) FindMethods(className, methodName string) []semantic.Symbol
- func (idx *PHPIndex) FindProperties(className, propertyName string) []semantic.Symbol
- func (idx *PHPIndex) ID() string
- func (idx *PHPIndex) Index(file *indexer.ParsedFile) error
- func (idx *PHPIndex) IndexPrepared(file *indexer.ParsedFile, value any) error
- func (s *PHPIndex) IsMethodCalledName(ctx context.Context, node *phpsyntax.Node, content []byte, ...) bool
- func (s *PHPIndex) IsMethodCalledOnClass(ctx context.Context, node *phpsyntax.Node, content []byte, className string) bool
- func (idx *PHPIndex) IsSubtypeOf(className, targetName string) (bool, error)
- func (idx *PHPIndex) Methods(className string) []semantic.Symbol
- func (idx *PHPIndex) Prepare(file *indexer.ParsedFile) (any, error)
- func (idx *PHPIndex) Project() *project.Model
- func (idx *PHPIndex) Properties(className string) []semantic.Symbol
- func (idx *PHPIndex) RegisterTypeExtension(extension inference.Extension)
- func (idx *PHPIndex) RemovedFiles(paths []string) error
- func (idx *PHPIndex) RemovedFilesIn(paths []string, mutation *indexer.Mutation) error
- func (idx *PHPIndex) Revision() uint64
- func (idx *PHPIndex) SemanticDocument(path string) (*semantic.Document, bool)
- func (idx *PHPIndex) SemanticSnapshot() *semantic.Snapshot
- func (idx *PHPIndex) ShouldEnterDirectory(path string) bool
- func (idx *PHPIndex) ShouldIndexPath(path string) bool
- func (idx *PHPIndex) ShouldPreparsePath(path string) bool
- func (idx *PHPIndex) TwigTemplateVariableSources(name string, templateNames ...string) ([]TwigTemplateVariable, error)
- func (idx *PHPIndex) TwigTemplateVariables(templateNames ...string) ([]TwigTemplateVariable, error)
- func (idx *PHPIndex) WorkspaceSymbols(file *indexer.ParsedFile, value any) ([]indexer.WorkspaceSymbol, error)
- type TwigTemplateContext
- type TwigTemplateVariable
Constants ¶
const PHPContextKey phpContextKey = "php.context"
PHPContextKey is the key used to store PHP context in the context.Context
Variables ¶
This section is empty.
Functions ¶
func AssistantArgumentReference ¶
func AssistantArgumentReference( ctx context.Context, node *phpsyntax.Node, tag string, ) (cst.TextRange, bool)
AssistantArgumentReference recognizes a direct string argument whose resolved function, constructor, or method parameter carries the requested PHPDoc assistant tag, such as #Route or #Service. Parameter tags declared on inherited interfaces, parents, and traits are included.
func AssistantArgumentTags ¶
func AssistantArgumentTags( ctx context.Context, node *phpsyntax.Node, tags ...string, ) (cst.TextRange, []string)
AssistantArgumentTags recognizes a direct string call argument and returns the requested assistant tags carried by its resolved parameter. Resolution includes function, constructor, method, named/variadic argument, and inherited parameter contracts.
func AssistantSiblingStringArgument ¶
func AssistantSiblingStringArgument( ctx context.Context, node *phpsyntax.Node, tag string, ) (string, bool)
AssistantSiblingStringArgument returns the direct string value passed to a parameter carrying tag on the same resolved call. It is used by contracts such as #TranslationKey, whose key domain is supplied by a sibling #TranslationDomain parameter.
func DebugAST ¶
func DebugAST(filePath string)
DebugAST parses a PHP file and prints the pure-Go CST structure.
func GuessedControllerTemplate ¶
GuessedControllerTemplate returns Symfony's conventional template name for a controller method with an empty #[Template] attribute.
func ReferenceAt ¶
Types ¶
type EmbeddedCSSSelector ¶
type EmbeddedCSSSelector = EmbeddedPHPString
EmbeddedCSSSelector names a decoded static PHP string recognized as a CSS selector by a typed Symfony DomCrawler or CssSelector call.
func EmbeddedCSSSelectors ¶
func EmbeddedCSSSelectors( index *PHPIndex, path string, version int, source string, root *cst.Node, ) []EmbeddedCSSSelector
EmbeddedCSSSelectors recognizes the CSS selector signatures injected by the reference plugin: Crawler::filter(), Crawler::children(), and CssSelectorConverter::toXPath().
type EmbeddedJSONLiteral ¶
type EmbeddedJSONLiteral = EmbeddedPHPString
EmbeddedJSONLiteral names an EmbeddedPHPString recognized in a Symfony JsonResponse JSON entry point.
func EmbeddedJSONLiterals ¶
func EmbeddedJSONLiterals( index *PHPIndex, path string, version int, source string, root *cst.Node, ) []EmbeddedJSONLiteral
EmbeddedJSONLiterals returns direct, static string arguments of JsonResponse::fromJsonString() and JsonResponse::setJson(). Receiver types are resolved semantically, so aliases and subclasses are supported while unrelated methods with the same name are ignored.
type EmbeddedLanguage ¶
type EmbeddedLanguage uint8
const ( EmbeddedLanguageJSON EmbeddedLanguage = iota + 1 EmbeddedLanguageCSS EmbeddedLanguageXPath )
type EmbeddedLanguageString ¶
type EmbeddedLanguageString struct {
EmbeddedPHPString
Language EmbeddedLanguage
}
func EmbeddedLanguageStrings ¶
func EmbeddedLanguageStrings( index *PHPIndex, path string, version int, source string, root *cst.Node, ) []EmbeddedLanguageString
EmbeddedLanguageStrings recognizes all static PHP argument signatures used by the reference plugin's JSON, CSS selector, and XPath injections. It scans the CST and performs semantic receiver analysis once per document.
type EmbeddedPHPString ¶
EmbeddedPHPString is a decoded, static PHP string. SourceOffsets maps each decoded byte boundary back to the corresponding absolute byte offset in the PHP document, so embedded parser ranges remain exact through PHP escapes.
func (EmbeddedPHPString) SourceRange ¶
func (literal EmbeddedPHPString) SourceRange( embedded cst.TextRange, ) cst.TextRange
SourceRange maps a byte range in Value back into the host PHP document.
type EmbeddedXPathExpression ¶
type EmbeddedXPathExpression = EmbeddedPHPString
EmbeddedXPathExpression names a decoded static PHP string recognized as an XPath expression by a typed Symfony DomCrawler call.
func EmbeddedXPathExpressions ¶
func EmbeddedXPathExpressions( index *PHPIndex, path string, version int, source string, root *cst.Node, ) []EmbeddedXPathExpression
EmbeddedXPathExpressions recognizes the reference plugin's Crawler filterXPath() and evaluate() injection signatures.
type NameResolver ¶
type NameResolver struct {
// contains filtered or unexported fields
}
NameResolver is the compatibility-free project-facing wrapper around the semantic PHP name resolver. Symfony configuration indexing uses it without depending on binder internals.
func NameResolverFor ¶
func NameResolverFor(ctx context.Context, root *phpsyntax.Node) *NameResolver
NameResolverFor returns the import resolver for root, sharing one resolver through the request's PHP context when the same tree is queried repeatedly. Reference lookups inspect many literals of one document; building a fresh resolver per literal re-walks the whole syntax tree each time.
func NewNameResolver ¶
func NewNameResolver(root *phpsyntax.Node) *NameResolver
func (*NameResolver) Namespace ¶
func (r *NameResolver) Namespace() string
func (*NameResolver) Resolve ¶
func (r *NameResolver) Resolve(name string) string
type PHPContext ¶
type PHPContext struct {
InsideClass *semantic.Symbol
Node *phpsyntax.Node
Document *semantic.Document
Snapshot *semantic.Snapshot
// contains filtered or unexported fields
}
func GetPHPContext ¶
func GetPHPContext(ctx context.Context) *PHPContext
type PHPIndex ¶
type PHPIndex struct {
// contains filtered or unexported fields
}
PHPIndex owns the persisted compact workspace graphs and publishes immutable workspace snapshots. A document update becomes visible only after the shared index transaction commits.
func (*PHPIndex) AddAnalyzedDocumentContext ¶
func (p *PHPIndex) AddAnalyzedDocumentContext( ctx context.Context, node *phpsyntax.Node, document *semantic.Document, ) context.Context
AddAnalyzedDocumentContext enriches a context with an existing linked document. Request-time LSP features use it to share one semantic analysis instead of rebuilding the same open document for assistant-tag queries.
func (*PHPIndex) AddAnalyzedSnapshotContext ¶
func (p *PHPIndex) AddAnalyzedSnapshotContext( ctx context.Context, node *phpsyntax.Node, document *semantic.Document, snapshot *semantic.Snapshot, ) context.Context
AddAnalyzedSnapshotContext enriches a request with a semantic document and its already-constructed overlay snapshot. LSP requests use this boundary to share one revision-aware analysis instead of rebuilding the open document and its overlay for every provider fan-out.
func (*PHPIndex) AddContext ¶
func (*PHPIndex) AddDocumentContext ¶
func (*PHPIndex) AddParsedFileContext ¶
func (p *PHPIndex) AddParsedFileContext( ctx context.Context, file *indexer.ParsedFile, node *phpsyntax.Node, ) context.Context
AddParsedFileContext enriches a context with the semantic document shared by indexers preparing one immutable file.
func (*PHPIndex) AnalyzeDocument ¶
func (idx *PHPIndex) AnalyzeDocument( path string, version int, root *phpsyntax.Node, ) *semantic.Document
AnalyzeDocument creates an unsaved-document overlay and links it against a workspace generation containing the overlay's declarations.
func (*PHPIndex) AnalyzeParsedFile ¶
func (idx *PHPIndex) AnalyzeParsedFile( file *indexer.ParsedFile, ) *semantic.Document
AnalyzeParsedFile returns the fully linked semantic document shared by indexers preparing the same immutable file. FileScanner releases the cached value before persistence begins, so semantic documents do not become long-lived index state.
func (*PHPIndex) BeginIndexingBatch ¶
BeginIndexingBatch defers immutable workspace publication until all file transactions in the scanner run have either committed or rolled back.
func (*PHPIndex) ClassNames ¶
func (*PHPIndex) ClassNamesView ¶
ClassNamesView is the immutable counterpart of ClassNames for request paths that only read the workspace class-name catalog.
func (*PHPIndex) ClassSymbols ¶
ClassSymbols returns all source class-like declarations in deterministic name/path order. Internal runtime stub classes are omitted.
func (*PHPIndex) ClassSymbolsIn ¶
func (*PHPIndex) ClassSymbolsView ¶
ClassSymbolsView returns an immutable generation-scoped view of source class-like declarations. Callers must not modify the slice or its symbols. Repeated diagnostics can share this view without rematerializing the entire PHP workspace catalog for every document.
func (*PHPIndex) ConfigureProject ¶
ConfigureProject loads Composer roots/version information and publishes the matching runtime stub document.
func (*PHPIndex) ConfigureProjectWithExtensions ¶
func (*PHPIndex) ConstantSymbolName ¶
ConstantSymbolName renders a global or class constant as it appears in Symfony configuration.
func (*PHPIndex) ConstantSymbols ¶
ConstantSymbols returns all constant declarations in deterministic display-name/path order.
func (*PHPIndex) Constants ¶
Constants returns every constant visible on a class, including inherited constants and enum cases.
func (*PHPIndex) EndIndexingBatch ¶
EndIndexingBatch publishes every successfully committed PHP document in one generation. Nested batches are supported for direct coordinator reuse.
func (*PHPIndex) FindClass ¶
FindClass returns the preferred class-like declaration for a fully qualified PHP name. Source declarations win over internal runtime stubs.
func (*PHPIndex) FindConstants ¶
FindConstants resolves a class constant or enum case, including inherited and trait declarations.
func (*PHPIndex) FindGlobalConstants ¶
FindGlobalConstants returns declarations for a fully qualified global constant name.
func (*PHPIndex) FindMethods ¶
FindMethods resolves a method on a class, including inherited and trait methods, and returns specialized parameter types for generic ancestors.
func (*PHPIndex) FindProperties ¶
FindProperties resolves a property on a class, including inherited and trait declarations.
func (*PHPIndex) IndexPrepared ¶
func (idx *PHPIndex) IndexPrepared( file *indexer.ParsedFile, value any, ) error
func (*PHPIndex) IsMethodCalledName ¶
func (*PHPIndex) IsMethodCalledOnClass ¶
func (*PHPIndex) IsSubtypeOf ¶
IsSubtypeOf reports whether className is targetName, extends it, or implements it through the workspace hierarchy.
func (*PHPIndex) Methods ¶
Methods returns every method visible on a class, including inherited and trait declarations.
func (*PHPIndex) Properties ¶
Properties returns every property visible on a class, including inherited and trait declarations.
func (*PHPIndex) RegisterTypeExtension ¶
RegisterTypeExtension adds a framework-specific call inference provider.
func (*PHPIndex) RemovedFiles ¶
func (*PHPIndex) RemovedFilesIn ¶
func (*PHPIndex) SemanticDocument ¶
SemanticDocument reconstructs a fully linked document for an indexed path. The long-lived index intentionally persists only compact workspace graphs; detailed scopes and flow facts are parsed from source on demand.
func (*PHPIndex) SemanticSnapshot ¶
SemanticSnapshot returns the current immutable workspace generation.
func (*PHPIndex) ShouldEnterDirectory ¶
ShouldEnterDirectory selectively reopens Composer source roots that live in globally skipped directories such as tests/. Only the PHP index opts into these paths; generated assets and unrelated test trees remain excluded.
func (*PHPIndex) ShouldIndexPath ¶
func (*PHPIndex) ShouldPreparsePath ¶
func (*PHPIndex) TwigTemplateVariableSources ¶
func (idx *PHPIndex) TwigTemplateVariableSources( name string, templateNames ...string, ) ([]TwigTemplateVariable, error)
TwigTemplateVariableSources returns every indexed controller source for one variable name instead of merging duplicate providers.
func (*PHPIndex) TwigTemplateVariables ¶
func (idx *PHPIndex) TwigTemplateVariables( templateNames ...string, ) ([]TwigTemplateVariable, error)
TwigTemplateVariables returns the merged PHP context for every portable name of one Twig file. A concrete inferred type wins over an unknown value.
func (*PHPIndex) WorkspaceSymbols ¶
func (idx *PHPIndex) WorkspaceSymbols( file *indexer.ParsedFile, value any, ) ([]indexer.WorkspaceSymbol, error)
WorkspaceSymbols reuses the compact semantic graph produced by Prepare. It deliberately runs before the graph is released, avoiding a decode from SQLite and keeping symbol catalog population part of the file transaction.
type TwigTemplateContext ¶
type TwigTemplateContext struct {
Template string
Variables []TwigTemplateVariable
}
type TwigTemplateVariable ¶
type TwigTemplateVariable struct {
Template string
Name string
Type string
File string
Range cst.TextRange
}
TwigTemplateVariable describes one PHP value exposed to a Twig template. Type is persisted in canonical PHP type syntax instead of as types.Type, whose immutable representation intentionally has no exported fields.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package binder converts the lossless PHP CST into immutable semantic documents.
|
Package binder converts the lossless PHP CST into immutable semantic documents. |
|
Package imports analyzes namespace imports against the current PHP snapshot.
|
Package imports analyzes namespace imports against the current PHP snapshot. |
|
Package inference performs local expression and control-flow type analysis over bound PHP semantic documents.
|
Package inference performs local expression and control-flow type analysis over bound PHP semantic documents. |
|
Package languagelevel centralizes the PHP version required by language syntax understood by the permissive PHP parser.
|
Package languagelevel centralizes the PHP version required by language syntax understood by the permissive PHP parser. |
|
Package literal derives PHP literal types directly from lossless syntax.
|
Package literal derives PHP literal types directly from lossless syntax. |
|
Package phpdoc parses type-bearing PHPDoc tags into the shared semantic type algebra.
|
Package phpdoc parses type-bearing PHPDoc tags into the shared semantic type algebra. |
|
Package phpstormmeta parses the declarative subset of .phpstorm.meta.php files into typed semantic contracts.
|
Package phpstormmeta parses the declarative subset of .phpstorm.meta.php files into typed semantic contracts. |
|
Package project loads the Composer model that defines a PHP workspace.
|
Package project loads the Composer model that defines a PHP workspace. |
|
Package refactoring builds PHP refactorings against immutable source snapshots.
|
Package refactoring builds PHP refactorings against immutable source snapshots. |
|
Package resolver implements PHP name, hierarchy, member, and signature resolution over semantic snapshots.
|
Package resolver implements PHP name, hierarchy, member, and signature resolution over semantic snapshots. |
|
Package phprewrite provides lossless, composable PHP source rewrites on top of the immutable PHP CST.
|
Package phprewrite provides lossless, composable PHP source rewrites on top of the immutable PHP CST. |
|
Package semantic contains PHP symbols, scopes, references, and immutable document snapshots.
|
Package semantic contains PHP symbols, scopes, references, and immutable document snapshots. |
|
Package stubs supplies version-aware semantic declarations for PHP runtime symbols that do not exist in project source.
|
Package stubs supplies version-aware semantic declarations for PHP runtime symbols that do not exist in project source. |
|
catalog
Package catalog defines the compact, generated PHP runtime stub format.
|
Package catalog defines the compact, generated PHP runtime stub format. |
|
generate
Package generate builds the embedded runtime catalog from JetBrains' phpstorm-stubs repository.
|
Package generate builds the embedded runtime catalog from JetBrains' phpstorm-stubs repository. |
|
Package suppression parses source-level diagnostic suppression directives and matches them to Shopware LSP's stable PHP diagnostic identifiers.
|
Package suppression parses source-level diagnostic suppression directives and matches them to Shopware LSP's stable PHP diagnostic identifiers. |
|
Package types defines the semantic PHP type algebra.
|
Package types defines the semantic PHP type algebra. |