1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-16 03:17:02 +01:00
psalm/tests/fixtures/stubs/class_alias.php

37 lines
569 B
PHP
Raw Normal View History

2018-11-29 06:05:56 +01:00
<?php
namespace ClassAliasStubTest;
2019-03-23 19:27:54 +01:00
class A
{
2018-11-29 06:05:56 +01:00
/**
* @var string
*/
2019-03-23 19:27:54 +01:00
public $foo = 'hello';
2018-11-29 06:05:56 +01:00
2019-03-23 19:27:54 +01:00
public function bar(string $s) : string
{
return $s . ' Im here';
2018-11-29 06:05:56 +01:00
}
2019-03-23 19:27:54 +01:00
public static function bat() : void
{
}
2018-11-29 06:05:56 +01:00
}
2019-03-23 19:27:54 +01:00
interface I
{
}
2019-03-23 19:27:54 +01:00
class_alias('ClassAliasStubTest\\A', 'ClassAliasStubTest\\B');
class_alias(A::class, C::class);
$arr = [
[A::class, D::class],
[I::class, IAlias::class],
];
foreach ($arr as [$orig, $alias]) {
// Psalm cannot reason about this in the loading step
class_alias($orig, $alias);
}