From b43a6a31f1c6d8490849337c8e4a9c0114c42627 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sat, 12 Jan 2019 10:52:23 -0500 Subject: [PATCH] Enable casing plugin and fix issues it found --- psalm.xml.dist | 4 ++++ src/Psalm/Config.php | 2 +- src/Psalm/Config/FileFilter.php | 2 +- src/Psalm/Internal/Analyzer/ClassAnalyzer.php | 2 +- src/Psalm/Internal/PluginManager/ConfigFile.php | 2 +- tests/DocumentationTest.php | 2 +- tests/FileUpdates/ErrorAfterUpdateTest.php | 2 +- tests/IncludeTest.php | 2 +- tests/TestCase.php | 2 +- tests/Traits/InvalidCodeAnalysisTestTrait.php | 2 +- tests/UnusedCodeTest.php | 2 +- tests/UnusedVariableTest.php | 2 +- 12 files changed, 15 insertions(+), 11 deletions(-) diff --git a/psalm.xml.dist b/psalm.xml.dist index f07746d32..b0888f90b 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -38,6 +38,10 @@ + + + + diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 687b9572e..7b66b32d9 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -463,7 +463,7 @@ class Config $old_dom_document = $dom_document; $dom_document = new \DOMDocument(); - $dom_document->loadXML($old_dom_document->saveXml()); + $dom_document->loadXML($old_dom_document->saveXML()); } // Enable user error handling diff --git a/src/Psalm/Config/FileFilter.php b/src/Psalm/Config/FileFilter.php index 4225e60b7..be9de304e 100644 --- a/src/Psalm/Config/FileFilter.php +++ b/src/Psalm/Config/FileFilter.php @@ -150,7 +150,7 @@ class FileFilter while ($iterator->valid()) { if (!$iterator->isDot() && $iterator->isLink()) { - $linked_path = readlink($iterator->getPathName()); + $linked_path = readlink($iterator->getPathname()); if (stripos($linked_path, $directory_path) !== 0) { if ($ignore_type_stats && $filter instanceof ProjectFileFilter) { diff --git a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php index 34fb20571..534427e35 100644 --- a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php @@ -694,7 +694,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer $fake_param = (new PhpParser\Builder\Param($param->name)); if ($param->signature_type) { /** @psalm-suppress DeprecatedMethod */ - $fake_param->setTypehint((string)$param->signature_type); + $fake_param->setTypeHint((string)$param->signature_type); } return $fake_param->getNode(); diff --git a/src/Psalm/Internal/PluginManager/ConfigFile.php b/src/Psalm/Internal/PluginManager/ConfigFile.php index f599b0a83..29e7a2410 100644 --- a/src/Psalm/Internal/PluginManager/ConfigFile.php +++ b/src/Psalm/Internal/PluginManager/ConfigFile.php @@ -111,7 +111,7 @@ class ConfigFile } } - $doc->loadXml($file_contents); + $doc->loadXML($file_contents); return $doc; } diff --git a/tests/DocumentationTest.php b/tests/DocumentationTest.php index 6ea33f535..12bba07db 100644 --- a/tests/DocumentationTest.php +++ b/tests/DocumentationTest.php @@ -125,7 +125,7 @@ class DocumentationTest extends TestCase } $this->expectException('\Psalm\Exception\CodeException'); - $this->expectExceptionMessageRegexp('/\b' . preg_quote($error_message, '/') . '\b/'); + $this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/'); $file_path = self::$src_dir_path . 'somefile.php'; diff --git a/tests/FileUpdates/ErrorAfterUpdateTest.php b/tests/FileUpdates/ErrorAfterUpdateTest.php index d493e3250..ef33d2325 100644 --- a/tests/FileUpdates/ErrorAfterUpdateTest.php +++ b/tests/FileUpdates/ErrorAfterUpdateTest.php @@ -87,7 +87,7 @@ class ErrorAfterUpdateTest extends \Psalm\Tests\TestCase } $this->expectException('\Psalm\Exception\CodeException'); - $this->expectExceptionMessageRegexp('/\b' . preg_quote($error_message, '/') . '\b/'); + $this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/'); $codebase->reloadFiles($this->project_analyzer, array_keys($end_files)); diff --git a/tests/IncludeTest.php b/tests/IncludeTest.php index 938a83e7c..658e76838 100644 --- a/tests/IncludeTest.php +++ b/tests/IncludeTest.php @@ -81,7 +81,7 @@ class IncludeTest extends TestCase $config = $codebase->config; $this->expectException('\Psalm\Exception\CodeException'); - $this->expectExceptionMessageRegexp('/\b' . preg_quote($error_message, '/') . '\b/'); + $this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/'); $codebase->scanFiles(); diff --git a/tests/TestCase.php b/tests/TestCase.php index 913ee7a44..d9424188d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -78,7 +78,7 @@ class TestCase extends BaseTestCase public function addFile($file_path, $contents) { $this->file_provider->registerFile($file_path, $contents); - $this->project_analyzer->getCodeBase()->scanner->addFileToShallowScan($file_path); + $this->project_analyzer->getCodebase()->scanner->addFileToShallowScan($file_path); } /** diff --git a/tests/Traits/InvalidCodeAnalysisTestTrait.php b/tests/Traits/InvalidCodeAnalysisTestTrait.php index 0b046999b..8ce04f496 100644 --- a/tests/Traits/InvalidCodeAnalysisTestTrait.php +++ b/tests/Traits/InvalidCodeAnalysisTestTrait.php @@ -44,7 +44,7 @@ trait InvalidCodeAnalysisTestTrait } $this->expectException('\Psalm\Exception\CodeException'); - $this->expectExceptionMessageRegexp('/\b' . preg_quote($error_message, '/') . '\b/'); + $this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/'); $file_path = self::$src_dir_path . 'somefile.php'; diff --git a/tests/UnusedCodeTest.php b/tests/UnusedCodeTest.php index 8b3944c52..d903f9221 100644 --- a/tests/UnusedCodeTest.php +++ b/tests/UnusedCodeTest.php @@ -87,7 +87,7 @@ class UnusedCodeTest extends TestCase } $this->expectException('\Psalm\Exception\CodeException'); - $this->expectExceptionMessageRegexp('/\b' . preg_quote($error_message, '/') . '\b/'); + $this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/'); $file_path = self::$src_dir_path . 'somefile.php'; diff --git a/tests/UnusedVariableTest.php b/tests/UnusedVariableTest.php index 181009314..5604f8b84 100644 --- a/tests/UnusedVariableTest.php +++ b/tests/UnusedVariableTest.php @@ -87,7 +87,7 @@ class UnusedVariableTest extends TestCase } $this->expectException('\Psalm\Exception\CodeException'); - $this->expectExceptionMessageRegexp('/\b' . preg_quote($error_message, '/') . '\b/'); + $this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/'); $file_path = self::$src_dir_path . 'somefile.php';