Skip to content

Commit

Permalink
fix: Make work for 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
petewalker committed Jan 21, 2022
1 parent 93d3196 commit f24a0c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php
Expand Up @@ -73,7 +73,8 @@ public static function resolve(
$file_storage,
$classlike_storage,
$aliases,
$analysis_php_version_id
$php_major_version,
$php_minor_version
);

$type = Type::intersectUnionTypes($resolved_type, $type, $codebase);
Expand Down
26 changes: 14 additions & 12 deletions tests/NativeIntersectionsTest.php
Expand Up @@ -11,13 +11,13 @@ class NativeIntersectionsTest extends TestCase
use ValidCodeAnalysisTestTrait;

/**
* @return iterable<string,array{code:string,assertions?:array<string,string>,ignored_issues?:list<string>}>
* @return iterable<string,array{string,assertions?:array<string,string>,error_levels?:string[],php_version?:string}>
*/
public function providerValidCodeParse(): iterable
{
return [
'nativeTypeIntersectionInConstructor' => [
'code' => '<?php
'<?php
interface A {
}
interface B {
Expand All @@ -31,11 +31,11 @@ public function self(): A&B
}
}',
'assertions' => [],
'ignored_issues' => [],
'error_levels' => [],
'php_version' => '8.1'
],
'nativeTypeIntersectionAsArgument' => [
'code' => '<?php
'<?php
interface A {
function foo(): void;
}
Expand All @@ -51,20 +51,20 @@ function test(A&B $in): void {
test(new C());
',
'assertions' => [],
'ignored_issues' => [],
'error_levels' => [],
'php_version' => '8.1'
],
];
}

/**
* @return iterable<string,array{code:string,error_message:string,ignored_issues?:list<string>,php_version?:string}>
* @return iterable<string,array{string,error_message:string,1?:string[],2?:bool,3?:string}>
*/
public function providerInvalidCodeParse(): iterable
{
return [
'invalidNativeIntersectionArgument' => [
'code' => '<?php
'<?php
interface A {
function foo(): void;
}
Expand All @@ -80,11 +80,12 @@ function test(A&B $in): void {
test(new C());
',
'error_message' => 'InvalidArgument',
'ignored_issues' => [],
'php_version' => '8.1'
[],
false,
'8.1'
],
'mismatchDocblockNativeIntersectionArgument' => [
'code' => '<?php
'<?php
interface A {
function foo(): void;
}
Expand All @@ -100,8 +101,9 @@ function test(A&B $in): void {
}
',
'error_message' => 'MismatchingDocblockParamType',
'ignored_issues' => [],
'php_version' => '8.1'
[],
false,
'8.1'
],
];
}
Expand Down

0 comments on commit f24a0c2

Please sign in to comment.