Skip to content

Explicit nullable type hint for PHP 8.4 #34

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
Apr 22, 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
2 changes: 1 addition & 1 deletion src/NodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ function (\PhpParser\Node\Const_ $const) {
* @return bool If true, this is the first declaration of this type with
* this name, so it can be safely included.
*/
private function count(string $type, string $name = null): bool
private function count(string $type, ?string $name = null): bool
{
assert(isset($this->counts[$type]), 'Expected valid `$type`');

Expand Down
2 changes: 1 addition & 1 deletion src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function getDuplicates(): array
*
* @return string The pretty printed version.
*/
public function prettyPrint(PrettyPrinterAbstract $printer = null): string
public function prettyPrint(?PrettyPrinterAbstract $printer = null): string
{
if (!$printer) {
$printer = new Standard();
Expand Down
4 changes: 2 additions & 2 deletions src/StubsGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ public function __construct(int $symbols = self::DEFAULT, array $config = [])
* pretty-printed stubs.
*
* @param Finder $finder The set of files to generate (merged) stubs for.
* @param NodeVisitor $visitor The optional node visitor to override the default.
* @param NodeVisitor|null $visitor The optional node visitor to override the default.
*
* @return Result
*/
public function generate(Finder $finder, NodeVisitor $visitor = null): Result
public function generate(Finder $finder, ?NodeVisitor $visitor = null): Result
{
$parser = (new ParserFactory())->createForNewestSupportedVersion();

Expand Down