Supported Versions: PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8
Returns the value of a constant
<?php constant(string $name): mixed
<?php return new ArrayObject((new Collection($data))->map(function ($value) use ($enumClass) {
return is_subclass_of($enumClass, BackedEnum::class)
? $enumClass::from($value)
: constant($enumClass.'::'.$value);
})->toArray());
}
<?php return (new Collection($data))->map(function ($value) use ($enumClass) {
return is_subclass_of($enumClass, BackedEnum::class)
? $enumClass::from($value)
: constant($enumClass.'::'.$value);
});
}
<?php {
return is_subclass_of($enumClass, BackedEnum::class)
? $enumClass::from($value)
: constant($enumClass.'::'.$value);
}
<?php public function validateTimezone($attribute, $value, $parameters = [])
{
return in_array($value, timezone_identifiers_list(
constant(DateTimeZone::class.'::'.Str::upper($parameters[0] ?? 'ALL')),
isset($parameters[1]) ? Str::upper($parameters[1]) : null,
), true);
}
<?php $translate = [];
foreach ($this->newKeywords as $token => $versions) {
if (\defined($token)) {
$tokens[] = \constant($token);
}
if (isset($versions['content'])) {
$translate[\strtolower($versions['content'])] = $token;
<?php {
$tokens = [];
foreach ($this->newConstructs as $token => $versions) {
$tokens[] = \constant($token);
}
return $tokens;
}
<?php $tokens = [];
foreach ($this->newOperators as $token => $versions) {
if (\defined($token)) {
$tokens[] = \constant($token);
} elseif (isset($this->newOperatorsPHPCSCompat[$token])) {
$tokens[] = $this->newOperatorsPHPCSCompat[$token];
}
<?php $tokens = [];
foreach ($this->newTypeCasts as $token => $versions) {
if (\defined($token)) {
$tokens[] = \constant($token);
}
}
<?php {
$tokens = [];
foreach ($this->deprecatedTypeCasts as $token => $versions) {
$tokens[] = \constant($token);
}
return $tokens;
<?php $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($opType);
if (defined($event) && $runScripts && $this->eventDispatcher) {
$this->eventDispatcher->dispatchPackageEvent(constant($event), $devMode, $repo, $allOperations, $operation);
}
$dispatcher = $this->eventDispatcher;
<?php $postExecCallbacks[] = function () use ($opType, $runScripts, $dispatcher, $devMode, $repo, $allOperations, $operation) {
$event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($opType);
if (defined($event) && $runScripts && $dispatcher) {
$dispatcher->dispatchPackageEvent(constant($event), $devMode, $repo, $allOperations, $operation);
}
};
<?php public function getConstant($constant, $class = null)
{
return constant(ltrim($class.'::'.$constant, ':'));
}
<?php });
$handled = false;
$this->assertTrue(pcntl_signal(constant($signal), function () use (&$handled) {
$handled = true;
}));
<?php });
$handled = false;
$this->assertTrue(pcntl_signal(constant($signal), function () use (&$handled) {
$handled = true;
}));
<?php protected function resetSignalHandlers()
{
foreach($this->signalProvider() as $signal) {
pcntl_signal(constant($signal[0]), SIG_DFL);
}
}