Language record
PHP
PHP is read as the namespaced class diagram it actually is: classes, interfaces, traits, enums and functions each get an identity, `extends`, `implements` and trait `use` resolve between them, and a `use App\Domain\Invoice;` at the top of a file is an import edge to a symbol the index already owns.
The registry row this page is generated from
Read at render time from the same family row the register reads, so nothing in this block can disagree with it.
- Extensions
- .php, .phpt
- Registry names
php- Recorded symbols
- classes · namespaces · methods · enums
Relationship types this analyzer constructs
12 of 14 constructed, read from this analyzer's source and re-derived by the languages gate. Each row below is one of the engine's types, in the engine's own order.
| Relationship type | Constructed |
|---|---|
calls | constructed by this analyzer |
extends | constructed by this analyzer |
implements | constructed by this analyzer |
uses | constructed by this analyzer |
imports | constructed by this analyzer |
exports | constructed by this analyzer |
contains | constructed by this analyzer |
references | constructed by this analyzer |
overrides | constructed by this analyzer |
instantiates | constructed by this analyzer |
decorates | ruled absent |
renders | ruled absent |
mixes_in | constructed by this analyzer |
part_of | constructed by this analyzer |
12 constructed, 2 not constructed. All 2 absent types are recorded as ruled absent: the written reason and the corpus measurement behind each are in this family's completeness record. The register explains what each label means.
What this analyzer does not resolve
- A callee named by a variable has no target to resolve to.
$service->$method()and$handler('x')are refused, and a first-class callable writtenfoo(...)is recorded as a member read withisTearOffrather than as a call, because it names a callable without invoking it. A braced member ($box->{'quoted'}) is refused for the same reason — it published a string literal as a symbol name on both ends. - The 218 core global functions are held as a bare-name list and filtered out of call edges, but method calls are not, because
$obj->persist()is user code. That bare-name test had a measured hole: a fully qualified\is_file(...)did not match the set, and 12 such edges were counted on one phpunit revision before the leaf was taken before the filter rather than after. exportsis absent, and the reason is stated rather than assumed — a PHP file has no module surface, measured at 0 exports across the corpora. Separately, aprivatemethod is never the target of anoverridesedge; phpunit ships a fixture asserting exactly that rule, because a defect with no corpus footprint is only catchable by hand.
Every line above was written against PHP’s own analyzer module and is named against a construct in it, so it can be checked against the source. Nothing here is inherited from a template, or from another language’s page.
Where you meet it in a repository
Recognised by extension — .php, .phpt. Everything below is about where those files actually sit in a working repository.
- Composer and PSR-4 put one namespace per directory, so a file's namespace, its class's owner and its path on disk all agree — which is why the import at the top of the file resolves to something the index already owns.
- Traits are the interesting half:
use Money;inside a class body is recorded as composition, so "which classes get this behaviour" is answerable while the trait's own methods stay owned by the trait. - Declared types are a graph of their own. A property type, a parameter type, a return type and a typed class constant each publish a reference edge, and the distinction between a declared type and a return type survives in the edge metadata — the primitive types are excluded because they name no declaration.
Questions this index answers
Phrased as retrievals, because that is what an index can honestly do: it holds the symbols and the edges between them, and hands them back with the evidence attached.
- Which classes implement this interface, and which traits does this class compose?
- What does this method call, and who calls it?
- Which classes does this namespace declare?
- Which method overrides its parent's, and where is the parent declared?
What the analyzer sees in code like this
<?php
namespace App\Domain; // bb records: namespace App\Domain
final class Invoice extends Document implements Payable { // class + extends + implements
use Money; // bb records: trait Money composed into Invoice
public function settle(): void // bb records: method settle on Invoice
{
$this->ledger->post($this->total); // bb records: calls -> post, the leaf member name
}
}Symbols are stored with the file they came from and the bytes they span, so a hit points at a line rather than at a guess. The annotations in the sample are commentary for the reader, not strings the index would store.
Languages that turn up in the same repository
Scripting & shell — the count beside each name is how many relationship types that family’s analyzer constructs.
The extensions, registry names, recorded symbols and relationship types above are the parser registry row for PHP, read while the page rendered — the same row the register reads, so the two surfaces cannot tell two stories. Every relationship type listed as constructed appears in src/ast/real-*, the analyzer modules bb ships. bb 0.1.0 answers from a local store over 50 languages (53 registry ids, three of them aliases). There is no benchmark on this page: every claim here is one you can go and read in the source.