Skip to content

Commit 34622a7

Browse files
committed
Added typed properties.
Removed support for PHP 7.3. Updated dependencies.
1 parent 090d6dd commit 34622a7

File tree

8 files changed

+78
-76
lines changed

8 files changed

+78
-76
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
],
1313
"minimum-stability": "stable",
1414
"require": {
15-
"php": ">=7.3",
16-
"hexydec/tokenise": "0.4.2",
17-
"hexydec/cssdoc": "0.5.3",
18-
"hexydec/jslite": "0.5.5"
15+
"php": ">=7.4",
16+
"hexydec/tokenise": "1.0.0",
17+
"hexydec/cssdoc": "1.0.1",
18+
"hexydec/jslite": "0.5.6"
1919
},
2020
"autoload": {
2121
"classmap": ["src/"]

composer.lock

Lines changed: 45 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/htmldoc.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class htmldoc extends config implements \ArrayAccess, \Iterator {
88
/**
99
* @var array $tokens Regexp components keyed by their corresponding codename for tokenising HTML
1010
*/
11-
protected static $tokens = [
11+
protected static array $tokens = [
1212
'textnode' => '(?<=>|^)[^<]++(?=<|$)',
1313
'attributevalue' => '\\s*+=\\s*+(?:"[^"]*+"++|\'[^\']*+\'++|[^\\s>]*+)',
1414
'attribute' => '\\s*+[^<>"\'\\/=\\s]++',
@@ -26,7 +26,7 @@ class htmldoc extends config implements \ArrayAccess, \Iterator {
2626
/**
2727
* @var array $selectors Regexp components keyed by their corresponding codename for tokenising CSS selectors
2828
*/
29-
protected static $selectors = [
29+
protected static array $selectors = [
3030
'quotes' => '(?<!\\\\)"(?:[^"\\\\]++|\\\\.)*+"',
3131
'join' => '\\s*[>+~]\\s*',
3232
'comparison' => '[\\^*$<>]?=', // comparison operators for media queries or attribute selectors
@@ -45,17 +45,17 @@ class htmldoc extends config implements \ArrayAccess, \Iterator {
4545
/**
4646
* @var array $children Stores the regexp components keyed by their corresponding codename for tokenising CSS selectors
4747
*/
48-
protected $children = [];
48+
protected array $children = [];
4949

5050
/**
5151
* @var int $pointer The current pointer position for the array iterator
5252
*/
53-
protected $pointer = 0;
53+
protected int $pointer = 0;
5454

5555
/**
5656
* @var array A cache of attribute and class names for sorting
5757
*/
58-
protected $cache = [];
58+
protected array $cache = [];
5959

6060
/**
6161
* Calculates the length property
@@ -88,8 +88,11 @@ public function toArray() : array {
8888
* @param mixed $value The value of the array key in the children array to be updated
8989
*/
9090
public function offsetSet($i, $value) : void {
91-
if (\is_null($i)) $this->children[] = $value;
92-
else $this->children[$i] = $value;
91+
if (\is_null($i)) {
92+
$this->children[] = $value;
93+
} else {
94+
$this->children[$i] = $value;
95+
}
9396
}
9497

9598
/**

src/tokens/comment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class comment implements token {
88
/**
99
* @var string The text content of this object
1010
*/
11-
protected $content = null;
11+
protected ?string $content = null;
1212

1313
/**
1414
* Constructs the comment object

src/tokens/custom.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ class custom implements token {
88
/**
99
* @var array The custom configuration
1010
*/
11-
protected $config = [];
11+
protected array $config = [];
1212

1313
/**
14-
* @var array The name of the tag
14+
* @var string The name of the tag
1515
*/
16-
protected $tagName;
16+
protected string $tagName;
1717

1818
/**
1919
* @var string A string containing javascript
2020
*/
21-
protected $content = '';
21+
protected string $content = '';
2222

2323
/**
2424
* Constructs the script object

src/tokens/doctype.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class doctype implements token {
88
/**
99
* @var array The text content of this object
1010
*/
11-
protected $content = [];
11+
protected array $content = [];
1212

1313
/**
1414
* Constructs the script object

0 commit comments

Comments
 (0)