Skip to content

Instantly share code, notes, and snippets.

@pedrohenriqueromio
Created February 27, 2023 23:14
Show Gist options
  • Save pedrohenriqueromio/53f44d0df5cc1aabc0bfd6fdeb6df1ab to your computer and use it in GitHub Desktop.
Save pedrohenriqueromio/53f44d0df5cc1aabc0bfd6fdeb6df1ab to your computer and use it in GitHub Desktop.
simple phpdocs examples
// Doc File example
/**
* Recipe class file
*
* PHP Version 8.1
*
* @category Recipe
* @package Recipe
* @author pedro henrique romio dos santos <pedrohenriqueromio@gmail.com>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @link http://example.com/recipes
*/
// Doc Class example
/**
* Recipe class
*
* The class holding the root Recipe class definition
*
* @category Recipe
* @package Recipe
* @author pedro henrique romio dos santos <pedrohenriqueromio@gmail.com>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @link http://example.com/recipes/recipe
*/
// Doc Function example
/**
* Get the ingredients
*
* This function calls a static fetching method against the Ingredient class
* and returns everything matching this recipe ID
*
* @return array An array of Ingredient objects
*/
// Tipos de Retorno
/**
* @return void
*/
function return_never() {
echo "foo";
}
/**
* @return null|string
*/
function return_sometimes() {
if ($this->condition()) {
return "foo";
}
}
/**
* @return array [
* 'success' => true,
* 'formObject' => new Form,
* 'errors' => [],
* ]
*/
public static function processForm($arr);
/**
* @param
array $row
*
* @return array
*/
abstract function formatRow(array $row): array;
/**
* @return static
*/
abstract function getFoo(): self;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment