classValueDomain
final class ValueDomain
What a bound value can be, reported in the form the catalog stores.
A value that resolves statically is reported as the literals it can take, so a parameter typed as a backed enum becomes the union of that enum's values rather than a bare string. A value the analyzer could not follow is reported as its static type and where it came from.
Properties§
public string $typepublic list<string|int|float|bool|null> $valuespublic bool $exhaustivepublic list<string> $originsMethods§
public function __construct(
public string $type,
public list<string|int|float|bool|null> $values,
public bool $exhaustive,
public list<string> $origins,
)Parameters
$type | string | The static type, written the way PHP writes it |
$values | list<string|int|float|bool|null> | The values it can take, when they are known |
$exhaustive | bool | Whether the listed values are all of them |
$origins | list<string> | Where unresolved parts of the value come from |
public static function fromDomain(Domain $domain): selfThe report of what an evaluated domain can hold.
Parameters
$domain | Domain |
Returns
selfTest cases 9
ValueDomainTest::testAdmitsAcrossTheDriverWideningIntegersToStringscallsValueDomainTest::testAdmitsEverythingWhenNothingWasResolvedcallsValueDomainTest::testAdmitsOnlyTheResolvedAlternativescallsValueDomainTest::testDisplayWritesTheAlternativesOrTheTypecallsValueDomainTest::testFromDomainIsNotExhaustiveOnceTheAlternativesWereWidenedcallsValueDomainTest::testFromDomainListsTheResolvedAlternativescallsValueDomainTest::testFromDomainRecordsAnUnresolvedOriginForANonScalarTermcallsValueDomainTest::testFromDomainReportsOnlyTheTypeWhenAValueDidNotResolvecallsValueDomainTest::testIsResolvedNeedsBothExhaustivenessAndValuescalls
Called from 1
Calls 5
- class-const Origin::Unresolved() line 53
- new
selfline 56 - method-call Domain::type() line 57
- function-call
array_valuesline 60 - function-call
array_uniqueline 60
public function isResolved(): boolWhether the value is pinned down to a known set of alternatives.
Returns
boolpublic function admits(string|int|float|bool|null $value): boolWhether a runtime value is one the domain admits.
An unresolved domain admits everything, which is what makes it a sound over-approximation rather than a claim about the value.
Parameters
$value | string|int|float|bool|null |
Returns
boolCalls 2
- method-call ValueDomain::isResolved() line 80
- function-call
is_scalarline 87
public function display(): stringThe domain written for a reader.
Returns
stringCalls 4
- method-call ValueDomain::isResolved() line 100
- function-call
is_stringline 105 - function-call
var_exportline 105 - function-call
implodeline 108
Test cases 32§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 9
ValueDomainTest::testAdmitsAcrossTheDriverWideningIntegersToStringscallsValueDomainTest::testAdmitsEverythingWhenNothingWasResolvedcallsValueDomainTest::testAdmitsOnlyTheResolvedAlternativescallsValueDomainTest::testDisplayWritesTheAlternativesOrTheTypecallsValueDomainTest::testFromDomainIsNotExhaustiveOnceTheAlternativesWereWidenedcallsValueDomainTest::testFromDomainListsTheResolvedAlternativescallsValueDomainTest::testFromDomainRecordsAnUnresolvedOriginForANonScalarTermcallsValueDomainTest::testFromDomainReportsOnlyTheTypeWhenAValueDidNotResolvecallsValueDomainTest::testIsResolvedNeedsBothExhaustivenessAndValuescalls
Other tests reaching this symbol 23
CatalogCommandTestcallsEntryFactoryTestcallsPlaceholderTest::testWithValueKeepsEverythingElsecallsCallModelTestcallsAnalyzerTestcallsClassPageTest::testRenderIsWrittenExactlycallsFileIndexPageTest::testRenderIsWrittenExactlycallsFilePageTest::testRenderIsWrittenExactlycallsFindingPageTest::testRenderIsWrittenExactlycallsNamespacePageTest::testRenderIsWrittenExactlycallsOverviewPageTest::testRenderIsWrittenExactlycallsStatementIndexPageTest::testRenderIsWrittenExactlycallsStatementPageTest::testRenderCarriesEverythingKnownAboutTheStatementcallsStatementPageTest::testRenderIsWrittenExactlycallsStatementPageTest::testRenderOfACallNothingWasReadFromIsWrittenExactlycallsStatementPageTest::testValueRowSaysWhenNothingWasBoundOrPinnedDowncallsStatementPageTest::testValuesListTheBindParameterscallsTableIndexPageTest::testRenderIsWrittenExactlycallsTablePageTest::testRenderIsWrittenExactlycallsPageShellTest::testRenderIsWrittenExactlycallsStatementListTest::testFacetsIsWrittenExactlycallsJsonReporterTest::testPlaceholderToArrayCarriesTheBoundValuecallsTextReporterTestcalls