classEntryIdentity
final class EntryIdentity
The identifier a catalogued statement keeps across runs.
The identifier is built from the file, the enclosing function, the database call and the statement shape, and deliberately not from the line number, so that editing unrelated lines of a file does not renumber its catalog. That is what makes two catalogs comparable across a pull request.
Constants§
public const LENGTH = 12How many hexadecimal characters an identifier keeps.
Methods§
public function compute(CallSite $site, TextPattern $pattern, int $occurrence = 0): stringThe identifier of a statement issued at the given site.
Two calls in the same function can produce statements the catalog cannot tell apart — two unreached calls, say, whose text is entirely unknown. The occurrence separates them without bringing the line number back in, so they stay distinct and still survive an edit above them.
Parameters
$site | CallSite | |
$pattern | TextPattern | |
$occurrence | int | Which of the otherwise identical statements this is, counting from zero |
Returns
stringTest cases 5
EntryIdentityTest::testComputeIgnoresTheLineNumbercallsEntryIdentityTest::testComputeIsAsLongAsItSaysItIscallsEntryIdentityTest::testComputeIsStableForTheSameStatementcallsEntryIdentityTest::testComputeSeparatesDifferentStatementsAndSitescallsEntryIdentityTest::testComputeSeparatesStatementsItCannotOtherwiseTellApartcalls
Called from 2
Calls 5
- function-call
implodeline 38 - method-call TextPattern::signature() line 38
- function-call
substrline 43 - function-call
hashline 43 - class-const EntryIdentity::LENGTH() line 43
Test cases 12§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
EntryIdentityTest::testComputeIgnoresTheLineNumbercallsEntryIdentityTest::testComputeIsAsLongAsItSaysItIscallsEntryIdentityTest::testComputeIsStableForTheSameStatementcallsEntryIdentityTest::testComputeSeparatesDifferentStatementsAndSitescallsEntryIdentityTest::testComputeSeparatesStatementsItCannotOtherwiseTellApartcalls
Other tests reaching this symbol 7
CatalogCommandTestcallsEntryFactoryTestcallsExpressionEvaluatorTestcallsCallModelTestcallsAnalyzerTestcallsJsonReporterTestcallsTextReporterTestcalls