2018-09-28 22:18:45 +02:00
|
|
|
<?php
|
2018-10-10 22:24:10 +02:00
|
|
|
namespace Psalm\Tests\FileUpdates;
|
2018-09-28 22:18:45 +02:00
|
|
|
|
2019-07-05 22:24:00 +02:00
|
|
|
use function array_keys;
|
|
|
|
use const DIRECTORY_SEPARATOR;
|
|
|
|
use function getcwd;
|
2018-11-06 03:57:36 +01:00
|
|
|
use Psalm\Internal\Analyzer\FileAnalyzer;
|
|
|
|
use Psalm\Internal\Analyzer\ProjectAnalyzer;
|
|
|
|
use Psalm\Internal\Provider\Providers;
|
2018-11-12 16:57:05 +01:00
|
|
|
use Psalm\Tests\Internal\Provider;
|
2019-03-23 19:27:54 +01:00
|
|
|
use Psalm\Tests\TestConfig;
|
2019-06-26 22:52:29 +02:00
|
|
|
use function strpos;
|
2018-09-28 22:18:45 +02:00
|
|
|
|
2018-11-02 02:52:39 +01:00
|
|
|
class AnalyzedMethodTest extends \Psalm\Tests\TestCase
|
2018-09-28 22:18:45 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
2019-05-17 00:36:36 +02:00
|
|
|
public function setUp() : void
|
2018-09-28 22:18:45 +02:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
2018-11-06 03:57:36 +01:00
|
|
|
FileAnalyzer::clearCache();
|
2018-09-28 22:18:45 +02:00
|
|
|
|
2018-11-12 16:57:05 +01:00
|
|
|
$this->file_provider = new \Psalm\Tests\Internal\Provider\FakeFileProvider();
|
2018-09-28 22:18:45 +02:00
|
|
|
|
|
|
|
$config = new TestConfig();
|
|
|
|
|
|
|
|
$providers = new Providers(
|
|
|
|
$this->file_provider,
|
2018-11-12 16:57:05 +01:00
|
|
|
new \Psalm\Tests\Internal\Provider\ParserInstanceCacheProvider(),
|
2018-09-30 05:51:06 +02:00
|
|
|
null,
|
|
|
|
null,
|
|
|
|
new Provider\FakeFileReferenceCacheProvider()
|
2018-09-28 22:18:45 +02:00
|
|
|
);
|
|
|
|
|
2018-11-11 18:01:14 +01:00
|
|
|
$this->project_analyzer = new ProjectAnalyzer(
|
2018-09-28 22:18:45 +02:00
|
|
|
$config,
|
2019-06-09 18:37:28 +02:00
|
|
|
$providers
|
2018-09-28 22:18:45 +02:00
|
|
|
);
|
2019-02-07 21:27:43 +01:00
|
|
|
$this->project_analyzer->setPhpVersion('7.3');
|
2018-09-28 22:18:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-09-30 05:51:06 +02:00
|
|
|
* @dataProvider providerTestValidUpdates
|
2018-09-28 22:18:45 +02:00
|
|
|
*
|
|
|
|
* @param array<string, string> $start_files
|
|
|
|
* @param array<string, string> $end_files
|
|
|
|
* @param array<string, string> $error_levels
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testValidInclude(
|
|
|
|
array $start_files,
|
|
|
|
array $end_files,
|
2018-11-02 02:52:39 +01:00
|
|
|
array $initial_analyzed_methods,
|
|
|
|
array $unaffected_analyzed_methods,
|
2018-09-28 22:18:45 +02:00
|
|
|
array $error_levels = []
|
|
|
|
) {
|
2018-10-03 23:11:08 +02:00
|
|
|
$test_name = $this->getTestName();
|
|
|
|
if (strpos($test_name, 'SKIPPED-') !== false) {
|
|
|
|
$this->markTestSkipped('Skipped due to a bug.');
|
|
|
|
}
|
|
|
|
|
2018-11-11 18:01:14 +01:00
|
|
|
$this->project_analyzer->getCodebase()->diff_methods = true;
|
2018-09-28 22:18:45 +02:00
|
|
|
|
2018-11-11 18:01:14 +01:00
|
|
|
$codebase = $this->project_analyzer->getCodebase();
|
2018-09-28 22:18:45 +02:00
|
|
|
|
|
|
|
$config = $codebase->config;
|
2018-10-17 21:52:58 +02:00
|
|
|
$config->throw_exception = false;
|
2018-09-28 22:18:45 +02:00
|
|
|
|
2018-09-28 23:51:00 +02:00
|
|
|
foreach ($error_levels as $error_type => $error_level) {
|
|
|
|
$config->setCustomErrorLevel($error_type, $error_level);
|
2018-09-28 22:18:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($start_files as $file_path => $contents) {
|
|
|
|
$this->file_provider->registerFile($file_path, $contents);
|
|
|
|
$codebase->addFilesToAnalyze([$file_path => $file_path]);
|
|
|
|
}
|
|
|
|
|
|
|
|
$codebase->scanFiles();
|
|
|
|
|
2018-11-02 02:52:39 +01:00
|
|
|
$this->assertSame([], $codebase->analyzer->getAnalyzedMethods());
|
2018-09-28 22:18:45 +02:00
|
|
|
|
2018-11-11 18:01:14 +01:00
|
|
|
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
2018-09-28 22:18:45 +02:00
|
|
|
|
|
|
|
$this->assertSame(
|
2018-11-02 02:52:39 +01:00
|
|
|
$initial_analyzed_methods,
|
2020-02-10 23:03:51 +01:00
|
|
|
$codebase->analyzer->getAnalyzedMethods(),
|
|
|
|
'initial analyzed methods are not the same'
|
2018-09-28 22:18:45 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($end_files as $file_path => $contents) {
|
|
|
|
$this->file_provider->registerFile($file_path, $contents);
|
|
|
|
}
|
|
|
|
|
2018-11-11 18:01:14 +01:00
|
|
|
$codebase->reloadFiles($this->project_analyzer, array_keys($end_files));
|
2018-09-28 22:18:45 +02:00
|
|
|
|
2018-11-11 18:01:14 +01:00
|
|
|
$codebase->analyzer->loadCachedResults($this->project_analyzer);
|
2018-09-28 22:18:45 +02:00
|
|
|
|
|
|
|
$this->assertSame(
|
2018-11-02 02:52:39 +01:00
|
|
|
$unaffected_analyzed_methods,
|
2020-02-10 23:03:51 +01:00
|
|
|
$codebase->analyzer->getAnalyzedMethods(),
|
|
|
|
'unaffected analyzed methods are not the same'
|
2018-09-28 22:18:45 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-02-23 22:22:39 +01:00
|
|
|
* @return array<string,array{start_files:array<string,string>,end_files:array<string,string>,initial_analyzed_methods:array<string,array<string,int>>,unaffected_analyzed_methods:array<string,array<string,int>>,4?:array<string,string>}>
|
2018-09-28 22:18:45 +02:00
|
|
|
*/
|
2018-09-30 05:51:06 +02:00
|
|
|
public function providerTestValidUpdates()
|
2018-09-28 22:18:45 +02:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
'basicRequire' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A{
|
|
|
|
public function fooFoo(): void {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
2018-09-28 23:51:00 +02:00
|
|
|
|
|
|
|
public function noReturnType() {}
|
2018-09-28 22:18:45 +02:00
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A{
|
|
|
|
public function fooFoo(?string $foo = null): void {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
2018-09-28 23:51:00 +02:00
|
|
|
|
|
|
|
public function noReturnType() {}
|
2018-09-28 22:18:45 +02:00
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-09-28 22:18:45 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::foofoo' => 1,
|
|
|
|
'foo\a::barbar' => 1,
|
2018-09-28 22:18:45 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
|
|
|
'foo\b::noreturntype' => 1,
|
2018-09-28 22:18:45 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-09-28 22:18:45 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2019-03-23 19:27:54 +01:00
|
|
|
'foo\a::barbar' => 1,
|
2018-09-28 22:18:45 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::bar' => 1,
|
|
|
|
'foo\b::noreturntype' => 1,
|
2018-09-28 22:18:45 +02:00
|
|
|
],
|
|
|
|
],
|
2018-09-28 23:51:00 +02:00
|
|
|
[
|
|
|
|
'MissingReturnType' => \Psalm\Config::REPORT_INFO,
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-09-28 22:18:45 +02:00
|
|
|
],
|
2018-09-30 17:33:40 +02:00
|
|
|
'invalidateAfterPropertyChange' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
public $foo = "bar";
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo() : string {
|
|
|
|
return (new A)->foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
$a = new A();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var int */
|
|
|
|
public $foo = 5;
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo() : string {
|
|
|
|
return (new A)->foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
$a = new A();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-09-30 17:33:40 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-09-30 17:33:40 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::bar' => 1,
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
|
|
|
'invalidateAfterStaticPropertyChange' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
public static $foo = "bar";
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo() : string {
|
|
|
|
return A::$foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
$a = new A();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var int */
|
|
|
|
public static $foo = 5;
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo() : string {
|
|
|
|
return A::$foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
$a = new A();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-09-30 17:33:40 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-09-30 17:33:40 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::bar' => 1,
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
|
|
|
'invalidateAfterStaticFlipPropertyChange' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
public static $foo = "bar";
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo() : string {
|
|
|
|
return A::$foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
$a = new A();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
public $foo = "bar";
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo() : string {
|
|
|
|
return A::$foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
$a = new A();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-09-30 17:33:40 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-09-30 17:33:40 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::bar' => 1,
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
|
|
|
'invalidateAfterConstantChange' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
public const FOO = "bar";
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo() : string {
|
|
|
|
return A::FOO;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
$a = new A();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
public const FOO = 5;
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo() : string {
|
|
|
|
return A::FOO;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
$a = new A();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-09-30 17:33:40 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-09-30 17:33:40 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::bar' => 1,
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-09-30 17:33:40 +02:00
|
|
|
],
|
2018-10-04 00:16:33 +02:00
|
|
|
'dontInvalidateTraitMethods' => [
|
2018-10-03 19:58:32 +02:00
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
public function fooFoo(): void { }
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function noReturnType() {}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
public function fooFoo(?string $foo = null): void { }
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function noReturnType() {}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-03 19:58:32 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::barbar&foo\t::barbar' => 1,
|
|
|
|
'foo\a::foofoo' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
|
|
|
'foo\b::noreturntype' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-03 23:11:08 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::barbar&foo\t::barbar' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::bar' => 1,
|
|
|
|
'foo\b::noreturntype' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'MissingReturnType' => \Psalm\Config::REPORT_INFO,
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
'invalidateTraitMethodsWhenTraitRemoved' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
public function fooFoo(): void { }
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
public function fooFoo(?string $foo = null): void { }
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-03 19:58:32 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::barbar&foo\t::barbar' => 1,
|
|
|
|
'foo\a::foofoo' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-04 00:16:33 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::barbar&foo\t::barbar' => 1, // this doesn't exist, so we don't care
|
2018-10-04 00:16:33 +02:00
|
|
|
],
|
2018-10-03 19:58:32 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
'invalidateTraitMethodsWhenTraitReplaced' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
public function fooFoo(): void { }
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
public function fooFoo(?string $foo = null): void { }
|
|
|
|
|
|
|
|
public function barBar(): int {
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-03 23:11:08 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::barbar&foo\t::barbar' => 1,
|
|
|
|
'foo\a::foofoo' => 1,
|
2018-10-03 23:11:08 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
2018-10-03 23:11:08 +02:00
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-03 23:11:08 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-03 23:11:08 +02:00
|
|
|
],
|
2018-10-04 00:16:33 +02:00
|
|
|
'invalidateTraitMethodsWhenMethodChanged' => [
|
2018-10-03 23:11:08 +02:00
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
public function fooFoo(): void { }
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
|
|
|
}',
|
2018-10-26 06:59:14 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
2018-10-03 23:11:08 +02:00
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bat(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
public function fooFoo(?string $foo = null): void { }
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function foo(): void {
|
|
|
|
(new A)->fooFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
echo (new A)->barBar();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): int {
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bat(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-03 19:58:32 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::barbar&foo\t::barbar' => 1,
|
|
|
|
'foo\a::bat&foo\t::bat' => 1,
|
|
|
|
'foo\a::foofoo' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::foo' => 1,
|
|
|
|
'foo\b::bar' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-03 23:11:08 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::bat&foo\t::bat' => 1,
|
2018-10-04 00:16:33 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-04 00:16:33 +02:00
|
|
|
],
|
|
|
|
'invalidateTraitMethodsWhenMethodSuperimposed' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function bar() : string {
|
|
|
|
return (new A)->barBar();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
public function barBar(): int {
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public function bar() : string {
|
|
|
|
return (new A)->barBar();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
public function barBar(): string {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-04 00:16:33 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\a::barbar&foo\t::barbar' => 1,
|
2018-10-04 00:16:33 +02:00
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
'foo\b::bar' => 1,
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
2018-10-04 00:16:33 +02:00
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-04 00:16:33 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [],
|
2018-10-03 19:58:32 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-03 19:58:32 +02:00
|
|
|
],
|
2018-10-07 04:58:21 +02:00
|
|
|
'dontInvalidateConstructor' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
public $foo;
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
$this->setFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function setFoo() : void {
|
|
|
|
$this->reallySetFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function reallySetFoo() : void {
|
|
|
|
$this->foo = "bar";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
public $foo;
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
$this->setFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function setFoo() : void {
|
|
|
|
$this->reallySetFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function reallySetFoo() : void {
|
|
|
|
$this->foo = "bar";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 2,
|
|
|
|
'foo\a::setfoo' => 1,
|
|
|
|
'foo\a::reallysetfoo' => 1,
|
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 2,
|
|
|
|
'foo\a::setfoo' => 1,
|
|
|
|
'foo\a::reallysetfoo' => 1,
|
|
|
|
],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-07 04:58:21 +02:00
|
|
|
],
|
|
|
|
'invalidateConstructorWhenDependentMethodChanges' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
public $foo;
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
$this->setFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function setFoo() : void {
|
|
|
|
$this->reallySetFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function reallySetFoo() : void {
|
|
|
|
$this->foo = "bar";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
public $foo;
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
$this->setFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function setFoo() : void {
|
|
|
|
$this->reallySetFoo();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function reallySetFoo() : void {
|
|
|
|
//$this->foo = "bar";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 2,
|
|
|
|
'foo\a::setfoo' => 1,
|
|
|
|
'foo\a::reallysetfoo' => 1,
|
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-07 04:58:21 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::setfoo' => 1,
|
|
|
|
],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-07 04:58:21 +02:00
|
|
|
],
|
2018-10-07 05:38:50 +02:00
|
|
|
'invalidateConstructorWhenDependentTraitMethodChanges' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
public $foo;
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
$this->setFoo();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
private function setFoo() : void {
|
|
|
|
$this->foo = "bar";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
use T;
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
public $foo;
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
$this->setFoo();
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'T.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
trait T {
|
|
|
|
private function setFoo() : void {
|
|
|
|
//$this->foo = "bar";
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-07 05:38:50 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::setfoo&foo\t::setfoo' => 1,
|
|
|
|
'foo\a::__construct' => 2,
|
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-07 05:38:50 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-09 19:49:57 +02:00
|
|
|
],
|
|
|
|
'rescanPropertyAssertingMethod' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string */
|
|
|
|
private $foo;
|
|
|
|
|
|
|
|
public function __construct() {}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
if ($this->foo === null) {}
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string|null */
|
|
|
|
private $foo;
|
|
|
|
|
|
|
|
public function __construct() {}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
if ($this->foo === null) {}
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-09 19:49:57 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 2,
|
|
|
|
'foo\a::bar' => 1,
|
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-09 19:49:57 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2019-04-16 22:07:48 +02:00
|
|
|
'foo\a::__construct' => 2,
|
2018-10-09 19:49:57 +02:00
|
|
|
],
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'PropertyNotSetInConstructor' => \Psalm\Config::REPORT_INFO,
|
|
|
|
'DocblockTypeContradiction' => \Psalm\Config::REPORT_INFO,
|
|
|
|
'RedundantConditionGivenDocblockType' => \Psalm\Config::REPORT_INFO,
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-07 05:38:50 +02:00
|
|
|
],
|
2018-10-17 21:52:58 +02:00
|
|
|
'noChangeAfterSyntaxError' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string|null */
|
|
|
|
private $foo;
|
|
|
|
|
|
|
|
public function __construct() {}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
if ($this->foo === null) {}
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string|null */
|
|
|
|
private $foo
|
|
|
|
|
|
|
|
public function __construct() {}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
if ($this->foo === null) {}
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-17 21:52:58 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 1,
|
|
|
|
'foo\a::bar' => 1,
|
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-17 21:52:58 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
2019-04-16 22:07:48 +02:00
|
|
|
'foo\a::__construct' => 1,
|
2018-10-17 21:52:58 +02:00
|
|
|
],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-17 21:52:58 +02:00
|
|
|
],
|
|
|
|
'nothingBeforeSyntaxError' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string|null */
|
|
|
|
private $foo
|
|
|
|
|
|
|
|
public function __construct() {}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
if ($this->foo === null) {}
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class A {
|
|
|
|
/** @var string|null */
|
|
|
|
private $foo;
|
|
|
|
|
|
|
|
public function __construct() {}
|
|
|
|
|
|
|
|
public function bar() : void {
|
|
|
|
if ($this->foo === null) {}
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'initial_analyzed_methods' => [
|
2018-10-17 21:52:58 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 1,
|
2018-11-02 02:52:39 +01:00
|
|
|
'foo\a::bar' => 1,
|
2018-10-17 21:52:58 +02:00
|
|
|
],
|
|
|
|
],
|
2018-11-02 02:52:39 +01:00
|
|
|
'unaffected_analyzed_methods' => [
|
2018-10-17 21:52:58 +02:00
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 1,
|
|
|
|
],
|
2019-03-23 19:27:54 +01:00
|
|
|
],
|
2018-10-17 21:52:58 +02:00
|
|
|
],
|
2020-02-10 23:03:51 +01:00
|
|
|
'modifyPropertyOfChildClass' => [
|
|
|
|
'start_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
abstract class A {
|
|
|
|
protected $arr = [1, 2, 3];
|
|
|
|
|
|
|
|
protected string $b;
|
|
|
|
|
|
|
|
public function __construct(int $a, string $b) {
|
|
|
|
echo $this->arr[$a];
|
|
|
|
$this->b = $b;
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'AChild.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class AChild extends A {
|
|
|
|
public $arr = [1, 2, 3, 4];
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'end_files' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
abstract class A {
|
|
|
|
protected $arr = [1, 2, 3];
|
|
|
|
|
|
|
|
protected string $b;
|
|
|
|
|
|
|
|
public function __construct(int $a, string $b) {
|
|
|
|
echo $this->arr[$a];
|
|
|
|
$this->b = $b;
|
|
|
|
}
|
|
|
|
}',
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'AChild.php' => '<?php
|
|
|
|
namespace Foo;
|
|
|
|
|
|
|
|
class AChild extends A {
|
|
|
|
protected $arr;
|
|
|
|
}',
|
|
|
|
],
|
|
|
|
'initial_analyzed_methods' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 2,
|
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'AChild.php' => [
|
|
|
|
'foo\achild::__construct' => 2,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'unaffected_analyzed_methods' => [
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
|
|
|
|
'foo\a::__construct' => 2,
|
|
|
|
],
|
|
|
|
getcwd() . DIRECTORY_SEPARATOR . 'AChild.php' => []
|
|
|
|
],
|
|
|
|
],
|
2018-09-28 22:18:45 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|