Skip to content
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
12 changes: 12 additions & 0 deletions src/Standards/Squiz/Tests/PHP/HeredocUnitTest.1.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;

echo <<<'EOT'
My name is "$name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should not print a capital 'A': \x41
EOT;
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
<?php
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;

echo <<<'EOT'
My name is "$name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should not print a capital 'A': \x41
EOT;

// Intentional parse error.
// The following function has a simulated git conflict for testing.
// This is not a merge conflict - it is a valid test case.
// Please do not remove.
Expand Down
18 changes: 13 additions & 5 deletions src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@ class HeredocUnitTest 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 [
2 => 1,
8 => 1,
];
switch ($testFile) {
case 'HeredocUnitTest.1.inc':
return [
2 => 1,
8 => 1,
];

default:
return [];
}//end switch

}//end getErrorList()

Expand Down