Skip to content

fix: Implicitly marked parameters as nullable is deprecated in PHP 8.4 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/HtaccessContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function setIgnoreWhiteLines(bool $ignoreWhiteLines): static
* @param bool $deepSearch [optional] If the search should be multidimensional. Default is true
* @return null|TokenInterface Returns the Token or null if none is found
*/
public function search(string $name, int $type = null, bool $deepSearch = true): ?TokenInterface
public function search(string $name, ?int $type = null, bool $deepSearch = true): ?TokenInterface
{
/** @var TokenInterface[] $array */
$array = $this->getArrayCopy();
Expand Down Expand Up @@ -171,13 +171,13 @@ private function deepSearch(Block $parent, string $name, int|null $type): ?Token
}

/**
* Search this object for a Token with specific name and return the index(key) of the first match
* Search this object for a Token with a specific name and return the index(key) of the first match
*
* @param string $name [required] Name of the token
* @param int|null $type [optional] TOKEN_DIRECTIVE | TOKEN_BLOCK
* @return int|null Returns the index or null if Token is not found
*/
public function getIndex(string $name, int $type = null): ?int
public function getIndex(string $name, ?int $type = null): ?int
{
/** @var TokenInterface[] $array */
$array = $this->getArrayCopy();
Expand Down Expand Up @@ -227,7 +227,7 @@ public function jsonSerialize(): array
* @return string
*@api
*/
public function txtSerialize(int $indentation = null, bool $ignoreWhiteLines = null, bool $ignoreComments = false): string
public function txtSerialize(?int $indentation = null, ?bool $ignoreWhiteLines = null, bool $ignoreComments = false): string
{
/** @var TokenInterface[] $array */
$array = $this->getArrayCopy();
Expand Down Expand Up @@ -363,7 +363,7 @@ public function insertAt(int $offset, TokenInterface $token): static
*
* @return array Returns the array consisting of the extracted elements.
*/
public function splice(int $offset, int $length = null, ArrayAccess|array $replacement = array()): array
public function splice(int $offset, ?int $length = null, ArrayAccess|array $replacement = array()): array
{
$array = $this->getArrayCopy();
$spliced = array_splice($array, $offset, $length, $replacement);
Expand Down
4 changes: 2 additions & 2 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function setMode(int $mode): static
* @throws SyntaxException
* @api
*/
public function parse(SplFileObject $file = null, int|null $optFlags = null, bool|null $rewind = null): HtaccessContainer|ArrayAccess|array
public function parse(?SplFileObject $file = null, int|null $optFlags = null, bool|null $rewind = null): HtaccessContainer|ArrayAccess|array
{
//Prepare passed options
$file = ($file !== null) ? $file : $this->file;
Expand Down Expand Up @@ -347,7 +347,7 @@ protected function isBlock(string $line): bool
* @param string|null $blockName [optional] The block's name
* @return bool
*/
protected function isBlockEnd(string $line, string $blockName = null): bool
protected function isBlockEnd(string $line, ?string $blockName = null): bool
{
$line = trim($line);
$pattern = '/^\<\/';
Expand Down
2 changes: 1 addition & 1 deletion src/Token/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Block extends BaseToken implements IteratorAggregate, ArrayAccess, Countab
* @param string $blockName [optional] The name of the block
* @param string|null $argument [optional] The argument of the block
*/
public function __construct(string $blockName = 'blockName', string $argument = null)
public function __construct(string $blockName = 'blockName', ?string $argument = null)
{
$this->setName($blockName);

Expand Down