2016-11-21 20:36:06 +01:00
|
|
|
<?php
|
2021-12-15 04:58:32 +01:00
|
|
|
|
2016-11-21 20:36:06 +01:00
|
|
|
namespace Psalm\Tests;
|
|
|
|
|
2021-12-04 21:55:53 +01:00
|
|
|
use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait;
|
|
|
|
|
2017-04-25 05:45:02 +02:00
|
|
|
class Php40Test extends TestCase
|
2016-11-21 20:36:06 +01:00
|
|
|
{
|
2021-12-04 21:55:53 +01:00
|
|
|
use ValidCodeAnalysisTestTrait;
|
2016-11-21 20:36:06 +01:00
|
|
|
|
2017-01-13 20:07:23 +01:00
|
|
|
/**
|
2022-01-13 20:38:17 +01:00
|
|
|
* @return iterable<string,array{code:string,assertions?:array<string,string>,ignored_issues?:list<string>}>
|
2017-01-13 20:07:23 +01:00
|
|
|
*/
|
2020-09-12 17:24:05 +02:00
|
|
|
public function providerValidCodeParse(): iterable
|
2016-11-21 20:36:06 +01:00
|
|
|
{
|
2017-04-25 05:45:02 +02:00
|
|
|
return [
|
|
|
|
'extendOldStyleConstructor' => [
|
2022-01-13 19:49:37 +01:00
|
|
|
'code' => '<?php
|
2017-04-25 05:45:02 +02:00
|
|
|
class A {
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function A() {
|
|
|
|
return "hello";
|
|
|
|
}
|
|
|
|
}
|
2018-11-06 03:57:36 +01:00
|
|
|
|
2017-04-25 05:45:02 +02:00
|
|
|
class B extends A {
|
|
|
|
public function __construct() {
|
|
|
|
parent::__construct();
|
|
|
|
}
|
2017-05-27 02:05:57 +02:00
|
|
|
}',
|
2017-04-25 05:45:02 +02:00
|
|
|
],
|
|
|
|
'sameNameMethodWithNewStyleConstructor' => [
|
2022-01-13 19:49:37 +01:00
|
|
|
'code' => '<?php
|
2017-04-25 05:45:02 +02:00
|
|
|
class A {
|
|
|
|
public function __construct(string $s) { }
|
|
|
|
/** @return void */
|
|
|
|
public function a(int $i) { }
|
|
|
|
}
|
2017-05-27 02:05:57 +02:00
|
|
|
new A("hello");',
|
|
|
|
],
|
2017-04-25 05:45:02 +02:00
|
|
|
];
|
2016-11-21 20:36:06 +01:00
|
|
|
}
|
|
|
|
}
|