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
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,8 @@ $var = (int)
$var1 + (bool) $var2;
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines false
// phpcs:set Generic.Formatting.SpaceAfterCast spacing 1

$var = (boolean)/* comment */ $var2;

$var = ( int )$spacesInsideParenthesis;
$var = ( int )$tabsInsideParenthesis;
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,8 @@ $var = (int)
$var1 + (bool)$var2;
// phpcs:set Generic.Formatting.SpaceAfterCast ignoreNewlines false
// phpcs:set Generic.Formatting.SpaceAfterCast spacing 1

$var = (boolean)/* comment */ $var2;

$var = ( int ) $spacesInsideParenthesis;
$var = ( int ) $tabsInsideParenthesis;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$var = (int)
93 changes: 52 additions & 41 deletions src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,61 @@ final class SpaceAfterCastUnitTest 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 test file to run.
*
* @return array<int, int>
*/
public function getErrorList()
public function getErrorList($testFile='')
{
return [
4 => 1,
5 => 1,
8 => 1,
9 => 1,
12 => 1,
13 => 1,
16 => 1,
17 => 1,
20 => 1,
21 => 1,
24 => 1,
25 => 1,
28 => 1,
29 => 1,
32 => 1,
33 => 1,
36 => 1,
37 => 1,
40 => 1,
41 => 1,
44 => 1,
45 => 1,
51 => 1,
53 => 1,
55 => 1,
58 => 1,
64 => 1,
72 => 1,
73 => 1,
75 => 1,
76 => 1,
78 => 1,
82 => 1,
84 => 1,
85 => 1,
86 => 1,
88 => 1,
93 => 1,
];
switch ($testFile) {
case 'SpaceAfterCastUnitTest.1.inc':
return [
4 => 1,
5 => 1,
8 => 1,
9 => 1,
12 => 1,
13 => 1,
16 => 1,
17 => 1,
20 => 1,
21 => 1,
24 => 1,
25 => 1,
28 => 1,
29 => 1,
32 => 1,
33 => 1,
36 => 1,
37 => 1,
40 => 1,
41 => 1,
44 => 1,
45 => 1,
51 => 1,
53 => 1,
55 => 1,
58 => 1,
64 => 1,
72 => 1,
73 => 1,
75 => 1,
76 => 1,
78 => 1,
82 => 1,
84 => 1,
85 => 1,
86 => 1,
88 => 1,
93 => 1,
97 => 1,
99 => 1,
100 => 1,
];

default:
return [];
}//end switch

}//end getErrorList()

Expand Down