From ec85096c9651491ff3186874ea3e8a8e961ee7d4 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sat, 23 Feb 2019 23:22:39 +0200 Subject: [PATCH] Fixed identified issues --- psalm.xml.dist | 10 +++++----- tests/DocumentationTest.php | 4 ++-- tests/FileDiffTest.php | 5 ++++- tests/FileManipulationTest.php | 2 +- tests/FileReferenceTest.php | 5 +++-- tests/FileUpdates/AnalyzedMethodTest.php | 2 +- tests/FileUpdates/ErrorAfterUpdateTest.php | 4 ++-- tests/FileUpdates/ErrorFixTest.php | 4 ++-- tests/FileUpdates/TemporaryUpdateTest.php | 2 +- tests/IncludeTest.php | 6 +++--- tests/JsonOutputTest.php | 2 +- tests/LanguageServer/SymbolLookupTest.php | 2 -- tests/TypeCombinationTest.php | 2 +- tests/TypeReconciliationTest.php | 4 ++-- tests/UnusedCodeTest.php | 6 +++--- tests/UnusedVariableTest.php | 6 +++--- 16 files changed, 34 insertions(+), 32 deletions(-) diff --git a/psalm.xml.dist b/psalm.xml.dist index b3ee281b0..722318a6f 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -21,7 +21,7 @@ - + @@ -41,8 +41,8 @@ - - + + @@ -76,7 +76,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/tests/DocumentationTest.php b/tests/DocumentationTest.php index c18e847a5..3f5141e94 100644 --- a/tests/DocumentationTest.php +++ b/tests/DocumentationTest.php @@ -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 */ public function providerInvalidCodeParse() { diff --git a/tests/FileDiffTest.php b/tests/FileDiffTest.php index ecb9b5f94..4f767e383 100644 --- a/tests/FileDiffTest.php +++ b/tests/FileDiffTest.php @@ -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 $diff_map_offsets * * @return void */ @@ -192,7 +195,7 @@ class FileDiffTest extends TestCase } /** - * @return array + * @return array}> */ public function getChanges() { diff --git a/tests/FileManipulationTest.php b/tests/FileManipulationTest.php index 017f0ee6d..e2b6b8deb 100644 --- a/tests/FileManipulationTest.php +++ b/tests/FileManipulationTest.php @@ -84,7 +84,7 @@ class FileManipulationTest extends TestCase } /** - * @return array + * @return array */ public function providerValidCodeParse() { diff --git a/tests/FileReferenceTest.php b/tests/FileReferenceTest.php index a2a416f42..0b0a8b730 100644 --- a/tests/FileReferenceTest.php +++ b/tests/FileReferenceTest.php @@ -81,6 +81,7 @@ class FileReferenceTest extends TestCase * @dataProvider providerReferencedMethods * * @param string $input_code + * @param array> $expected_referenced_methods * * @return void */ @@ -105,7 +106,7 @@ class FileReferenceTest extends TestCase } /** - * @return array + * @return array}> */ public function providerReferenceLocations() { @@ -132,7 +133,7 @@ class FileReferenceTest extends TestCase } /** - * @return array + * @return array>}> */ public function providerReferencedMethods() { diff --git a/tests/FileUpdates/AnalyzedMethodTest.php b/tests/FileUpdates/AnalyzedMethodTest.php index a8b9859b3..7dfc80ccb 100644 --- a/tests/FileUpdates/AnalyzedMethodTest.php +++ b/tests/FileUpdates/AnalyzedMethodTest.php @@ -105,7 +105,7 @@ class AnalyzedMethodTest extends \Psalm\Tests\TestCase } /** - * @return array + * @return array,end_files:array,initial_analyzed_methods:array>,unaffected_analyzed_methods:array>,4?:array}> */ public function providerTestValidUpdates() { diff --git a/tests/FileUpdates/ErrorAfterUpdateTest.php b/tests/FileUpdates/ErrorAfterUpdateTest.php index a9995143c..87415e106 100644 --- a/tests/FileUpdates/ErrorAfterUpdateTest.php +++ b/tests/FileUpdates/ErrorAfterUpdateTest.php @@ -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>,error_message:string}> */ public function providerTestInvalidUpdates() { diff --git a/tests/FileUpdates/ErrorFixTest.php b/tests/FileUpdates/ErrorFixTest.php index ee6216ac6..8e70d35bb 100644 --- a/tests/FileUpdates/ErrorFixTest.php +++ b/tests/FileUpdates/ErrorFixTest.php @@ -117,7 +117,7 @@ class ErrorFixTest extends \Psalm\Tests\TestCase } /** - * @return array + * @return array,middle_files:array,end_files:array,error_counts:array,error_levels?:array}> */ public function providerTestErrorFix() { @@ -264,7 +264,7 @@ class ErrorFixTest extends \Psalm\Tests\TestCase } }', ], - 'error_positions' => [0, 1, 0], + 'error_counts' => [0, 1, 0], ], ]; } diff --git a/tests/FileUpdates/TemporaryUpdateTest.php b/tests/FileUpdates/TemporaryUpdateTest.php index ad6f069d9..ad81d95b2 100644 --- a/tests/FileUpdates/TemporaryUpdateTest.php +++ b/tests/FileUpdates/TemporaryUpdateTest.php @@ -122,7 +122,7 @@ class TemporaryUpdateTest extends \Psalm\Tests\TestCase } /** - * @return array + * @return array>,error_positions:array>, error_levels?:array}> */ public function providerTestErrorFix() { diff --git a/tests/IncludeTest.php b/tests/IncludeTest.php index 658e76838..cffbf938c 100644 --- a/tests/IncludeTest.php +++ b/tests/IncludeTest.php @@ -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,files_to_check:array}> */ public function providerTestValidIncludes() { @@ -495,7 +495,7 @@ class IncludeTest extends TestCase } /** - * @return array + * @return array,files_to_check:array,error_message:string}> */ public function providerTestInvalidIncludes() { diff --git a/tests/JsonOutputTest.php b/tests/JsonOutputTest.php index 1bc75f923..33f08533a 100644 --- a/tests/JsonOutputTest.php +++ b/tests/JsonOutputTest.php @@ -188,7 +188,7 @@ echo $a;'; } /** - * @return array + * @return array */ public function providerTestJsonOutputErrors() { diff --git a/tests/LanguageServer/SymbolLookupTest.php b/tests/LanguageServer/SymbolLookupTest.php index fa433e370..6ce00b2ad 100644 --- a/tests/LanguageServer/SymbolLookupTest.php +++ b/tests/LanguageServer/SymbolLookupTest.php @@ -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); diff --git a/tests/TypeCombinationTest.php b/tests/TypeCombinationTest.php index 85f9386c0..660ccfeb2 100644 --- a/tests/TypeCombinationTest.php +++ b/tests/TypeCombinationTest.php @@ -57,7 +57,7 @@ class TypeCombinationTest extends TestCase } /** - * @return array + * @return array}> */ public function providerTestValidTypeCombination() { diff --git a/tests/TypeReconciliationTest.php b/tests/TypeReconciliationTest.php index de33af7e3..aec390a1c 100644 --- a/tests/TypeReconciliationTest.php +++ b/tests/TypeReconciliationTest.php @@ -182,7 +182,7 @@ class TypeReconciliationTest extends TestCase } /** - * @return array + * @return array */ public function providerTestReconcilation() { @@ -233,7 +233,7 @@ class TypeReconciliationTest extends TestCase } /** - * @return array + * @return array */ public function providerTestTypeIsContainedBy() { diff --git a/tests/UnusedCodeTest.php b/tests/UnusedCodeTest.php index 8c41bdc93..8f9eb8a81 100644 --- a/tests/UnusedCodeTest.php +++ b/tests/UnusedCodeTest.php @@ -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 */ public function providerValidCodeParse() { @@ -339,7 +339,7 @@ class UnusedCodeTest extends TestCase } /** - * @return array + * @return array */ public function providerInvalidCodeParse() { diff --git a/tests/UnusedVariableTest.php b/tests/UnusedVariableTest.php index ebe71a29f..3b81c868e 100644 --- a/tests/UnusedVariableTest.php +++ b/tests/UnusedVariableTest.php @@ -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 */ public function providerInvalidCodeParse() {