Skip to content
Permalink
Browse files

Clone closure param types before combining

  • Loading branch information...
muglug committed Jun 20, 2019
1 parent c93c2a4 commit db38270a6aed9e838b92a92bb0ab78c07e5f5c5b
Showing with 17 additions and 1 deletion.
  1. +3 −1 src/Psalm/Internal/Type/TypeCombination.php
  2. +14 −0 tests/PropertyTypeTest.php
@@ -612,7 +612,9 @@ private static function scrapeTypeProperties(
) {
if ($type->params) {
if ($combination->closure_params === null) {
$combination->closure_params = $type->params;
foreach ($type->params as $param) {
$combination->closure_params[] = clone $param;
}
} else {
$param_count = max(count($combination->closure_params), count($type->params));
@@ -1636,6 +1636,20 @@ public function __construct() {
}
}',
],
'dontAlterClosureParams' => [
'<?php
class C {
/** @var array */
public $i;
public function __construct() {
$this->i = [
function (Exception $e): void {},
function (LogicException $e): void {},
];
}
}'
],
];
}

0 comments on commit db38270

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