當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。