- Fix: Notifiable-Trait zum User-Model hinzugefuegt (behebt notify()-500er) - Installer: SMTP-Verbindungstest mit EsmtpTransport + Ueberspringen-Link - Admin: Neuer E-Mail-Tab mit SMTP-Konfiguration + Verbindungstest - Admin: Lazy Quill-Initialisierung (nur sichtbare Locale wird geladen) - Uebersetzungen: 17 neue Mail-Keys in allen 6 Sprachen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
61 lines
1.8 KiB
PHP
Executable File
61 lines
1.8 KiB
PHP
Executable File
<?php declare(strict_types=1);
|
|
|
|
namespace PhpParser\Node\Expr;
|
|
|
|
use PhpParser\Node\Arg;
|
|
use PhpParser\Node\Expr;
|
|
use PhpParser\Node\VariadicPlaceholder;
|
|
|
|
abstract class CallLike extends Expr {
|
|
/**
|
|
* Return raw arguments, which may be actual Args, or VariadicPlaceholders for first-class
|
|
* callables.
|
|
*
|
|
* @return array<Arg|VariadicPlaceholder>
|
|
*/
|
|
abstract public function getRawArgs(): array;
|
|
|
|
/**
|
|
* Returns whether this call expression is actually a first class callable.
|
|
*/
|
|
public function isFirstClassCallable(): bool {
|
|
$rawArgs = $this->getRawArgs();
|
|
return count($rawArgs) === 1 && current($rawArgs) instanceof VariadicPlaceholder;
|
|
}
|
|
|
|
/**
|
|
* Assert that this is not a first-class callable and return only ordinary Args.
|
|
*
|
|
* @return Arg[]
|
|
*/
|
|
public function getArgs(): array {
|
|
assert(!$this->isFirstClassCallable());
|
|
return $this->getRawArgs();
|
|
}
|
|
|
|
/**
|
|
* Retrieves a specific argument from the raw arguments.
|
|
*
|
|
* Returns the named argument that matches the given `$name`, or the
|
|
* positional (unnamed) argument that exists at the given `$position`,
|
|
* otherwise, returns `null` for first-class callables or if no match is found.
|
|
*/
|
|
public function getArg(string $name, int $position): ?Arg {
|
|
if ($this->isFirstClassCallable()) {
|
|
return null;
|
|
}
|
|
foreach ($this->getRawArgs() as $i => $arg) {
|
|
if ($arg->unpack) {
|
|
continue;
|
|
}
|
|
if (
|
|
($arg->name !== null && $arg->name->toString() === $name)
|
|
|| ($arg->name === null && $i === $position)
|
|
) {
|
|
return $arg;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|