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: Re-enable static_lambda fixer #31

Merged
merged 3 commits into from
Mar 13, 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
1 change: 0 additions & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ $license->save();
$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php71($license->header()), [
'final_class' => false,
'mb_str_functions' => false,
'static_lambda' => false,
]);

$config->getFinder()
Expand Down
14 changes: 7 additions & 7 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<files psalm-version="3.9.5@0cfe565d0afbcd31eadcc281b9017b5692911661">
<file src="src/EntityDef.php">
<MissingClosureReturnType occurrences="4">
<code>function () use ($defaultFieldValue) {</code>
<code>function () {</code>
<code>function () use ($def) {</code>
<code>function () use ($f) {</code>
<code>static function () use ($defaultFieldValue) {</code>
<code>static function () {</code>
<code>static function () use ($def) {</code>
<code>static function () use ($f) {</code>
</MissingClosureReturnType>
<MissingParamType occurrences="4">
<code>$name</code>
Expand Down Expand Up @@ -55,9 +55,9 @@
</file>
<file src="src/FieldDef.php">
<MissingClosureReturnType occurrences="3">
<code>function () use (&amp;$n, $funcOrString) {</code>
<code>function (FixtureFactory $factory) use ($name) {</code>
<code>function (FixtureFactory $factory) use ($name, $numberOfInstances) {</code>
<code>static function () use (&amp;$n, $funcOrString) {</code>
<code>static function (FixtureFactory $factory) use ($name) {</code>
<code>static function (FixtureFactory $factory) use ($name, $numberOfInstances) {</code>
</MissingClosureReturnType>
<MixedArgument occurrences="1">
<code>$n</code>
Expand Down
8 changes: 4 additions & 4 deletions src/EntityDef.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ private function defaultDefsFromMetadata(): void
$defaultFieldValue = $this->metadata->getFieldValue($defaultEntity, $fieldName);

if (null !== $defaultFieldValue) {
$this->fieldDefs[$fieldName] = function () use ($defaultFieldValue) {
$this->fieldDefs[$fieldName] = static function () use ($defaultFieldValue) {
return $defaultFieldValue;
};
} else {
$this->fieldDefs[$fieldName] = function () {
$this->fieldDefs[$fieldName] = static function () {
return null;
};
}
Expand All @@ -134,7 +134,7 @@ private function normalizeFieldDef($def)
return $this->ensureInvokable($def);
}

return function () use ($def) {
return static function () use ($def) {
return $def;
};
}
Expand All @@ -145,7 +145,7 @@ private function ensureInvokable($f)
return $f;
}

return function () use ($f) {
return static function () use ($f) {
return \call_user_func_array($f, \func_get_args());
};
}
Expand Down
10 changes: 5 additions & 5 deletions src/FieldDef.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ public static function sequence($funcOrString, $firstNum = 1)
$n = $firstNum - 1;

if (\is_callable($funcOrString)) {
return function () use (&$n, $funcOrString) {
return static function () use (&$n, $funcOrString) {
++$n;

return \call_user_func($funcOrString, $n);
};
}

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

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

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

return $funcOrString . $n;
Expand All @@ -75,7 +75,7 @@ public static function sequence($funcOrString, $firstNum = 1)
*/
public static function reference($name)
{
return function (FixtureFactory $factory) use ($name) {
return static function (FixtureFactory $factory) use ($name) {
return $factory->get($name);
};
}
Expand All @@ -101,7 +101,7 @@ public static function references($name, $numberOfInstances = 1)
throw new \InvalidArgumentException('Can only get >= 1 instances');
}

return function (FixtureFactory $factory) use ($name, $numberOfInstances) {
return static function (FixtureFactory $factory) use ($name, $numberOfInstances) {
return $factory->getList(
$name,
[],
Expand Down