Skip to content

Commit 91e7977

Browse files
committed
Normalize PHPDoc comments
1 parent d829a30 commit 91e7977

18 files changed

Lines changed: 118 additions & 134 deletions

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ return PhpCsFixer\Config::create()
88
->setRules(array(
99
'@Symfony' => true,
1010
'concat_space' => array('spacing' => 'one'),
11+
'phpdoc_annotation_without_dot' => false,
1112
))
1213
->setFinder($finder)
1314
;

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ before_script:
3030

3131
script:
3232
- stty cols 120
33-
- if [ "$CS_FIXER" == 1 ]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.1/php-cs-fixer.phar && php php-cs-fixer.phar fix . --dry-run --diff --rules="@Symfony"; fi
33+
- if [ "$CS_FIXER" == 1 ]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.1/php-cs-fixer.phar && php php-cs-fixer.phar fix --dry-run --diff; fi
3434
- mkdir -p build/logs
3535
- ./vendor/bin/phpunit --coverage-clover=coverage.xml
3636

src/HTML5.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function getOptions()
5757
* @param string|resource $file The path to the file to parse. If this is a resource, it is
5858
* assumed to be an open stream whose pointer is set to the first
5959
* byte of input.
60-
* @param array $options Configuration options when parsing the HTML
60+
* @param array $options Configuration options when parsing the HTML.
6161
*
6262
* @return \DOMDocument A DOM document. These object type is defined by the libxml
6363
* library, and should have been included with your version of PHP.
@@ -78,8 +78,8 @@ public function load($file, array $options = array())
7878
* Take a string of HTML 5 (or earlier) and parse it into a
7979
* DOMDocument.
8080
*
81-
* @param string $string A html5 document as a string
82-
* @param array $options Configuration options when parsing the HTML
81+
* @param string $string A html5 document as a string.
82+
* @param array $options Configuration options when parsing the HTML.
8383
*
8484
* @return \DOMDocument A DOM document. DOM is part of libxml, which is included with
8585
* almost all distribtions of PHP.
@@ -98,7 +98,7 @@ public function loadHTML($string, array $options = array())
9898
* @param string $file The path to the file to parse. If this is a resource, it is
9999
* assumed to be an open stream whose pointer is set to the first
100100
* byte of input.
101-
* @param array $options Configuration options when parsing the HTML
101+
* @param array $options Configuration options when parsing the HTML.
102102
*
103103
* @return \DOMDocument A DOM document. These object type is defined by the libxml
104104
* library, and should have been included with your version of PHP.
@@ -170,8 +170,8 @@ public function parse($input, array $options = array())
170170
* Lower-level loading function. This requires an input stream instead
171171
* of a string, file, or resource.
172172
*
173-
* @param string $input the input data to parse in the form of a string
174-
* @param array $options An array of options
173+
* @param string $input The input data to parse in the form of a string.
174+
* @param array $options An array of options.
175175
*
176176
* @return \DOMDocumentFragment
177177
*/
@@ -191,8 +191,8 @@ public function parseFragment($input, array $options = array())
191191
/**
192192
* Save a DOM into a given file as HTML5.
193193
*
194-
* @param mixed $dom The DOM to be serialized
195-
* @param string|resource $file The filename to be written or resource to write to
194+
* @param mixed $dom The DOM to be serialized.
195+
* @param string|resource $file The filename to be written or resource to write to.
196196
* @param array $options Configuration options when serializing the DOM. These include:
197197
* - encode_entities: Text written to the output is escaped by default and not all
198198
* entities are encoded. If this is set to true all entities will be encoded.
@@ -221,13 +221,13 @@ public function save($dom, $file, $options = array())
221221
/**
222222
* Convert a DOM into an HTML5 string.
223223
*
224-
* @param mixed $dom The DOM to be serialized
224+
* @param mixed $dom The DOM to be serialized.
225225
* @param array $options Configuration options when serializing the DOM. These include:
226226
* - encode_entities: Text written to the output is escaped by default and not all
227227
* entities are encoded. If this is set to true all entities will be encoded.
228228
* Defaults to false.
229229
*
230-
* @return string a HTML5 documented generated from the DOM
230+
* @return string A HTML5 documented generated from the DOM.
231231
*/
232232
public function saveHTML($dom, $options = array())
233233
{

src/HTML5/Elements.php

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ class Elements
477477
*
478478
* Elements::isA('script', Elements::TEXT_RCDATA); // Returns false.
479479
*
480-
* @param string $name The element name
481-
* @param int $mask One of the constants on this class
480+
* @param string $name The element name.
481+
* @param int $mask One of the constants on this class.
482482
*
483-
* @return bool true if the element matches the mask, false otherwise
483+
* @return bool true if the element matches the mask, false otherwise.
484484
*/
485485
public static function isA($name, $mask)
486486
{
@@ -490,9 +490,9 @@ public static function isA($name, $mask)
490490
/**
491491
* Test if an element is a valid html5 element.
492492
*
493-
* @param string $name The name of the element
493+
* @param string $name The name of the element.
494494
*
495-
* @return bool true if a html5 element and false otherwise
495+
* @return bool true if a html5 element and false otherwise.
496496
*/
497497
public static function isHtml5Element($name)
498498
{
@@ -504,9 +504,9 @@ public static function isHtml5Element($name)
504504
/**
505505
* Test if an element name is a valid MathML presentation element.
506506
*
507-
* @param string $name The name of the element
507+
* @param string $name The name of the element.
508508
*
509-
* @return bool true if a MathML name and false otherwise
509+
* @return bool true if a MathML name and false otherwise.
510510
*/
511511
public static function isMathMLElement($name)
512512
{
@@ -517,9 +517,9 @@ public static function isMathMLElement($name)
517517
/**
518518
* Test if an element is a valid SVG element.
519519
*
520-
* @param string $name The name of the element
520+
* @param string $name The name of the element.
521521
*
522-
* @return bool true if a SVG element and false otherise
522+
* @return bool true if a SVG element and false otherise.
523523
*/
524524
public static function isSvgElement($name)
525525
{
@@ -529,13 +529,12 @@ public static function isSvgElement($name)
529529

530530
/**
531531
* Is an element name valid in an html5 document.
532-
*
533532
* This includes html5 elements along with other allowed embedded content
534533
* such as svg and mathml.
535534
*
536-
* @param string $name The name of the element
535+
* @param string $name The name of the element.
537536
*
538-
* @return bool true if valid and false otherwise
537+
* @return bool true if valid and false otherwise.
539538
*/
540539
public static function isElement($name)
541540
{
@@ -545,9 +544,9 @@ public static function isElement($name)
545544
/**
546545
* Get the element mask for the given element name.
547546
*
548-
* @param string $name The name of the element
547+
* @param string $name The name of the element.
549548
*
550-
* @return int the element mask
549+
* @return int the element mask.
551550
*/
552551
public static function element($name)
553552
{
@@ -567,9 +566,9 @@ public static function element($name)
567566
/**
568567
* Normalize a SVG element name to its proper case and form.
569568
*
570-
* @param string $name The name of the element
569+
* @param string $name The name of the element.
571570
*
572-
* @return string the normalized form of the element name
571+
* @return string the normalized form of the element name.
573572
*/
574573
public static function normalizeSvgElement($name)
575574
{
@@ -584,9 +583,9 @@ public static function normalizeSvgElement($name)
584583
/**
585584
* Normalize a SVG attribute name to its proper case and form.
586585
*
587-
* @param string $name The name of the attribute
586+
* @param string $name The name of the attribute.
588587
*
589-
* @return string the normalized form of the attribute name
588+
* @return string The normalized form of the attribute name.
590589
*/
591590
public static function normalizeSvgAttribute($name)
592591
{
@@ -600,12 +599,11 @@ public static function normalizeSvgAttribute($name)
600599

601600
/**
602601
* Normalize a MathML attribute name to its proper case and form.
603-
*
604602
* Note, all MathML element names are lowercase.
605603
*
606-
* @param string $name The name of the attribute
604+
* @param string $name The name of the attribute.
607605
*
608-
* @return string the normalized form of the attribute name
606+
* @return string The normalized form of the attribute name.
609607
*/
610608
public static function normalizeMathMlAttribute($name)
611609
{

src/HTML5/InstructionProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ interface InstructionProcessor
2828
* - Making any subsequent modifications to the DOM by modifying the
2929
* DOMElement or its attached DOM tree.
3030
*
31-
* @param \DOMElement $element The parent element for the current processing instruction
31+
* @param \DOMElement $element The parent element for the current processing instruction.
3232
* @param string $name The instruction's name. E.g. `<?php` has the name `php`.
33-
* @param string $data All of the data between the opening and closing PI marks
33+
* @param string $data All of the data between the opening and closing PI marks.
3434
*
3535
* @return \DOMElement The element that should be considered "Current". This may just be
3636
* the element passed in, but if the processor added more elements,

src/HTML5/Parser/CharacterReference.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CharacterReference
2121
/**
2222
* Given a name (e.g. 'amp'), lookup the UTF-8 character ('&').
2323
*
24-
* @param string $name The name to look up
24+
* @param string $name The name to look up.
2525
*
2626
* @return string The character sequence. In UTF-8 this may be more than one byte.
2727
*/

src/HTML5/Parser/DOMTreeBuilder.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -626,19 +626,18 @@ public function processingInstruction($name, $data = null)
626626

627627
/**
628628
* Apply normalization rules to a tag name.
629-
*
630629
* See sections 2.9 and 8.1.2.
631630
*
632-
* @param string $name The tag name
631+
* @param string $tagName
633632
*
634-
* @return string the normalized tag name
633+
* @return string The normalized tag name.
635634
*/
636-
protected function normalizeTagName($name)
635+
protected function normalizeTagName($tagName)
637636
{
638637
/*
639638
* Section 2.9 suggests that we should not do this. if (strpos($name, ':') !== false) { // We know from the grammar that there must be at least one other // char besides :, since : is not a legal tag start. $parts = explode(':', $name); return array_pop($parts); }
640639
*/
641-
return $name;
640+
return $tagName;
642641
}
643642

644643
protected function quirksTreeResolver($name)

src/HTML5/Parser/EventHandler.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ interface EventHandler
3030
/**
3131
* A doctype declaration.
3232
*
33-
* @param string $name The name of the root element
33+
* @param string $name The name of the root element.
3434
* @param int $idType One of DOCTYPE_NONE, DOCTYPE_PUBLIC, or DOCTYPE_SYSTEM
3535
* @param string $id The identifier. For DOCTYPE_PUBLIC, this is the public ID. If DOCTYPE_SYSTEM,
3636
* then this is a system ID.
37-
* @param bool $quirks Indicates whether the builder should enter quirks mode
37+
* @param bool $quirks Indicates whether the builder should enter quirks mode.
3838
*/
3939
public function doctype($name, $idType = 0, $id = null, $quirks = false);
4040

@@ -59,9 +59,9 @@ public function doctype($name, $idType = 0, $id = null, $quirks = false);
5959
* The textmode is automatically reset to Tokenizer::TEXTMODE_NORMAL when the
6060
* closing tag is encounter. **This behavior may change.**
6161
*
62-
* @param string $name The tag name
63-
* @param array $attributes An array with all of the tag's attributes
64-
* @param bool $selfClosing An indicator of whether or not this tag is self-closing (<foo/>)
62+
* @param string $name The tag name.
63+
* @param array $attributes An array with all of the tag's attributes.
64+
* @param bool $selfClosing An indicator of whether or not this tag is self-closing (<foo/>).
6565
*
6666
* @return int one of the Tokenizer::TEXTMODE_* constants
6767
*/
@@ -108,7 +108,7 @@ public function cdata($data);
108108
* While user agents don't get PIs, server-side does.
109109
*
110110
* @param string $name The name of the processor (e.g. 'php').
111-
* @param string $data The unparsed data
111+
* @param string $data The unparsed data.
112112
*/
113113
public function processingInstruction($name, $data = null);
114114
}

src/HTML5/Parser/FileInputStream.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class FileInputStream extends StringInputStream implements InputStream
1919
/**
2020
* Load a file input stream.
2121
*
22-
* @param string $data the file or url path to load
23-
* @param string $encoding the encoding to use for the data
24-
* @param string $debug a fprintf format to use to echo the data on stdout
22+
* @param string $data The file or url path to load.
23+
* @param string $encoding The encoding to use for the data.
24+
* @param string $debug A fprintf format to use to echo the data on stdout.
2525
*/
2626
public function __construct($data, $encoding = 'UTF-8', $debug = '')
2727
{

src/HTML5/Parser/InputStream.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function currentLine();
2929
*
3030
* @TODO Move this to the scanner.
3131
*
32-
* @return int the column number
32+
* @return int The column number.
3333
*/
3434
public function columnOffset();
3535

@@ -50,8 +50,8 @@ public function remainingChars();
5050
*
5151
* @see strcspn
5252
*
53-
* @param string $bytes Bytes to match
54-
* @param int $max Maximum number of bytes to scan
53+
* @param string $bytes Bytes to match.
54+
* @param int $max Maximum number of bytes to scan.
5555
*
5656
* @return mixed Index or false if no match is found. You should use strong
5757
* equality when checking the result, since index could be 0.
@@ -69,14 +69,14 @@ public function charsUntil($bytes, $max = null);
6969
* @param string $bytes A mask of bytes to match. If ANY byte in this mask matches the
7070
* current char, the pointer advances and the char is part of the
7171
* substring.
72-
* @param int $max The max number of chars to read
72+
* @param int $max The max number of chars to read.
7373
*/
7474
public function charsWhile($bytes, $max = null);
7575

7676
/**
7777
* Unconsume one character.
7878
*
79-
* @param int $howMany The number of characters to move the pointer back
79+
* @param int $howMany The number of characters to move the pointer back.
8080
*/
8181
public function unconsume($howMany = 1);
8282

0 commit comments

Comments
 (0)