Skip to content

Commit

Permalink
Enable casing plugin and fix issues it found
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jan 12, 2019
1 parent a49b5af commit b43a6a3
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
<file name="src/Psalm/Internal/Stubs/SabreEvent.php"/>
</stubs>

<plugins>
<plugin filename="examples/plugins/FunctionCasingChecker.php" />
</plugins>

<issueHandlers>
<MisplacedRequiredParam errorLevel="suppress"/>
<PossiblyNullOperand errorLevel="suppress"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public static function loadFromXML($base_dir, $file_contents)

$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
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Config/FileFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static function loadFromXMLElement(

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) {
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Analyzer/ClassAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ function (FunctionLikeParameter $param) {
$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();
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/PluginManager/ConfigFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private function readXml(): DomDocument
}
}

$doc->loadXml($file_contents);
$doc->loadXML($file_contents);
return $doc;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/DocumentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function testInvalidCode($code, $error_message, $error_levels = [], $chec
}

$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';

Expand Down
2 changes: 1 addition & 1 deletion tests/FileUpdates/ErrorAfterUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testErrorAfterUpdate(
}

$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));

Expand Down
2 changes: 1 addition & 1 deletion tests/IncludeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testInvalidInclude(
$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();

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function setUp()
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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Traits/InvalidCodeAnalysisTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testInvalidCode($code, $error_message, $error_levels = [], $stri
}

$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';

Expand Down
2 changes: 1 addition & 1 deletion tests/UnusedCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testInvalidCode($code, $error_message, $error_levels = [])
}

$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';

Expand Down
2 changes: 1 addition & 1 deletion tests/UnusedVariableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testInvalidCode($code, $error_message, $error_levels = [])
}

$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';

Expand Down

0 comments on commit b43a6a3

Please sign in to comment.