Skip to content

Commit

Permalink
Fix grammar + CS fix of doc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Imangazaliev committed May 12, 2020
1 parent aecdb61 commit c2a8bd0
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 121 deletions.
2 changes: 1 addition & 1 deletion src/DiDom/ClassAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ClassAttribute
/**
* @param Element $element
*
* @throws InvalidArgumentException if passed argument is not an element node
* @throws InvalidArgumentException if parameter 1 is not an element node
*/
public function __construct(Element $element)
{
Expand Down
97 changes: 49 additions & 48 deletions src/DiDom/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Document
* @const string
*/
const TYPE_HTML = 'html';
const TYPE_XML = 'xml';
const TYPE_XML = 'xml';

/**
* @var DOMDocument
Expand All @@ -41,12 +41,12 @@ class Document
protected $encoding;

/**
* @param string|null $string An HTML or XML string or a file path
* @param bool $isFile Indicates that the first parameter is a path to a file
* @param string $encoding The document encoding
* @param string $type The document type
* @param string|null $string An HTML or XML string or a file path
* @param bool $isFile Indicates that the first parameter is a path to a file
* @param string $encoding The document encoding
* @param string $type The document type
*
* @throws InvalidArgumentException if the passed encoding is not a string
* @throws InvalidArgumentException if parameter 3 is not a string
*/
public function __construct($string = null, $isFile = false, $encoding = 'UTF-8', $type = Document::TYPE_HTML)
{
Expand Down Expand Up @@ -74,10 +74,10 @@ public function __construct($string = null, $isFile = false, $encoding = 'UTF-8'
/**
* Creates a new document.
*
* @param string|null $string An HTML or XML string or a file path
* @param bool $isFile Indicates that the first parameter is a path to a file
* @param string $encoding The document encoding
* @param string $type The document type
* @param string|null $string An HTML or XML string or a file path
* @param bool $isFile Indicates that the first parameter is a path to a file
* @param string $encoding The document encoding
* @param string $type The document type
*
* @return Document
*/
Expand All @@ -89,9 +89,9 @@ public static function create($string = null, $isFile = false, $encoding = 'UTF-
/**
* Creates a new element node.
*
* @param string $name The tag name of the element
* @param string|null $value The value of the element
* @param array $attributes The attributes of the element
* @param string $name The tag name of the element
* @param string|null $value The value of the element
* @param array $attributes The attributes of the element
*
* @return Element created element
*/
Expand All @@ -105,9 +105,9 @@ public function createElement($name, $value = null, array $attributes = [])
/**
* Creates a new element node by CSS selector.
*
* @param string $selector
* @param string $selector
* @param string|null $value
* @param array $attributes
* @param array $attributes
*
* @return Element
*
Expand Down Expand Up @@ -179,7 +179,7 @@ public function createDocumentFragment()
*
* @return Element|Element[]
*
* @throws InvalidArgumentException if the passed argument is not an instance of DOMNode or Element
* @throws InvalidArgumentException if one of elements of parameter 1 is not an instance of DOMNode or Element
*/
public function appendChild($nodes)
{
Expand Down Expand Up @@ -240,16 +240,17 @@ public function preserveWhiteSpace($value = true)
/**
* Load HTML or XML.
*
* @param string $string HTML or XML string or file path
* @param bool $isFile Indicates that in first parameter was passed to the file path
* @param string $type Type of the document
* @param int|null $options Additional parameters
* @param string $string An HTML or XML string or a file path
* @param bool $isFile Indicates that the first parameter is a file path
* @param string $type The type of a document
* @param int|null $options libxml option constants
*
* @return Document
*
* @throws InvalidArgumentException if first parameter is not a string
* @throws InvalidArgumentException if document type parameter is not a string
* @throws RuntimeException if document type is not HTML or XML
* @throws InvalidArgumentException if parameter 1 is not a string
* @throws InvalidArgumentException if parameter 3 is not a string
* @throws InvalidArgumentException if parameter 4 is not an integer or null
* @throws RuntimeException if the document type is invalid (not Document::TYPE_HTML or Document::TYPE_XML)
*/
public function load($string, $isFile = false, $type = Document::TYPE_HTML, $options = null)
{
Expand Down Expand Up @@ -302,12 +303,12 @@ public function load($string, $isFile = false, $type = Document::TYPE_HTML, $opt
/**
* Load HTML from a string.
*
* @param string $html The HTML string
* @param string $html The HTML string
* @param int|null $options Additional parameters
*
* @return Document
*
* @throws InvalidArgumentException if the provided argument is not a string
* @throws InvalidArgumentException if parameter 1 is not a string
*/
public function loadHtml($html, $options = null)
{
Expand All @@ -317,13 +318,13 @@ public function loadHtml($html, $options = null)
/**
* Load HTML from a file.
*
* @param string $filename The path to the HTML file
* @param int|null $options Additional parameters
* @param string $filename The path to the HTML file
* @param int|null $options Additional parameters
*
* @return Document
*
* @throws InvalidArgumentException if the file path is not a string
* @throws RuntimeException if the file does not exist
* @throws InvalidArgumentException if parameter 1 not a string
* @throws RuntimeException if the file doesn't exist
* @throws RuntimeException if you are unable to load the file
*/
public function loadHtmlFile($filename, $options = null)
Expand All @@ -334,12 +335,12 @@ public function loadHtmlFile($filename, $options = null)
/**
* Load XML from a string.
*
* @param string $xml The XML string
* @param string $xml The XML string
* @param int|null $options Additional parameters
*
* @return Document
*
* @throws InvalidArgumentException if the provided argument is not a string
* @throws InvalidArgumentException if parameter 1 is not a string
*/
public function loadXml($xml, $options = null)
{
Expand All @@ -349,13 +350,13 @@ public function loadXml($xml, $options = null)
/**
* Load XML from a file.
*
* @param string $filename The path to the XML file
* @param int|null $options Additional parameters
* @param string $filename The path to the XML file
* @param int|null $options Additional parameters
*
* @return Document
*
* @throws InvalidArgumentException if the file path is not a string
* @throws RuntimeException if the file does not exist
* @throws RuntimeException if the file doesn't exist
* @throws RuntimeException if you are unable to load the file
*/
public function loadXmlFile($filename, $options = null)
Expand All @@ -370,7 +371,7 @@ public function loadXmlFile($filename, $options = null)
*
* @return string
*
* @throws InvalidArgumentException if the file path is not a string
* @throws InvalidArgumentException if parameter 1 is not a string
* @throws RuntimeException if an error occurred
*/
protected function loadFile($filename)
Expand Down Expand Up @@ -411,9 +412,9 @@ public function has($expression, $type = Query::TYPE_CSS)
/**
* Searches for an node in the DOM tree for a given XPath expression or a CSS selector.
*
* @param string $expression XPath expression or a CSS selector
* @param string $type The type of the expression
* @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement
* @param string $expression XPath expression or a CSS selector
* @param string $type The type of the expression
* @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement
* @param DOMElement|null $contextNode The node in which the search will be performed
*
* @return Element[]|DOMElement[]
Expand Down Expand Up @@ -459,9 +460,9 @@ public function find($expression, $type = Query::TYPE_CSS, $wrapNode = true, $co
/**
* Searches for an node in the DOM tree and returns first element or null.
*
* @param string $expression XPath expression or a CSS selector
* @param string $type The type of the expression
* @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement
* @param string $expression XPath expression or a CSS selector
* @param string $type The type of the expression
* @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement
* @param DOMElement|null $contextNode The node in which the search will be performed
*
* @return Element|DOMElement|null
Expand Down Expand Up @@ -492,7 +493,7 @@ public function first($expression, $type = Query::TYPE_CSS, $wrapNode = true, $c
*
* @return Element|string
*
* @throws InvalidArgumentException if node is not DOMElement, DOMText, DOMComment, DOMCdataSection or DOMAttr
* @throws InvalidArgumentException if parameter 1 is not an instance of DOMElement, DOMText, DOMComment, DOMCdataSection or DOMAttr
*/
protected function wrapNode($node)
{
Expand All @@ -515,8 +516,8 @@ protected function wrapNode($node)
/**
* Searches for a node in the DOM tree for a given XPath expression.
*
* @param string $expression XPath expression
* @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement
* @param string $expression XPath expression
* @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement
* @param DOMElement $contextNode The node in which the search will be performed
*
* @return Element[]|DOMElement[]
Expand Down Expand Up @@ -614,7 +615,7 @@ public function text()
*
* @return bool
*
* @throws InvalidArgumentException if the provided argument is not an instance of DOMDocument or Document
* @throws InvalidArgumentException if parameter 1 is not an instance of DOMDocument or Document
*/
public function is($document)
{
Expand Down Expand Up @@ -696,9 +697,9 @@ public function __toString()
/**
* Searches for an node in the DOM tree for a given XPath expression or a CSS selector.
*
* @param string $expression XPath expression or a CSS selector
* @param string $type The type of the expression
* @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement
* @param string $expression XPath expression or a CSS selector
* @param string $type The type of the expression
* @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement
* @param DOMElement|null $contextNode The node in which the search will be performed
*
* @return Element[]|DOMElement[]
Expand Down
38 changes: 19 additions & 19 deletions src/DiDom/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Element extends Node
protected $styleAttribute;

/**
* @param DOMElement|DOMText|DOMComment|DOMCdataSection|string $tagName The tag name of the element
* @param string|null $value The value of the element
* @param array $attributes The attributes of the element
* @param DOMElement|DOMText|DOMComment|DOMCdataSection|string $tagName The tag name of an element
* @param string|null $value The value of an element
* @param array $attributes The attributes of an element
*/
public function __construct($tagName, $value = null, array $attributes = [])
{
Expand All @@ -57,9 +57,9 @@ public function __construct($tagName, $value = null, array $attributes = [])
/**
* Creates a new element.
*
* @param DOMNode|string $name The tag name of the element
* @param string|null $value The value of the element
* @param array $attributes The attributes of the element
* @param DOMNode|string $name The tag name of an element
* @param string|null $value The value of an element
* @param array $attributes The attributes of an element
*
* @return Element
*/
Expand Down Expand Up @@ -170,7 +170,7 @@ public function matches($selector, $strict = false)
/**
* Determine if an attribute exists on the element.
*
* @param string $name The attribute name
* @param string $name The name of an attribute
*
* @return bool
*/
Expand All @@ -182,8 +182,8 @@ public function hasAttribute($name)
/**
* Set an attribute on the element.
*
* @param string $name The attribute name
* @param string $value The attribute value
* @param string $name The name of an attribute
* @param string $value The value of an attribute
*
* @return Element
*/
Expand All @@ -205,10 +205,10 @@ public function setAttribute($name, $value)
/**
* Access to the element's attributes.
*
* @param string $name The attribute name
* @param string|null $default The value returned if the attribute does not exist
* @param string $name The name of an attribute
* @param string|null $default The value returned if the attribute doesn't exist
*
* @return string|null The value of the attribute or null if attribute does not exist
* @return string|null The value of an attribute or null if attribute doesn't exist
*/
public function getAttribute($name, $default = null)
{
Expand All @@ -222,7 +222,7 @@ public function getAttribute($name, $default = null)
/**
* Unset an attribute on the element.
*
* @param string $name The attribute name
* @param string $name The name of an attribute
*
* @return Element
*/
Expand Down Expand Up @@ -260,8 +260,8 @@ public function removeAllAttributes(array $exclusions = [])
/**
* Alias for getAttribute and setAttribute methods.
*
* @param string $name The attribute name
* @param string|null $value The attribute value or null if the attribute does not exist
* @param string $name The name of an attribute
* @param string|null $value The value that will be returned an attribute doesn't exist
*
* @return string|null|Element
*/
Expand Down Expand Up @@ -351,8 +351,8 @@ public function style()
/**
* Dynamically set an attribute on the element.
*
* @param string $name The attribute name
* @param mixed $value The attribute value
* @param string $name The name of an attribute
* @param string $value The value of an attribute
*
* @return Element
*/
Expand All @@ -364,7 +364,7 @@ public function __set($name, $value)
/**
* Dynamically access the element's attributes.
*
* @param string $name The attribute name
* @param string $name The name of an attribute
*
* @return string|null
*/
Expand Down Expand Up @@ -392,7 +392,7 @@ public function __isset($name)
/**
* Unset an attribute on the model.
*
* @param string $name The attribute name
* @param string $name The name of an attribute
*/
public function __unset($name)
{
Expand Down
Loading

0 comments on commit c2a8bd0

Please sign in to comment.