Skip to content

Instantly share code, notes, and snippets.

@BrynM
Last active July 14, 2018 00:17
Show Gist options
  • Save BrynM/99bbf5648a7d8e51510eced34441dfdb to your computer and use it in GitHub Desktop.
Save BrynM/99bbf5648a7d8e51510eced34441dfdb to your computer and use it in GitHub Desktop.
Sublime Snippets - PHP Documentor

Sublime Snippets - PHP Documentor

Some completions for basic PHPDoc templates. Drop these into your Sublime Packages->User folder.

The completions are as follows (assuming your auto-complete key is [TAB]). Place your cursor on the first character of the first line of the declaration for the thing you're documenting for best results.

  • /**c[TAB] - doc block for a Class
  • /**co[TAB] - doc block for a constant
  • /**ff[TAB] - doc block for a file (should be done on the line after the opening <?php tag)
  • /**f[TAB] - doc block for a function
  • /**m[TAB] - a nag block for missing doc blocks because I can be a jerk
  • /**v[TAB] - doc block for a variable
<snippet>
<content><![CDATA[/**
* Class_Name
*
* A description of my class.
*
* @package foo
* @subpackage subfoo
* @see some_class::use_some_var()
* @filesource
*/]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>/**c</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>Bryn's PHPDocumentor Variable Docblock</description>
</snippet>
<snippet>
<content><![CDATA[/**
* SOME_CONST
*
* A description of my constant.
*
* @const string SOME_CONST
* @see some_class::some_func()
* @filesource
*/]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>/**co</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>Bryn's PHPDocumentor Constant Docblock</description>
</snippet>
<snippet>
<content><![CDATA[/**
* $TM_FILENAME
*
* Long description.
*
* @todo Finish
* @package foo
* @subpackage subfoo
* @version v0.000
* @license Proprietary.
* @filesource
*/]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>/**ff</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>Bryn's PHPDocumentor File Docblock</description>
</snippet>
<snippet>
<content><![CDATA[/**
* function_name()
*
* Description of function_name().
*
* @param string \$stringParm The string to get funky with
* @return mixed Some oddball return val.
* The type of return val that you can specify are mixed, bool, object, string, int, etc...
* @static
* @access public
* @see some_class::some_func()
* @filesource
*/]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>/**f</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>Bryn's PHPDocumentor Function Docblock</description>
</snippet>
<snippet>
<content><![CDATA[/**
* DOCUMENT ME!
*
* @todo DOCUMENT ME!
* @see lazy mofos
* @filesource
*/]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>/**m</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>Bryn's PHPDocumentor Missing Docblock</description>
</snippet>
<snippet>
<content><![CDATA[/**
* \$some_var
*
* A description of my var.
*
* @var string \$someVar
* @static
* @access public
* @see some_class::use_some_var()
* @filesource
*/]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>/**v</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>Bryn's PHPDocumentor Variable Docblock</description>
</snippet>
@BrynM
Copy link
Author

BrynM commented Jul 14, 2018

Fuckyeah! Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment