当前位置: 首页>>代码示例>>PHP>>正文


PHP nameof函数代码示例

本文整理汇总了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);
 }
开发者ID:johannes85,项目名称:core,代码行数:13,代码来源:WebTestCase.class.php

示例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'];
     }
 }
开发者ID:xp-lang,项目名称:compiler,代码行数:14,代码来源:IsAssignable.class.php

示例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 . '}';
 }
开发者ID:xp-framework,项目名称:io-collections,代码行数:13,代码来源:AbstractCombinedFilter.class.php

示例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);
 }
开发者ID:johannes85,项目名称:core,代码行数:8,代码来源:AnonymousInstanceTest.class.php

示例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 . ']';
 }
开发者ID:xp-forge,项目名称:mirrors,代码行数:13,代码来源:Constants.class.php

示例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));
 }
开发者ID:xp-lang,项目名称:compiler,代码行数:13,代码来源:Operator.class.php

示例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));
     }
 }
开发者ID:xp-framework,项目名称:rdbms,代码行数:15,代码来源:FinderDelegate.class.php

示例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 . '])';
     }
 }
开发者ID:xp-forge,项目名称:google-authenticator,代码行数:13,代码来源:Tolerance.class.php

示例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 . '}';
 }
开发者ID:xp-framework,项目名称:rdbms,代码行数:13,代码来源:DBForeignKeyConstraint.class.php

示例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 . '}';
 }
开发者ID:xp-lang,项目名称:compiler,代码行数:13,代码来源:Optimizations.class.php

示例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 . '}';
 }
开发者ID:xp-framework,项目名称:scriptlet,代码行数:13,代码来源:AbstractHandler.class.php

示例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 . '}';
 }
开发者ID:xp-forge,项目名称:markdown,代码行数:13,代码来源:Table.class.php

示例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];
 }
开发者ID:xp-forge,项目名称:mirrors,代码行数:15,代码来源:TypeDefinition.class.php

示例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);
 }
开发者ID:xp-forge,项目名称:google-search,代码行数:13,代码来源:ResultSet.class.php

示例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);
 }
开发者ID:xp-forge,项目名称:mirrors,代码行数:8,代码来源:NewInstanceTest.class.php


注:本文中的nameof函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。