Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEAR/ValidDefaultValue: move syntax error to its own file #550

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,3 @@ class ConstructorPropertyPromotionMixedWithNormalParams {
mixed $requiredParam,
) {}
}

// Intentional syntax error. Must be last thing in the file.
function
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

// Intentional syntax error.
// This should be the only test in this file.
// Testing that the sniff is *not* triggered.

function
36 changes: 22 additions & 14 deletions src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,31 @@ final class ValidDefaultValueUnitTest extends AbstractSniffUnitTest
* The key of the array should represent the line number and the value
* should represent the number of errors that should occur on that line.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
public function getErrorList()
public function getErrorList($testFile='')
{
return [
29 => 1,
34 => 1,
39 => 1,
71 => 1,
76 => 1,
81 => 1,
91 => 1,
99 => 1,
101 => 1,
106 => 1,
114 => 1,
];
switch ($testFile) {
case 'ValidDefaultValueUnitTest.1.inc':
return [
29 => 1,
34 => 1,
39 => 1,
71 => 1,
76 => 1,
81 => 1,
91 => 1,
99 => 1,
101 => 1,
106 => 1,
114 => 1,
];

default:
return [];
}

}//end getErrorList()

Expand Down