1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fixed identified issues

This commit is contained in:
Bruce Weirdan 2019-02-23 23:22:39 +02:00 committed by Matthew Brown
parent 191f8da41f
commit ec85096c96
16 changed files with 34 additions and 32 deletions

View File

@ -21,7 +21,7 @@
<directory name="tests/stubs"/>
<directory name="tests/DummyProject"/>
<file name="vendor/phpunit/phpunit/src/Framework/TestCase.php"/>
<file name="vendor/symfony/console/Command/Command.php" />
<file name="vendor/symfony/console/Command/Command.php"/>
<file name="src/Psalm/Internal/Traverser/CustomTraverser.php"/>
<file name="vendor/felixfbecker/advanced-json-rpc/lib/Dispatcher.php" />
<file name="tests/performance/a.test"/>
@ -41,8 +41,8 @@
</stubs>
<plugins>
<plugin filename="examples/plugins/FunctionCasingChecker.php" />
</plugins>
<plugin filename="examples/plugins/FunctionCasingChecker.php"/>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/></plugins>
<issueHandlers>
<MisplacedRequiredParam errorLevel="suppress"/>
@ -76,7 +76,7 @@
<errorLevel type="suppress">
<directory name="examples"/>
<directory name="tests"/>
<file name="src/Psalm/Plugin/Hook/MethodReturnTypeProviderInterface.php" />
<file name="src/Psalm/Plugin/Hook/MethodReturnTypeProviderInterface.php"/>
</errorLevel>
</UnusedClass>
@ -91,7 +91,7 @@
<file name="src/Psalm/Internal/LanguageServer/LanguageClient.php"/>
<file name="src/Psalm/Storage/FunctionLikeStorage.php"/>
<file name="src/Psalm/Type/Atomic/TNonEmptyArray.php"/>
<file name="src/Psalm/Storage/PropertyStorage.php" />
<file name="src/Psalm/Storage/PropertyStorage.php"/>
</errorLevel>
</PossiblyUnusedProperty>

View File

@ -126,7 +126,7 @@ class DocumentationTest extends TestCase
$this->project_analyzer->getCodebase()->config->setCustomErrorLevel($error_level, Config::REPORT_SUPPRESS);
}
$this->expectException('\Psalm\Exception\CodeException');
$this->expectException(\Psalm\Exception\CodeException::class);
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
$file_path = self::$src_dir_path . 'somefile.php';
@ -144,7 +144,7 @@ class DocumentationTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,string,string[],bool}>
*/
public function providerInvalidCodeParse()
{

View File

@ -69,6 +69,9 @@ class FileDiffTest extends TestCase
* @param string $a
* @param string $b
* @param string[] $same_methods
* @param string[] $same_signatures
* @param string[] $changed_methods
* @param array<array-key,array{int,int}> $diff_map_offsets
*
* @return void
*/
@ -192,7 +195,7 @@ class FileDiffTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,string,string[],string[],string[],array<array-key,array{int,int}>}>
*/
public function getChanges()
{

View File

@ -84,7 +84,7 @@ class FileManipulationTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,string,string,string[],bool}>
*/
public function providerValidCodeParse()
{

View File

@ -81,6 +81,7 @@ class FileReferenceTest extends TestCase
* @dataProvider providerReferencedMethods
*
* @param string $input_code
* @param array<string,array<string,bool>> $expected_referenced_methods
*
* @return void
*/
@ -105,7 +106,7 @@ class FileReferenceTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,string,array<int,string>}>
*/
public function providerReferenceLocations()
{
@ -132,7 +133,7 @@ class FileReferenceTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,array<string,array<string,bool>>}>
*/
public function providerReferencedMethods()
{

View File

@ -105,7 +105,7 @@ class AnalyzedMethodTest extends \Psalm\Tests\TestCase
}
/**
* @return array
* @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>}>
*/
public function providerTestValidUpdates()
{

View File

@ -85,7 +85,7 @@ class ErrorAfterUpdateTest extends \Psalm\Tests\TestCase
$this->file_provider->registerFile($file_path, $contents);
}
$this->expectException('\Psalm\Exception\CodeException');
$this->expectException(\Psalm\Exception\CodeException::class);
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
$codebase->reloadFiles($this->project_analyzer, array_keys($end_files));
@ -98,7 +98,7 @@ class ErrorAfterUpdateTest extends \Psalm\Tests\TestCase
}
/**
* @return array
* @return array<string,array{file_stages:array<int,array<string,string>>,error_message:string}>
*/
public function providerTestInvalidUpdates()
{

View File

@ -117,7 +117,7 @@ class ErrorFixTest extends \Psalm\Tests\TestCase
}
/**
* @return array
* @return array<string,array{start_files:array<string,string>,middle_files:array<string,string>,end_files:array<string,string>,error_counts:array<int,int>,error_levels?:array<string,string>}>
*/
public function providerTestErrorFix()
{
@ -264,7 +264,7 @@ class ErrorFixTest extends \Psalm\Tests\TestCase
}
}',
],
'error_positions' => [0, 1, 0],
'error_counts' => [0, 1, 0],
],
];
}

