Skip to content

Commit

Permalink
Fixed missing null definition in method argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
hexydec committed Nov 25, 2024
1 parent aec95fe commit eada6f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(array $config = []) {
case 'style':
$obj = new \hexydec\css\cssdoc();
break;
case 'script':
case 'script':
$obj = new \hexydec\jslite\jslite();
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/htmldoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function open(string $url, $context = null, ?string &$error = null) : str
* @param ?string &$error A reference to any user error that is generated
* @return bool Whether the input HTML was parsed
*/
public function load(string $html, string $charset = null, ?string &$error = null) : bool {
public function load(string $html, ?string $charset = null, ?string &$error = null) : bool {

// detect the charset
if ($charset || ($charset = $this->getCharsetFromHtml($html)) !== null) {
Expand Down Expand Up @@ -343,7 +343,7 @@ public function cache(string $key, array $values) : void {
* @param int $index The index of the child tag to retrieve
* @return tag|array|null A tag object if index is specified, or an array of tag objects, or null if the specified index doesn't exist or the object is empty
*/
public function get(int $index = null) : tag|array|null {
public function get(?int $index = null) : tag|array|null {

// build children that are tags
$children = [];
Expand Down
4 changes: 2 additions & 2 deletions src/tokens/tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class tag implements token {
* @param string $tag The HTML tag this object will represent
* @param tag $parent The parent tag object
*/
public function __construct(htmldoc $root, string $tag = null, tag $parent = null) {
public function __construct(htmldoc $root, ?string $tag = null, ?tag $parent = null) {
$this->root = $root;
$this->tagName = $tag;
$this->parent = $parent;
Expand Down Expand Up @@ -300,7 +300,7 @@ public function parent() : ?tag {
* @param int $index To insert the nodes at a particular position, set the index
* @return void
*/
public function append(array $nodes, int $index = null) : void {
public function append(array $nodes, ?int $index = null) : void {

// reset the index if it doesn't exist
if ($index !== null && !isset($this->children[$index])) {
Expand Down

0 comments on commit eada6f0

Please sign in to comment.