Created
February 6, 2015 09:49
-
-
Save olvlvl/7788d6bd8a4e172bbc92 to your computer and use it in GitHub Desktop.
Create annotation from declared variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$__a = "/**\n"; | |
foreach (array_diff_key(get_defined_vars(), [ '__a' => true, '__k' => true, '__v' => true ]) as $__k => $__v) | |
{ | |
$__v = is_object($__v) ? '\\' . get_class($__v) : gettype($__v); | |
$__a .= " * @var \$$__k $__v\n"; | |
} | |
$__a .= " */"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will output something like the following text. You might need to edit the output, since the type of
NULL
value cannot be determined.