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 @@ -19,13 +19,6 @@
class MultipleStatementAlignmentSniff implements Sniff
{

/**
* If true, an error will be thrown; otherwise a warning.
*
* @var boolean
*/
public $error = false;

/**
* The maximum amount of padding before the alignment is ignored.
*
Expand Down Expand Up @@ -377,11 +370,7 @@ public function checkAlignment($phpcsFile, $stackPtr, $end=null)
$foundText,
];

if ($this->error === true) {
$fix = $phpcsFile->addFixableError($error, $assignment, $type, $errorData);
} else {
$fix = $phpcsFile->addFixableWarning($error, $assignment, $type.'Warning', $errorData);
}
$fix = $phpcsFile->addFixableWarning($error, $assignment, $type, $errorData);

$errorGenerated = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
class UnnecessaryStringConcatSniff implements Sniff
{

/**
* If true, an error will be thrown; otherwise a warning.
*
* @var boolean
*/
public $error = true;

/**
* If true, strings concatenated over multiple lines are allowed.
*
Expand Down Expand Up @@ -94,11 +87,7 @@ public function process(File $phpcsFile, $stackPtr)
}

$error = 'String concat is not required here; use a single string instead';
if ($this->error === true) {
$phpcsFile->addError($error, $stackPtr, 'Found');
} else {
$phpcsFile->addWarning($error, $stackPtr, 'Found');
}
$phpcsFile->addError($error, $stackPtr, 'Found');

}//end process()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,3 @@ $shouldNotTrigger = 'My' /* comment */ . 'string';
$string = 'Multiline strings are allowed '
. 'when setting is enabled.';
// phpcs:set Generic.Strings.UnnecessaryStringConcat allowMultiline false

// phpcs:set Generic.Strings.UnnecessaryStringConcat error false
$throwWarning = 'My' . 'string';
// phpcs:set Generic.Strings.UnnecessaryStringConcat error true
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,11 @@ public function getErrorList($testFile='')
* The key of the array should represent the line number and the value
* should represent the number of warnings that should occur on that line.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
public function getWarningList($testFile='')
public function getWarningList()
{
switch ($testFile) {
case 'UnnecessaryStringConcatUnitTest.1.inc':
return [
33 => 1,
];

default:
return [];
}
return [];

}//end getWarningList()

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Squiz/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@

<!-- Have 20 chars padding maximum and always show as errors -->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<type>error</type>
<properties>
<property name="maxPadding" value="20"/>
<property name="error" value="true"/>
</properties>
</rule>

Expand Down