classCallerIndex
final class CallerIndex
Every call in the source, by the name it is written with.
Going from a parameter to the arguments passed for it means finding the calls that reach the function. The calls are gathered once, by name, so that finding them is a lookup; deciding which of them really reach the function is left to whoever asks, because that can need their receivers.
Methods§
public function __construct(list<ParsedFile> $files = [])Gathers the calls of every file.
Parameters
$files | list<ParsedFile> |
Calls 4
- new
NodeFinderline 41 - method-call
NodeFinder::findInstanceOf()line 44 - class-const
CallLike::class()line 44 - method-call CallerIndex::add() line 46
public function add(CallLike $call): voidFiles one call under the name it is written with.
Parameters
$call | CallLike |
Test cases 1
Called from 1
Calls 2
- method-call CallerIndex::shortName() line 58
- method-call CallerIndex::nameOf() line 63
public function named(string $name): list<CallLike>The calls written with that name, whatever they are called on.
Parameters
$name | string |
Returns
list<CallLike>Test cases 2
Called from 2
Calls 1
- method-call CallerIndex::shortName() line 76
public function instantiating(string $className): list<New_>The instantiations written with that class name.
Parameters
$className | string |
Returns
list<New_>Test cases 1
Called from 1
Calls 1
- method-call CallerIndex::shortName() line 86
public function nameOf(CallLike $call): ?stringThe name a call is written with, or null when it is not written as a name.
Parameters
$call | CallLike |
Returns
?stringTest cases 1
public function shortName(string $name): stringA name without its namespace, in lower case.
Parameters
$name | string |
Returns
stringTest cases 1
Called from 4
- method-call SqlCatalog\Core\Analysis\Derivation\CallerIndex::add() packages/sql-catalog/src/Core/Analysis/Derivation/CallerIndex.php:58
- method-call SqlCatalog\Core\Analysis\Derivation\CallerIndex::add() packages/sql-catalog/src/Core/Analysis/Derivation/CallerIndex.php:65
- method-call SqlCatalog\Core\Analysis\Derivation\CallerIndex::named() packages/sql-catalog/src/Core/Analysis/Derivation/CallerIndex.php:76
- method-call SqlCatalog\Core\Analysis\Derivation\CallerIndex::instantiating() packages/sql-catalog/src/Core/Analysis/Derivation/CallerIndex.php:86
Private surface 2§
Implementation details, listed for orientation only.
private array<string, list<CallLike>> $calls = []private array<string, list<New_>> $instantiations = []Test cases 55§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
CallerIndexTest::testAddFilesACallUnderItsNamecallsCallerIndexTest::testInstantiatingFindsEveryNewOfTheClasscallsCallerIndexTest::testNamedFindsEveryCallWrittenWithTheNamecallsCallerIndexTest::testNameOfReadsTheNameACallIsWrittenWithcallsCallerIndexTest::testShortNameDropsTheNamespaceAndTheCasecalls
Other tests reaching this symbol 50
CatalogCommandTestcallsCallEvaluatorTestcallsConstantReaderTestcallsCalleeReturnsTestcallsCallersTest::testInheritorsOfListsTheSubclassesThatInheritTheConstructorcallsCallersTest::testInstantiationsIncludeSubclassesThatInheritTheConstructorcallsCallersTest::testInstantiationsMatchTheClassEachNewIsWrittenWithcallsCallersTest::testInstantiationsReadSelfAndStaticAsTheClassTheyAreWrittenIncallsCallersTest::testOfFindsNoCallersOfAClosurecallsCallersTest::testOfFindsNoCallersOfAMethodWrittenOutsideAnyClasscallsCallersTest::testOfFindsTheCallsWrittenWithAFunctionsNamecallsCallersTest::testOfFindsTheExplicitCallsOfAConstructorAsWellAsTheInstantiationscallsCallersTest::testOfFindsTheInstantiationsOfAClassForItsConstructorcallsCallersTest::testOfFunctionFallsBackToTheWrittenNameOfADeclarationWithoutAResolvedOnecallsCallersTest::testOfFunctionLeavesOutCallsOfAnotherFunctionWithTheSameShortNamecallsCallersTest::testOfFunctionMatchesTheGlobalFunctionACallInANamespaceFallsBackTocallsCallersTest::testOfIsNotPartialWhenEveryCallIsAccountedForcallsCallersTest::testOfKeepsTheCallsThatCanReachTheMethodInTheOrderWrittencallsCallersTest::testOfListsEveryCallerWithoutStoppingAtTheCallerLimitcallsCallersTest::testOfMarksTheCallersPartialWhenACallMightReachTheMethodWithoutThatBeingCertaincallsCallersTest::testOfSkipsClassesAnExtensionModelscallsCallersTest::testReachesCannotTellOnceTheBudgetIsSpentcallsCallersTest::testReachesDecidesWhetherACallCanLandInTheMethodcallsCallersTest::testReachesWorksOutTheReceiverOneCallDeepercallsCallersTest::testRelatedHoldsBetweenAClassAndItsHierarchyInEitherDirectioncallsCallersTest::testRelatedStopsAtAnOverrideBetweenTheReceiverAndTheDeclaringClasscallsCallersTest::testStaticTargetIsTheClassTheLookupStartsFromcallsDeriverTest::testBinderIsTheEntryBinderTheDeriverWasWiredWithcallsDeriverTest::testEvaluatorIsTheEvaluatorTheDeriverWasWiredWithcallsDeriverTest::testSolveReadsWhatTheGoalsNeedWithTheNamesItWasGivencallsEntryBinderTest::testBindingsLeaveThePropertiesAloneWithoutAReaderOfPropertyWritescallsEntryBinderTest::testFileScopeBindsTheGlobalsAnExtensionDeclarescallsCallbackEffectsTestcallsPropertyWritesTest::testValuesOfCollectsWhatEveryWriterLeavescallsPropertyWritesTest::testValuesOfSkipsTheWritersOnceTheBudgetIsSpentcallsSliceExecutorTestcallsExpressionEvaluatorTestcallsRegistryTestcallsInterpreterTestcallsModelQueriesTestcallsReferenceEvaluatorTestcallsCallContextTestcallsQueryModelInterfaceTestcallsBuilderCallsTestcallsBuilderQueriesTestcallsCallbackModelTestcallsCallModelTestcallsAnalyzerTestcallsJsonReporterTestcallsTextReporterTestcalls
Relations§
Instantiated in 1
Method calls 4
- method-call SqlCatalog\Core\Analysis\Derivation\Callers::of() packages/sql-catalog/src/Core/Analysis/Derivation/Callers.php:77
- method-call SqlCatalog\Core\Analysis\Derivation\Callers::ofFunction() packages/sql-catalog/src/Core/Analysis/Derivation/Callers.php:97
- method-call SqlCatalog\Core\Analysis\Derivation\Callers::instantiations() packages/sql-catalog/src/Core/Analysis/Derivation/Callers.php:123
- method-call SqlCatalog\Core\Analysis\Derivation\Callers::reaches() packages/sql-catalog/src/Core/Analysis/Derivation/Callers.php:166