Skip to content
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

Fix: Combine cases #162

Merged
merged 1 commit into from
Apr 3, 2020
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 phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parameters:

-
message: "#^Anonymous function should have native return typehint \"string\"\\.$#"
count: 2
count: 1
path: src/FieldDefinition.php

-
Expand Down
4 changes: 1 addition & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
<MixedArgument occurrences="1">
<code>$n</code>
</MixedArgument>
<MixedOperand occurrences="4">
<code>$n</code>
<code>$n</code>
<MixedOperand occurrences="2">
<code>$n</code>
<code>$n</code>
</MixedOperand>
Expand Down
14 changes: 7 additions & 7 deletions src/FieldDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ public static function sequence($funcOrString, int $firstNum = 1): self
});
}

if (false !== \strpos($funcOrString, '%d')) {
return new self(static function () use (&$n, $funcOrString) {
++$n;

return \str_replace('%d', $n, $funcOrString);
});
if (false === \strpos($funcOrString, '%d')) {
$funcOrString .= '%d';
}

return new self(static function () use (&$n, $funcOrString) {
++$n;

return $funcOrString . $n;
return \str_replace(
'%d',
$n,
$funcOrString
);
});
}

Expand Down