Skip to content

Commit 77a7eb1

Browse files
committed
fixed paquettg#229 - Added documentation to reflect read only property
1 parent cf0bb68 commit 77a7eb1

File tree

8 files changed

+48
-9
lines changed

8 files changed

+48
-9
lines changed

Diff for: .php_cs.dist

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ return PhpCsFixer\Config::create()
9090
'method',
9191
'param',
9292
'property',
93+
'property-read',
9394
'return',
9495
'throws',
9596
'type',
@@ -100,7 +101,7 @@ return PhpCsFixer\Config::create()
100101
'phpdoc_indent' => true,
101102
'phpdoc_inline_tag' => true,
102103
'phpdoc_no_access' => true,
103-
'phpdoc_no_alias_tag' => true,
104+
'phpdoc_no_alias_tag' => false,
104105
'phpdoc_no_package' => true,
105106
'phpdoc_no_useless_inheritdoc' => true,
106107
'phpdoc_order' => true,

Diff for: src/PHPHtmlParser/Dom/Node/AbstractNode.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
/**
1818
* Dom node object.
1919
*
20-
* @property string $outerhtml
21-
* @property string $innerhtml
22-
* @property string $text
23-
* @property int $prev
24-
* @property int $next
25-
* @property Tag $tag
26-
* @property InnerNode $parent
20+
* @property-read string $outerhtml
21+
* @property-read string $innerhtml
22+
* @property-read string $innerText
23+
* @property-read string $text
24+
* @property-read Tag $tag
25+
* @property-read InnerNode $parent
2726
*/
2827
abstract class AbstractNode
2928
{

Diff for: src/PHPHtmlParser/Dom/Node/ArrayNode.php

+8
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
use ArrayIterator;
88
use Countable;
99
use IteratorAggregate;
10+
use PHPHtmlParser\Dom\Tag;
1011

1112
/**
1213
* Dom node object which will allow users to use it as
1314
* an array.
15+
*
16+
* @property-read string $outerhtml
17+
* @property-read string $innerhtml
18+
* @property-read string $innerText
19+
* @property-read string $text
20+
* @property-read Tag $tag
21+
* @property-read InnerNode $parent
1422
*/
1523
abstract class ArrayNode extends AbstractNode implements IteratorAggregate, Countable
1624
{

Diff for: src/PHPHtmlParser/Dom/Node/HtmlNode.php

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
/**
1212
* Class HtmlNode.
13+
*
14+
* @property-read string $outerhtml
15+
* @property-read string $innerhtml
16+
* @property-read string $innerText
17+
* @property-read string $text
18+
* @property-read Tag $tag
19+
* @property-read InnerNode $parent
1320
*/
1421
class HtmlNode extends InnerNode
1522
{

Diff for: src/PHPHtmlParser/Dom/Node/InnerNode.php

+8
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@
44

55
namespace PHPHtmlParser\Dom\Node;
66

7+
use PHPHtmlParser\Dom\Tag;
78
use PHPHtmlParser\Exceptions\ChildNotFoundException;
89
use PHPHtmlParser\Exceptions\CircularException;
910
use PHPHtmlParser\Exceptions\LogicalException;
1011
use stringEncode\Encode;
1112

1213
/**
1314
* Inner node of the html tree, might have children.
15+
*
16+
* @property-read string $outerhtml
17+
* @property-read string $innerhtml
18+
* @property-read string $innerText
19+
* @property-read string $text
20+
* @property-read Tag $tag
21+
* @property-read InnerNode $parent
1422
*/
1523
abstract class InnerNode extends ArrayNode
1624
{

Diff for: src/PHPHtmlParser/Dom/Node/LeafNode.php

+9
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@
44

55
namespace PHPHtmlParser\Dom\Node;
66

7+
use PHPHtmlParser\Dom\Tag;
8+
79
/**
810
* Class LeafNode.
11+
*
12+
* @property-read string $outerhtml
13+
* @property-read string $innerhtml
14+
* @property-read string $innerText
15+
* @property-read string $text
16+
* @property-read Tag $tag
17+
* @property-read InnerNode $parent
918
*/
1019
abstract class LeafNode extends AbstractNode
1120
{

Diff for: src/PHPHtmlParser/Dom/Node/TextNode.php

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
/**
1111
* Class TextNode.
12+
*
13+
* @property-read string $outerhtml
14+
* @property-read string $innerhtml
15+
* @property-read string $innerText
16+
* @property-read string $text
17+
* @property-read Tag $tag
18+
* @property-read InnerNode $parent
1219
*/
1320
class TextNode extends LeafNode
1421
{

Diff for: tests/Node/HtmlTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public function testInnerText()
334334

335335
$node->addChild($anode);
336336
$node->addChild($span_node);
337-
$this->assertEquals($node->innerText(), '123 456789 101112');
337+
$this->assertEquals($node->innerText, '123 456789 101112');
338338
}
339339

340340
public function testTextLookInChildrenAndNoChildren()

0 commit comments

Comments
 (0)