Skip to content
Permalink
Browse files

Merge pull request #31 from ergebnis/fix/static-lambda

Fix: Re-enable static_lambda fixer
  • Loading branch information
localheinz committed Mar 13, 2020
2 parents 14e0024 + 4cf1f28 commit 071dcca9420341f36798a818d972e5f97220f048
Showing with 16 additions and 17 deletions.
  1. +0 −1 .php_cs
  2. +7 −7 psalm-baseline.xml
  3. +4 −4 src/EntityDef.php
  4. +5 −5 src/FieldDef.php
@@ -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()
@@ -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>
@@ -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>
@@ -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;
};
}
@@ -134,7 +134,7 @@ private function normalizeFieldDef($def)
return $this->ensureInvokable($def);
}

return function () use ($def) {
return static function () use ($def) {
return $def;
};
}
@@ -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());
};
}
@@ -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;
@@ -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);
};
}
@@ -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,
[],

0 comments on commit 071dcca

Please sign in to comment.
You can’t perform that action at this time.