-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Declare more precise phpdoc types #993
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
999135f
Declare more precise phpdoc types
staabm e244286
non-empty-string in Identifier
staabm 42a34bd
fix typo
staabm 911ba18
try fix CI
staabm 3182297
try fix more CI
staabm e408e0b
try fix coverage job
staabm ca150d9
Revert stricter param type which would be a BC break.
staabm f917163
added test
staabm File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,10 @@ | |
* Represents a non-namespaced name. Namespaced names are represented using Name nodes. | ||
*/ | ||
class Identifier extends NodeAbstract { | ||
/** @var string Identifier as string */ | ||
/** | ||
* @psalm-var non-empty-string | ||
* @var string Identifier as string | ||
*/ | ||
public string $name; | ||
|
||
/** @var array<string, bool> */ | ||
|
@@ -25,6 +28,10 @@ class Identifier extends NodeAbstract { | |
* @param array<string, mixed> $attributes Additional attributes | ||
*/ | ||
public function __construct(string $name, array $attributes = []) { | ||
if ($name === '') { | ||
throw new \InvalidArgumentException('Identifier name cannot be empty'); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
$this->attributes = $attributes; | ||
$this->name = $name; | ||
} | ||
|
@@ -36,6 +43,7 @@ public function getSubNodeNames(): array { | |
/** | ||
* Get identifier as string. | ||
* | ||
* @psalm-return non-empty-string | ||
* @return string Identifier as string. | ||
*/ | ||
public function toString(): string { | ||
|
@@ -45,6 +53,7 @@ public function toString(): string { | |
/** | ||
* Get lowercased identifier as string. | ||
* | ||
* @psalm-return non-empty-string | ||
* @return string Lowercased identifier as string | ||
*/ | ||
public function toLowerString(): string { | ||
|
@@ -63,6 +72,7 @@ public function isSpecialClassName(): bool { | |
/** | ||
* Get identifier as string. | ||
* | ||
* @psalm-return non-empty-string | ||
* @return string Identifier as string | ||
*/ | ||
public function __toString(): string { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do / why is it necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without this fix, CI errors in PRs of forks. see #993 (comment)
errors beeing fixed can be seen here: https://github.com/nikic/PHP-Parser/actions/runs/8671744331/job/23781260607?pr=993
without thix fix composer does not realize what the version of the package of the checked-out project is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I guess I caused this with b43758e and previously this probably just resolved to PHPUnit 8 instead...