Skip to content

Commit

Permalink
[PHP 8.4] Fixes for implicit nullability deprecation (#5)
Browse files Browse the repository at this point in the history
Fixes all issues that emits a deprecation notice on PHP 8.4.

See:
 - [RFC](https://wiki.php.net/rfc/deprecate-implicitly-nullable-types)
 - [PHP 8.4: Implicitly nullable parameter declarations deprecated](https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated)
  • Loading branch information
Ayesh authored Mar 15, 2024
1 parent c0521cb commit 8286a62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ClassMapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __construct(array $extensions = ['php', 'inc'])
*
* @return $this
*/
public function avoidDuplicateScans(FileList $scannedFiles = null): self
public function avoidDuplicateScans(?FileList $scannedFiles = null): self
{
$this->scannedFiles = $scannedFiles ?? new FileList;

Expand Down Expand Up @@ -100,7 +100,7 @@ public function getClassMap(): ClassMap
*
* @throws \RuntimeException When the path is neither an existing file nor directory
*/
public function scanPaths($path, string $excluded = null, string $autoloadType = 'classmap', ?string $namespace = null): void
public function scanPaths($path, ?string $excluded = null, string $autoloadType = 'classmap', ?string $namespace = null): void
{
if (!in_array($autoloadType, ['psr-0', 'psr-4', 'classmap'], true)) {
throw new \InvalidArgumentException('$autoloadType must be one of: "psr-0", "psr-4" or "classmap"');
Expand Down
2 changes: 1 addition & 1 deletion src/PhpFileCleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private function peek(string $char): bool
* @param null|array<mixed> $match
* @param-out array<int|string, string> $match
*/
private function match(string $regex, array &$match = null): bool
private function match(string $regex, ?array &$match = null): bool
{
return Preg::isMatchStrictGroups($regex, $this->contents, $match, 0, $this->index);
}
Expand Down

0 comments on commit 8286a62

Please sign in to comment.