Skip to content

Commit

Permalink
put config to true to prevent deprecations for new config files (#9857)
Browse files Browse the repository at this point in the history
* put config to true to prevent deprecations for new config files
  • Loading branch information
orklah committed Jun 19, 2023
1 parent 8ca4110 commit 8e63608
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/Psalm/Config/Creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ final class Creator
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<directory name="src" />
Expand Down
1 change: 1 addition & 0 deletions tests/Config/CreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function testDiscoverLibDirectory(): void
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<directory name="lib" />
Expand Down
9 changes: 3 additions & 6 deletions tests/EndToEnd/PsalmEndToEndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,9 @@ public function testPsalm(): void
'Target PHP version: 7.1 (inferred from composer.json)',
$result['STDERR'],
);
$this->assertStringContainsString('UnusedParam', $result['STDOUT']);
$this->assertStringContainsString('InvalidReturnType', $result['STDOUT']);
$this->assertStringContainsString('InvalidReturnStatement', $result['STDOUT']);
$this->assertStringContainsString('3 errors', $result['STDOUT']);
$this->assertStringContainsString('2 errors', $result['STDOUT']);
$this->assertSame(2, $result['CODE']);
}

Expand Down Expand Up @@ -153,20 +152,18 @@ public function testPsalmDiff(): void

$this->runPsalmInit(1);
$result = $this->runPsalm(['--diff', '-m'], self::$tmpDir, true);
$this->assertStringContainsString('UnusedParam', $result['STDOUT']);
$this->assertStringContainsString('InvalidReturnType', $result['STDOUT']);
$this->assertStringContainsString('InvalidReturnStatement', $result['STDOUT']);
$this->assertStringContainsString('3 errors', $result['STDOUT']);
$this->assertStringContainsString('2 errors', $result['STDOUT']);
$this->assertStringContainsString('E', $result['STDERR']);

$this->assertSame(2, $result['CODE']);

$result = $this->runPsalm(['--diff', '-m'], self::$tmpDir, true);

$this->assertStringContainsString('UnusedParam', $result['STDOUT']);
$this->assertStringContainsString('InvalidReturnType', $result['STDOUT']);
$this->assertStringContainsString('InvalidReturnStatement', $result['STDOUT']);
$this->assertStringContainsString('3 errors', $result['STDOUT']);
$this->assertStringContainsString('2 errors', $result['STDOUT']);
$this->assertStringNotContainsString('E', $result['STDERR']);

$this->assertSame(2, $result['CODE']);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Acme\SampleProject;

function foo(string $s): int
function foo(string $_s): int
{
return 'bar';
}
Expand Down
36 changes: 18 additions & 18 deletions tests/fixtures/expected_taint_graph.dot
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
digraph Taints {
"$_GET:src/FileWithErrors.php:413" -> "$_GET['abc']-src/FileWithErrors.php:413-417"
"$_GET:src/FileWithErrors.php:440" -> "$_GET['abc']-src/FileWithErrors.php:440-444"
"$_GET:src/FileWithErrors.php:456" -> "$_GET['abc']-src/FileWithErrors.php:456-460"
"$_GET['abc']-src/FileWithErrors.php:440-444" -> "call to is_string-src/FileWithErrors.php:440-451"
"$_GET['abc']-src/FileWithErrors.php:456-460" -> "call to echo-src/FileWithErrors.php:407-473"
"$s-src/FileWithErrors.php:109-110" -> "variable-use" -> "acme\sampleproject\bar"
"$s-src/FileWithErrors.php:162-163" -> "variable-use" -> "acme\sampleproject\baz"
"$s-src/FileWithErrors.php:215-216" -> "variable-use" -> "acme\sampleproject\bat"
"$s-src/FileWithErrors.php:269-270" -> "variable-use" -> "acme\sampleproject\bang"
"acme\sampleproject\bang#1" -> "$s-src/FileWithErrors.php:269-270"
"acme\sampleproject\bar#1" -> "$s-src/FileWithErrors.php:109-110"
"acme\sampleproject\bat#1" -> "$s-src/FileWithErrors.php:215-216"
"acme\sampleproject\baz#1" -> "$s-src/FileWithErrors.php:162-163"
"acme\sampleproject\foo#1" -> "$s-src/FileWithErrors.php:57-58"
"call to echo-src/FileWithErrors.php:335-367" -> "echo#1-src/filewitherrors.php:330"
"call to echo-src/FileWithErrors.php:407-473" -> "echo#1-src/filewitherrors.php:402"
"call to is_string-src/FileWithErrors.php:440-451" -> "is_string#1-src/filewitherrors.php:430"
"coalesce-src/FileWithErrors.php:345-366" -> "call to echo-src/FileWithErrors.php:335-367"
"$_GET:src/FileWithErrors.php:414" -> "$_GET['abc']-src/FileWithErrors.php:414-418"
"$_GET:src/FileWithErrors.php:441" -> "$_GET['abc']-src/FileWithErrors.php:441-445"
"$_GET:src/FileWithErrors.php:457" -> "$_GET['abc']-src/FileWithErrors.php:457-461"
"$_GET['abc']-src/FileWithErrors.php:441-445" -> "call to is_string-src/FileWithErrors.php:441-452"
"$_GET['abc']-src/FileWithErrors.php:457-461" -> "call to echo-src/FileWithErrors.php:408-474"
"$s-src/FileWithErrors.php:110-111" -> "variable-use" -> "acme\sampleproject\bar"
"$s-src/FileWithErrors.php:163-164" -> "variable-use" -> "acme\sampleproject\baz"
"$s-src/FileWithErrors.php:216-217" -> "variable-use" -> "acme\sampleproject\bat"
"$s-src/FileWithErrors.php:270-271" -> "variable-use" -> "acme\sampleproject\bang"
"acme\sampleproject\bang#1" -> "$s-src/FileWithErrors.php:270-271"
"acme\sampleproject\bar#1" -> "$s-src/FileWithErrors.php:110-111"
"acme\sampleproject\bat#1" -> "$s-src/FileWithErrors.php:216-217"
"acme\sampleproject\baz#1" -> "$s-src/FileWithErrors.php:163-164"
"acme\sampleproject\foo#1" -> "$_s-src/FileWithErrors.php:57-59"
"call to echo-src/FileWithErrors.php:336-368" -> "echo#1-src/filewitherrors.php:331"
"call to echo-src/FileWithErrors.php:408-474" -> "echo#1-src/filewitherrors.php:403"
"call to is_string-src/FileWithErrors.php:441-452" -> "is_string#1-src/filewitherrors.php:431"
"coalesce-src/FileWithErrors.php:346-367" -> "call to echo-src/FileWithErrors.php:336-368"
}

0 comments on commit 8e63608

Please sign in to comment.