-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This was revealed by PHPStan.
- Loading branch information
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,28 +32,35 @@ | |
* @package UniversalFeedWriter | ||
* @author Anis uddin Ahmad <[email protected]> | ||
* @link http://www.ajaxray.com/projects/rss | ||
* @phpstan-type Element array{name: string, content: string, attributes: array<string, string>} | ||
*/ | ||
class Item | ||
{ | ||
/** | ||
* Collection of feed item elements | ||
* | ||
* @var array<string, Element> | ||
*/ | ||
private $elements = array(); | ||
|
||
/** | ||
* Contains the format of this feed. | ||
* | ||
* @var Feed::RSS1|Feed::RSS2|Feed::ATOM | ||
*/ | ||
private $version; | ||
|
||
/** | ||
* Is used as a suffix when multiple elements have the same name. | ||
* | ||
* @var int | ||
**/ | ||
private $_cpt = 0; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param string $version constant (RSS1/RSS2/ATOM) RSS2 is default. | ||
* @param Feed::RSS1|Feed::RSS2|Feed::ATOM $version constant (RSS1/RSS2/ATOM) RSS2 is default. | ||
*/ | ||
public function __construct($version = Feed::RSS2) | ||
{ | ||
|
@@ -77,7 +84,7 @@ private function cpt() | |
* @access public | ||
* @param string $elementName The tag name of an element | ||
* @param string $content The content of tag | ||
* @param array $attributes Attributes (if any) in 'attrName' => 'attrValue' format | ||
* @param array<string, string> $attributes Attributes (if any) in 'attrName' => 'attrValue' format | ||
* @param boolean $overwrite Specifies if an already existing element is overwritten. | ||
* @param boolean $allowMultiple Specifies if multiple elements of the same name are allowed. | ||
* @return self | ||
|
@@ -113,7 +120,7 @@ public function addElement($elementName, $content, array $attributes = null, $ov | |
* Elements which have attributes cannot be added by this method | ||
* | ||
* @access public | ||
* @param array array of elements in 'tagName' => 'tagContent' format. | ||
* @param array<string, string> array of elements in 'tagName' => 'tagContent' format. | ||
* @return self | ||
*/ | ||
public function addElementArray(array $elementArray) | ||
|
@@ -129,7 +136,7 @@ public function addElementArray(array $elementArray) | |
* Return the collection of elements in this feed item | ||
* | ||
* @access public | ||
* @return array All elements of this item. | ||
* @return array<string, Element> All elements of this item. | ||
* @throws InvalidOperationException on ATOM feeds if either a content or link element is missing. | ||
* @throws InvalidOperationException on RSS1 feeds if a title or link element is missing. | ||
*/ | ||
|