Good: Fires when printing the link tag in the header.If the text refers to an HTML element or tag, then it should be written as “image tag” or “img” element, not “ “. No HTML markup or Markdown of any kind should be used in the summary. There should not be any opening/closing tags or other things between the DocBlock and the declarations to prevent the parser becoming confused. As such, following the standards in core and formatting as described below are extremely important to ensure expected output.ĭocBlocks should directly precede the hook, action, function, method, or class line. WordPress’ inline documentation standards for PHP are specifically tailored for optimum output on the official Code Reference. Existing MU (3.0.0) tags should not be changed.Ĭode Refactoring: It is permissible to space out the specific action or filter lines being documented to meet the coding standards, but do not refactor other code in the file. If the version number cannot be determined after using these tools, use Unknown.Īnything ported over from WPMU should use MU (3.0.0). An additional resource for older hooks is the WordPress Hooks Database. Top ↑ The recommended tool to use when searching for the version something was added to WordPress is svn blame. The serial (Oxford) comma should be used when listing elements in summaries, descriptions, and parameter or return descriptions. The one exception to this standard is file header summaries, which are intended as file “titles” more than sentences. Bad: _Allows you to register custom post types, custom taxonomies, and other general housekeeping tasks after a lot of WordPress core has loaded.ĭescriptive elements should be written as complete sentences.Good: _Fires after most of core is loaded, and the user is authenticated.Bad: Lets you edit the post content that is output in the post template.Bad: Display the date on which the post was last modified.Good: Displays the last modified date for a post.Need help remembering how to conjugate for third-person singular verbs? Imagine prefixing the function, hook, class, or method summary with “It”: Avoid describing “why” an element exists, rather, focus on documenting “what” and “when” it does something.Ī function, hook, class, or method is a third-person singular element, meaning that third-person singular verbs should be used to describe what each does. Summaries should be clear, simple, and brief. Class members (including properties and constants).The following is a list of what should be documented in WordPress files: PHP documentation in WordPress mostly takes the form of either formatted blocks of documentation or inline comments. The formatter will perform the same formatting operations in memory and will exit with a non-zero status in case any of the formatted files differs from the original one.WordPress uses a customized documentation schema that draws inspiration from PHPDoc, an evolving standard for providing documentation to PHP code, which is maintained by phpDocumentor. Run the formatter in the validation mode. This option is useful if the command-line formatter cannot correctly process special letters in a source file. Preserve encoding and enforce the charset for reading and writing source files, for example: -charset ISO-8859-15. Otherwise the file or files will be ignored. Use the default code style settings when the code style is not defined for a file or a group of files: when -s is not set and the file does not belong to any project. If there is a project in one of the parent folders, its settings will be used implicitly as well as EditorConfig. If this option is not specified, the file will be skipped. The remaining settings will be taken from your code style scheme. In this case, if formatting settings from EditorConfig overlap with the settings from your code style scheme, PhpStorm will use the settings from EditorConfig. editorconfig files in the parent directories and applies them for formatting on top of the PhpStorm code style settings. idea/codeStyles/Project.xml file stored in your project directory (for PhpStorm version 2017.3 and later). idea/codeStyleSettings.xml file stored in your project directory (for PhpStorm version 2017.2 and earlier). This can be one of the following:Ī file with the exported code style settings: open the Editor | Code Style page of the IDE settings Ctrl+Alt+S, click, and select Export. Specify the code style settings file to use for formatting. Process specified directories recursively. You can use the * (any string) and ? (any single character) wildcards. Specify a comma-separated list of file masks that define the files to be processed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |