mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
namespace Psalm\Tests;
|
|
|
|
class NamespaceTest extends TestCase
|
|
{
|
|
use Traits\FileCheckerValidCodeParseTestTrait;
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function providerFileCheckerValidCodeParse()
|
|
{
|
|
return [
|
|
'emptyNamespace' => [
|
|
'<?php
|
|
namespace A {
|
|
/** @return void */
|
|
function foo() {
|
|
|
|
}
|
|
|
|
class Bar {
|
|
|
|
}
|
|
}
|
|
namespace {
|
|
A\foo();
|
|
\A\foo();
|
|
|
|
(new A\Bar);
|
|
}',
|
|
],
|
|
'constantReference' => [
|
|
'<?php
|
|
namespace Aye\Bee {
|
|
const HELLO = "hello";
|
|
}
|
|
namespace Aye\Bee {
|
|
/** @return void */
|
|
function foo() {
|
|
echo \Aye\Bee\HELLO;
|
|
}
|
|
|
|
class Bar {
|
|
/** @return void */
|
|
public function foo() {
|
|
echo \Aye\Bee\HELLO;
|
|
}
|
|
}
|
|
}',
|
|
],
|
|
];
|
|
}
|
|
}
|