-
-
Notifications
You must be signed in to change notification settings - Fork 137
Phpstan level 6 #307
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
base: master
Are you sure you want to change the base?
Phpstan level 6 #307
Changes from all commits
301e547
7e3f974
ce500fe
7d3fc61
c68c451
bdf82c5
317fea1
fcaab6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
parameters: | ||
level: 5 | ||
# level: 5 | ||
level: 6 | ||
paths: | ||
- src | ||
- tests |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,21 @@ | |
* Class to manage the comments of a translation. | ||
* | ||
* @phpstan-consistent-constructor | ||
* | ||
* @phpstan-type CommentsType array<int, string> | ||
* | ||
* @implements IteratorAggregate<int, string> | ||
*/ | ||
class Comments implements JsonSerializable, Countable, IteratorAggregate | ||
{ | ||
/** | ||
* @var CommentsType | ||
*/ | ||
protected $comments = []; | ||
|
||
/** | ||
* @param array{comments: CommentsType} $state | ||
*/ | ||
public static function __set_state(array $state): Comments | ||
{ | ||
return new static(...$state['comments']); | ||
|
@@ -51,9 +61,7 @@ public function delete(string ...$comments): self | |
foreach ($comments as $comment) { | ||
$key = array_search($comment, $this->comments); | ||
|
||
if (is_int($key)) { | ||
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. My previous question was more related to this change. As far as I understand, should 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.
|
||
array_splice($this->comments, $key, 1); | ||
} | ||
array_splice($this->comments, $key, 1); | ||
} | ||
|
||
return $this; | ||
|
@@ -76,6 +84,9 @@ public function count(): int | |
return count($this->comments); | ||
} | ||
|
||
/** | ||
* @return CommentsType | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return $this->comments; | ||
|
Uh oh!
There was an error while loading. Please reload this page.