Skip to content

Commit

Permalink
fixed #229 - Added documentation to reflect read only property
Browse files Browse the repository at this point in the history
  • Loading branch information
paquettg committed Aug 23, 2020
1 parent cf0bb68 commit 77a7eb1
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ return PhpCsFixer\Config::create()
'method',
'param',
'property',
'property-read',
'return',
'throws',
'type',
Expand All @@ -100,7 +101,7 @@ return PhpCsFixer\Config::create()
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_no_alias_tag' => false,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
Expand Down
13 changes: 6 additions & 7 deletions src/PHPHtmlParser/Dom/Node/AbstractNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
/**
* Dom node object.
*
* @property string $outerhtml
* @property string $innerhtml
* @property string $text
* @property int $prev
* @property int $next
* @property Tag $tag
* @property InnerNode $parent
* @property-read string $outerhtml
* @property-read string $innerhtml
* @property-read string $innerText
* @property-read string $text
* @property-read Tag $tag
* @property-read InnerNode $parent
*/
abstract class AbstractNode
{
Expand Down
8 changes: 8 additions & 0 deletions src/PHPHtmlParser/Dom/Node/ArrayNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@
use ArrayIterator;
use Countable;
use IteratorAggregate;
use PHPHtmlParser\Dom\Tag;

/**
* Dom node object which will allow users to use it as
* an array.
*
* @property-read string $outerhtml
* @property-read string $innerhtml
* @property-read string $innerText
* @property-read string $text
* @property-read Tag $tag
* @property-read InnerNode $parent
*/
abstract class ArrayNode extends AbstractNode implements IteratorAggregate, Countable
{
Expand Down
7 changes: 7 additions & 0 deletions src/PHPHtmlParser/Dom/Node/HtmlNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

/**
* Class HtmlNode.
*
* @property-read string $outerhtml
* @property-read string $innerhtml
* @property-read string $innerText
* @property-read string $text
* @property-read Tag $tag
* @property-read InnerNode $parent
*/
class HtmlNode extends InnerNode
{
Expand Down
8 changes: 8 additions & 0 deletions src/PHPHtmlParser/Dom/Node/InnerNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@

namespace PHPHtmlParser\Dom\Node;

use PHPHtmlParser\Dom\Tag;
use PHPHtmlParser\Exceptions\ChildNotFoundException;
use PHPHtmlParser\Exceptions\CircularException;
use PHPHtmlParser\Exceptions\LogicalException;
use stringEncode\Encode;

/**
* Inner node of the html tree, might have children.
*
* @property-read string $outerhtml
* @property-read string $innerhtml
* @property-read string $innerText
* @property-read string $text
* @property-read Tag $tag
* @property-read InnerNode $parent
*/
abstract class InnerNode extends ArrayNode
{
Expand Down
9 changes: 9 additions & 0 deletions src/PHPHtmlParser/Dom/Node/LeafNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@

namespace PHPHtmlParser\Dom\Node;

use PHPHtmlParser\Dom\Tag;

/**
* Class LeafNode.
*
* @property-read string $outerhtml
* @property-read string $innerhtml
* @property-read string $innerText
* @property-read string $text
* @property-read Tag $tag
* @property-read InnerNode $parent
*/
abstract class LeafNode extends AbstractNode
{
Expand Down
7 changes: 7 additions & 0 deletions src/PHPHtmlParser/Dom/Node/TextNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

/**
* Class TextNode.
*
* @property-read string $outerhtml
* @property-read string $innerhtml
* @property-read string $innerText
* @property-read string $text
* @property-read Tag $tag
* @property-read InnerNode $parent
*/
class TextNode extends LeafNode
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Node/HtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public function testInnerText()

$node->addChild($anode);
$node->addChild($span_node);
$this->assertEquals($node->innerText(), '123 456789 101112');
$this->assertEquals($node->innerText, '123 456789 101112');
}

public function testTextLookInChildrenAndNoChildren()
Expand Down

0 comments on commit 77a7eb1

Please sign in to comment.