Skip to content

Simplify usage of FileParserFactory#408

Open
hgraca wants to merge 1 commit into
phparkitect:mainfrom
hgraca:fork/feat/simplify_file_parser_factory
Open

Simplify usage of FileParserFactory#408
hgraca wants to merge 1 commit into
phparkitect:mainfrom
hgraca:fork/feat/simplify_file_parser_factory

Conversation

@hgraca

@hgraca hgraca commented Sep 18, 2023

Copy link
Copy Markdown
Contributor

By allowing createFileParser to be called with null we need less code everywhere else to create a default file parser.

By allowing createFileParser to be called with null
we need less code everywhere else to create a default file parser.
public static function createFileParser(TargetPhpVersion $targetPhpVersion, bool $parseCustomAnnotations = true): FileParser
{
public static function createFileParser(
TargetPhpVersion $targetPhpVersion = null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TargetPhpVersion $targetPhpVersion = null,
?TargetPhpVersion $targetPhpVersion = null,

I assume this should be explicitly marked as a nullable type instead of depending on implicit PHP behaviour.

}

public static function create(?string $version): self
public static function create(string $version = null): self

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static function create(string $version = null): self
public static function create(?string $version = null): self

as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants