本文整理汇总了PHP中nameof函数的典型用法代码示例。如果您正苦于以下问题:PHP nameof函数的具体用法?PHP nameof怎么用?PHP nameof使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nameof函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConnection
/**
* Get connection
*
* @param string url
* @return peer.http.HttpConnection
*/
protected function getConnection($url = null)
{
if (null === $url) {
throw new \lang\IllegalArgumentException(nameof($this) . ' requires a URL as its argument');
}
return new HttpConnection($url);
}
示例2: verify
/**
* Executes this check
*
* @param xp.compiler.ast.Node node
* @param xp.compiler.types.Scope scope
* @return bool
*/
public function verify(\xp\compiler\ast\Node $node, \xp\compiler\types\Scope $scope)
{
$a = \cast($node, 'xp.compiler.ast.AssignmentNode');
if (!$this->isWriteable($a->variable)) {
return ['A403', 'Cannot assign to ' . ($a->variable instanceof \lang\Generic ? nameof($a->variable) : \xp::stringOf($a->variable)) . 's'];
}
}
示例3: toString
/**
* Creates a string representation of this iterator
*
* @return string
*/
public function toString()
{
$s = nameof($this) . '(' . $this->_size . ")@{\n";
for ($i = 0; $i < $this->_size; $i++) {
$s .= ' ' . \xp::stringOf($this->list[$i], ' ') . "\n";
}
return $s . '}';
}
示例4: class_name_of_generic_package_class
public function class_name_of_generic_package_class()
{
$instance = newinstance('net.xp_framework.unittest.core.generics.ArrayFilter<lang.Object>', [], '{
protected function accept($e) { return true; }
}');
$n = nameof($instance);
$this->assertEquals('net.xp_framework.unittest.core.generics.ArrayFilter··lang¦Object', substr($n, 0, strrpos($n, '·')), $n);
}
示例5: toString
/**
* Creates a string representation
*
* @return string
*/
public function toString()
{
$s = nameof($this) . "@[\n";
foreach ($this as $const) {
$s .= ' ' . (string) $const . "\n";
}
return $s . ']';
}
示例6: toString
/**
* Creates a string representation of this Operator
*
* @return string
*/
public function toString()
{
$signature = '';
foreach ($this->parameters as $parameter) {
$signature .= ', ' . $parameter->compoundName();
}
return sprintf('%s<%s %s %s(%s)>', nameof($this), implode(' ', \lang\reflect\Modifiers::namesOf($this->modifiers)), $this->returns->compoundName(), $this->symbol, substr($signature, 2));
}
示例7: __call
/**
* Fluent interface
*
* @param string name
* @param var[] args
* @return var
*/
public function __call($name, $args)
{
if (method_exists($this->finder, $name)) {
return $this->select($this->finder->{$name}(...$args));
} else {
throw new FinderException('No such method ' . $name . ' in ' . nameof($this->finder));
}
}
示例8: toString
/**
* Creates a string representation of this tolerance instance.
*
* @return string
*/
public function toString()
{
if ($this->past === $this->future) {
return nameof($this) . '(' . $this->future . ')';
} else {
return nameof($this) . '([' . $this->past . '..+' . $this->future . '])';
}
}
示例9: toString
/**
* Creates a string representation
*
* @return string
*/
public function toString()
{
$s = nameof($this) . "@{\n";
foreach ($this->keys as $target => $source) {
$s .= ' ' . $target . ' => ' . $this->source . '.' . $source . "\n";
}
return $s . '}';
}
示例10: toString
/**
* Creates a string representation of this object
*
* @return string
*/
public function toString()
{
$s = nameof($this) . '(' . $this->impl->size() . ")@{\n";
foreach ($this->impl->keys() as $key) {
$s .= sprintf(" [%-20s] %s\n", $key->getSimpleName(), nameof($this->impl->get($key)));
}
return $s . '}';
}
示例11: toString
/**
* Creates a string representation of this handler
*
* @return string
*/
public function toString()
{
$s = sprintf("%s@{\n" . " [name ] %s\n" . " [identifier ] %s\n" . " [wrapper ] %s\n", nameof($this), $this->name, $this->identifier, $this->wrapper ? nameof($this->wrapper) : '(null)');
foreach (array_keys($this->values[HVAL_PERSISTENT]) as $key) {
$s .= sprintf(" [%-20s] %s\n", $key, \xp::typeOf($this->values[$key]));
}
return $s . '}';
}
示例12: toString
/**
* Creates a string representation
*
* @return string
*/
public function toString()
{
$s = nameof($this) . "@{\n";
foreach ($this->nodes as $row) {
$s .= ' ' . $row->toString() . "\n";
}
return $s . '}';
}
示例13: define
/**
* Defines a type
*
* @param string $declaration
* @param string[] $extends
* @return lang.XPClass
*/
protected function define($declaration, $extends = [Object::class])
{
if (!isset(self::$fixtures[$declaration])) {
$definition = ['kind' => 'class', 'extends' => $extends, 'implements' => [], 'use' => [], 'imports' => [Identity::class => null]];
self::$fixtures[$declaration] = ClassLoader::defineType(nameof($this) . sizeof(self::$fixtures), $definition, $declaration);
}
return self::$fixtures[$declaration];
}
示例14: toString
/**
* Creates a string representation of this result set
*
* @return string
*/
public function toString()
{
$entries = '';
foreach ($this->entries as $entry) {
$entries .= ' ' . str_replace("\n", "\n ", $entry->toString()) . "\n";
}
return sprintf("%s(total ~ %d%s)@{\n%s}", nameof($this), $this->total, $this->filtered ? ', filtered' : '', $entries);
}
示例15: passes_args_to_constructor
public function passes_args_to_constructor()
{
$fixture = newinstance(Object::class, [], '{
public $passed= null;
public function __construct(... $args) { $this->passed= $args; }
}');
$this->assertEquals(['Test', 1], (new NewInstance(nameof($fixture), [new Value('Test'), new Value(1)]))->resolve($this->source)->passed);
}