Search
 
SCRIPT & CODE EXAMPLE
 

PHP

phpdoc @method

/** @method string greet(string $who) Hello that guy */
class MyClass
{
  public function __call(string $name, array $args): string
  {
    if( $name === 'greet' )
      return "Hello {$args[0]}!";
    return '';
  }
}
Comment

phpdoc example

/**
 * @property	MyClass	$self_ref			Reference to myself
 * @method		string	greet(string $who)	Hello that guy
 */
class MyClass
{
  /**
   * @param		string		 $name	Name of pseudo-property do invoke
   * @returns	MyClass|null 		Reference to instance or null if 
   *									no name provided.
   */
  public function __get(string $name): ?MyClass
  {
    if( $name === 'self_ref' )
      return $this;
   	return null;
  }
  
  /**
   * @param		string	$name	Name of implicit function to call.
   * @param		array	$args	Array of arguments passed to call.
   * @returns	string			The greeting string or null if no name.
   */
  public function __call(string $name, array $args): string
  {
    if( $name === 'greet' )
    {
      /** @var string $guy The name of the guy to greet */
      $guy = $args[0] ?? 'everyone';
      return "Hello {$guy}!";
    }
    return '';
  }
}
Comment

PREVIOUS NEXT
Code Example
Php :: php page sends cookie to visitor 
Php :: laravel env in js 
Php :: laravel get data from database by id 
Php :: cURL error 6: Could not resolve host: api.themoviedb.org (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/popular?api_key=5cb73b68870b70a436b10ea06298de07 
Php :: how to create object in php 
Php :: php reverse string 
Php :: php string remove last character 
Php :: php array_slice 
Php :: php array_push 
Php :: display elements of the array 
Php :: Add Custom Field to woocommerce Subscriptions 
Php :: how convert the string to int in laravel function event 
Php :: why php is not using datatype 
Php :: Export database to sql dump in php 
Php :: php pass byref 
Php :: enableQueryLog 
Php :: aravel cache store does not support tagging 
Php :: disable cors laravel 
Php :: Protect Your Site from Malicious Requests 
Php :: Display random custom content in WooCommerce shop archive loop 
Php :: slideshow php 
Php :: data types of laravel migrations 
Php :: php jwt firebase 
Php :: Script to create AdminLTE in a Laravel project 
Php :: exists:categories,id except a value laravel 
Php :: how to disable laravel cors 
Php :: /usr/local/bin/php /home/tbmholdingltd/public_html/tugent/php artisan schedule:run /dev/null 2&1 
Php :: contact us page mail prestashop 
Php :: MForm Bild Attribute 
Php :: can i do a relation between 2 coulnm in mongodb laravel 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =