Skip to content
Permalink
Browse files

Fix test

  • Loading branch information
muglug committed Dec 29, 2019
1 parent 26876b9 commit b375ebf06f8a8b9efc0d83a567d55ff877cbf593
Showing with 11 additions and 5 deletions.
  1. +9 −3 src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php
  2. +2 −2 tests/ArgTest.php
@@ -364,7 +364,13 @@ protected static function checkFunctionArguments(
&& isset($args[0])
&& isset($args[1])
) {
if (self::handleArrayAddition($statements_analyzer, $args, $context, $method_id === 'array_push') === false) {
if (self::handleArrayAddition(
$statements_analyzer,
$args,
$context,
$method_id === 'array_push'
) === false
) {
return false;
}

@@ -896,9 +902,9 @@ private static function handleArrayAddition(
} else {
if ($objectlike_list) {
if ($is_push) {
array_push($objectlike_list->properties, $arg_value_type);
\array_push($objectlike_list->properties, $arg_value_type);
} else {
array_unshift($objectlike_list->properties, $arg_value_type);
\array_unshift($objectlike_list->properties, $arg_value_type);
}

$by_ref_type = new Type\Union([$objectlike_list]);
@@ -37,8 +37,8 @@ public function providerValidCodeParse()
array_push($b, (bool)rand(0, 1));
',
'assertions' => [
'$a' => 'array<int|string, bool|int>',
'$b' => 'array<int|string, bool|int>',
'$a' => 'non-empty-array<int|string, bool|int>',
'$b' => 'non-empty-array<int|string, bool|int>',
],
],
'byRefArgAssignment' => [

0 comments on commit b375ebf

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