View File

@ -122,7 +122,7 @@ class TemporaryUpdateTest extends \Psalm\Tests\TestCase
}
/**
* @return array
* @return array<string,array{array<int, array<string, string>>,error_positions:array<int, array<int>>, error_levels?:array<string, string>}>
*/
public function providerTestErrorFix()
{

View File

@ -80,7 +80,7 @@ class IncludeTest extends TestCase
$config = $codebase->config;
$this->expectException('\Psalm\Exception\CodeException');
$this->expectException(\Psalm\Exception\CodeException::class);
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
$codebase->scanFiles();
@ -92,7 +92,7 @@ class IncludeTest extends TestCase
}
/**
* @return array
* @return array<string,array{files:array<string,string>,files_to_check:array<int,string>}>
*/
public function providerTestValidIncludes()
{
@ -495,7 +495,7 @@ class IncludeTest extends TestCase
}
/**
* @return array
* @return array<string,array{files:array<string,string>,files_to_check:array<int,string>,error_message:string}>
*/
public function providerTestInvalidIncludes()
{

View File

@ -188,7 +188,7 @@ echo $a;';
}
/**
* @return array
* @return array<string,array{string,message:string,line:int,error:string}>
*/
public function providerTestJsonOutputErrors()
{

View File

@ -222,14 +222,12 @@ class SymbolLookupTest extends \Psalm\Tests\TestCase
$this->assertSame('type: int|null', $symbol_at_position[0]);
$symbol_at_position = $codebase->getReferenceAtPosition('somefile.php', new Position(12, 30));
assert(!is_null($symbol_at_position));
$this->assertNotNull($symbol_at_position);
$this->assertSame('type: int', $symbol_at_position[0]);
$symbol_at_position = $codebase->getReferenceAtPosition('somefile.php', new Position(17, 30));
assert(!is_null($symbol_at_position));
$this->assertNotNull($symbol_at_position);

View File

@ -57,7 +57,7 @@ class TypeCombinationTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,array<int,string>}>
*/
public function providerTestValidTypeCombination()
{

View File

@ -182,7 +182,7 @@ class TypeReconciliationTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,string,string}>
*/
public function providerTestReconcilation()
{
@ -233,7 +233,7 @@ class TypeReconciliationTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,string}>
*/
public function providerTestTypeIsContainedBy()
{

View File

@ -81,7 +81,7 @@ class UnusedCodeTest extends TestCase
$this->markTestSkipped();
}
$this->expectException('\Psalm\Exception\CodeException');
$this->expectException(\Psalm\Exception\CodeException::class);
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
$file_path = self::$src_dir_path . 'somefile.php';
@ -104,7 +104,7 @@ class UnusedCodeTest extends TestCase
}
/**
* @return array
* @return array<string, array{string}>
*/
public function providerValidCodeParse()
{
@ -339,7 +339,7 @@ class UnusedCodeTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,error_message:string}>
*/
public function providerInvalidCodeParse()
{

View File

@ -81,7 +81,7 @@ class UnusedVariableTest extends TestCase
$this->markTestSkipped();
}
$this->expectException('\Psalm\Exception\CodeException');
$this->expectException(\Psalm\Exception\CodeException::class);
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
$file_path = self::$src_dir_path . 'somefile.php';
@ -104,7 +104,7 @@ class UnusedVariableTest extends TestCase
}
/**
* @return array
* @return array<string, array{string,error_levels?:string[]}
*/
public function providerValidCodeParse()
{
@ -881,7 +881,7 @@ class UnusedVariableTest extends TestCase
}
/**
* @return array
* @return array<string,array{string,error_message:string}>
*/
public function providerInvalidCodeParse()
{