2017-01-13 19:48:58 +01:00
|
|
|
<?php
|
|
|
|
namespace Psalm\Tests;
|
|
|
|
|
2017-04-25 05:45:02 +02:00
|
|
|
class NamespaceTest extends TestCase
|
2017-01-13 19:48:58 +01:00
|
|
|
{
|
2017-04-25 05:45:02 +02:00
|
|
|
use Traits\FileCheckerValidCodeParseTestTrait;
|
2017-01-13 19:48:58 +01:00
|
|
|
|
2017-01-13 20:07:23 +01:00
|
|
|
/**
|
2017-04-25 05:45:02 +02:00
|
|
|
* @return array
|
2017-01-13 20:07:23 +01:00
|
|
|
*/
|
2017-04-25 05:45:02 +02:00
|
|
|
public function providerFileCheckerValidCodeParse()
|
2017-01-13 19:48:58 +01:00
|
|
|
{
|
2017-04-25 05:45:02 +02:00
|
|
|
return [
|
|
|
|
'emptyNamespace' => [
|
|
|
|
'<?php
|
|
|
|
namespace A {
|
|
|
|
/** @return void */
|
|
|
|
function foo() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class Bar {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
namespace {
|
|
|
|
A\foo();
|
|
|
|
\A\foo();
|
|
|
|
|
|
|
|
(new A\Bar);
|
2017-05-27 02:05:57 +02:00
|
|
|
}',
|
2017-04-25 05:45:02 +02:00
|
|
|
],
|
|
|
|
'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;
|
|
|
|
}
|
|
|
|
}
|
2017-05-27 02:05:57 +02:00
|
|
|
}',
|
|
|
|
],
|
2017-04-25 05:45:02 +02:00
|
|
|
];
|
2017-01-18 05:55:08 +01:00
|
|
|
}
|
2017-01-13 19:48:58 +01:00
|
|
|
}
|