Skip to content
Permalink
Browse files

Move strings that reference T::class

  • Loading branch information...
muglug committed Jun 25, 2019
1 parent e5016a4 commit 6cb52d2d0e0eb507e5576a39e0054538fedb75ee
Showing with 34 additions and 34 deletions.
  1. +34 −0 tests/Template/FunctionCallStringTemplateTest.php
  2. +0 −34 tests/Template/FunctionTemplateTest.php
@@ -466,6 +466,27 @@ function useMockTemplated(string $className) : void
mock(A::class)->foo();'
],
'returnClassString' => [
'<?php
/**
* @template T
* @param T::class $s
* @return T::class
*/
function foo(string $s) : string {
return $s;
}
/**
* @param A::class $s
*/
function bar(string $s) : void {
}
class A {}
bar(foo(A::class));',
],
];
}
@@ -518,6 +539,19 @@ public function getObject(string $type)
}',
'error_message' => 'InvalidReturnStatement'
],
'forbidLossOfInformationWhenCoercing' => [
'<?php
/**
* @template T as iterable<int>
* @param T::class $class
*/
function foo(string $class) : void {}
function bar(Traversable $t) : void {
foo(get_class($t));
}',
'error_message' => 'MixedArgumentTypeCoercion',
],
];
}
}
@@ -402,27 +402,6 @@ function foo($some_t) : C {
'assertions' => [],
'error_levels' => ['MixedAssignment', 'MissingParamType'],
],
'returnClassString' => [
'<?php
/**
* @template T
* @param T::class $s
* @return T::class
*/
function foo(string $s) : string {
return $s;
}
/**
* @param A::class $s
*/
function bar(string $s) : void {
}
class A {}
bar(foo(A::class));',
],
'bindFirstTemplatedClosureParameter' => [
'<?php
/**
@@ -869,19 +848,6 @@ function foo($some_t) : void {
}',
'error_message' => 'MixedMethodCall',
],
'forbidLossOfInformationWhenCoercing' => [
'<?php
/**
* @template T as iterable<int>
* @param T::class $class
*/
function foo(string $class) : void {}
function bar(Traversable $t) : void {
foo(get_class($t));
}',
'error_message' => 'MixedArgumentTypeCoercion',
],
'bindFirstTemplatedClosureParameter' => [
'<?php
/**

0 comments on commit 6cb52d2

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