Skip to content

added phpdoc to ParsingException#70

Merged
Seldaek merged 2 commits intoSeldaek:masterfrom
clxmstaab:patch-1
Aug 13, 2020
Merged

added phpdoc to ParsingException#70
Seldaek merged 2 commits intoSeldaek:masterfrom
clxmstaab:patch-1

Conversation

@clxmstaab
Copy link
Copy Markdown
Contributor

@clxmstaab clxmstaab commented Aug 13, 2020

this Exception is likely beeing used from the caller side. therefore add some typing to reduce risk for errors

related to composer/composer#9120

@clxmstaab clxmstaab marked this pull request as ready for review August 13, 2020 07:33
@Seldaek Seldaek merged commit 94384e8 into Seldaek:master Aug 13, 2020
@Seldaek
Copy link
Copy Markdown
Owner

Seldaek commented Aug 13, 2020

Thanks


/**
* @param string $message
* @psalm-param array{text?: string, token?: string, line?: int, loc?: array, expected?: array} $details
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.

loc might be documented with more details. Here is its structure:

$this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);

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.

and expected is an string[]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will do a followup PR and also add phpstan, so we can verify the changes in the repo here.

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.

IIRC, PHPStan will also read the psalm-param annotation (it will just be less strict in the validation when it cannot understand the type)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IIRC, PHPStan will also read the psalm-param annotation (it will just be less strict in the validation when it cannot understand the type)

yep correct.

with "and also add phpstan" I was refering to add a github action phpstan check in this repo here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

#71

@clxmstaab clxmstaab deleted the patch-1 branch August 13, 2020 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants