Skip to content

Commit 0fff1c3

Browse files
authored
Explicit nullable type hint for PHP 8.4 (#34)
Avoid E_DEPRECATED warnings
1 parent 820db58 commit 0fff1c3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/NodeVisitor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ function (\PhpParser\Node\Const_ $const) {
426426
* @return bool If true, this is the first declaration of this type with
427427
* this name, so it can be safely included.
428428
*/
429-
private function count(string $type, string $name = null): bool
429+
private function count(string $type, ?string $name = null): bool
430430
{
431431
assert(isset($this->counts[$type]), 'Expected valid `$type`');
432432

src/Result.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function getDuplicates(): array
105105
*
106106
* @return string The pretty printed version.
107107
*/
108-
public function prettyPrint(PrettyPrinterAbstract $printer = null): string
108+
public function prettyPrint(?PrettyPrinterAbstract $printer = null): string
109109
{
110110
if (!$printer) {
111111
$printer = new Standard();

src/StubsGenerator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ public function __construct(int $symbols = self::DEFAULT, array $config = [])
106106
* pretty-printed stubs.
107107
*
108108
* @param Finder $finder The set of files to generate (merged) stubs for.
109-
* @param NodeVisitor $visitor The optional node visitor to override the default.
109+
* @param NodeVisitor|null $visitor The optional node visitor to override the default.
110110
*
111111
* @return Result
112112
*/
113-
public function generate(Finder $finder, NodeVisitor $visitor = null): Result
113+
public function generate(Finder $finder, ?NodeVisitor $visitor = null): Result
114114
{
115115
$parser = (new ParserFactory())->createForNewestSupportedVersion();
116116

0 commit comments

Comments
 (0)