Fix coding standards
[MAILPOET-3732]
This commit is contained in:
@@ -12,8 +12,6 @@ use PHP_CodeSniffer\Sniffs\Sniff;
|
||||
use PHP_CodeSniffer\Util\Tokens;
|
||||
|
||||
class FunctionDeclarationSniff implements Sniff {
|
||||
|
||||
|
||||
/**
|
||||
* A list of tokenizers this sniff supports.
|
||||
*
|
||||
@@ -302,7 +300,8 @@ class FunctionDeclarationSniff implements Sniff {
|
||||
// We changed lines, so this should be a whitespace indent token.
|
||||
if ($tokens[$i]['code'] !== T_WHITESPACE) {
|
||||
$foundIndent = 0;
|
||||
} else if ($tokens[$i]['line'] !== $tokens[($i + 1)]['line']) {
|
||||
} else {
|
||||
if ($tokens[$i]['line'] !== $tokens[($i + 1)]['line']) {
|
||||
// This is an empty line, so don't check the indent.
|
||||
$foundIndent = $expectedIndent;
|
||||
|
||||
@@ -314,6 +313,7 @@ class FunctionDeclarationSniff implements Sniff {
|
||||
} else {
|
||||
$foundIndent = $tokens[$i]['length'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($expectedIndent !== $foundIndent) {
|
||||
$error = 'Multi-line ' . $type . ' declaration not indented correctly; expected %s spaces but found %s';
|
||||
|
@@ -105,14 +105,15 @@ class ShortcodesTest extends \MailPoetTest {
|
||||
$shortcode = ['[some:shortcode arg1="val1" arg2="val2"]']; // WP style arguments
|
||||
$result = $shortcodesObject->process($shortcode);
|
||||
expect($result[0])->false();
|
||||
add_filter('mailpoet_newsletter_shortcode', function(
|
||||
$shortcode, $newsletter, $subscriber, $queue, $content, $arguments
|
||||
) {
|
||||
add_filter(
|
||||
'mailpoet_newsletter_shortcode',
|
||||
function($shortcode, $newsletter, $subscriber, $queue, $content, $arguments) {
|
||||
expect($arguments)->count(2);
|
||||
expect($arguments['arg1'])->equals('val1');
|
||||
expect($arguments['arg2'])->equals('val2');
|
||||
if (strpos($shortcode, '[some:shortcode') === 0) return 'success';
|
||||
}, 10, 6);
|
||||
}, 10, 6
|
||||
);
|
||||
$result = $shortcodesObject->process($shortcode);
|
||||
expect($result[0])->equals('success');
|
||||
}
|
||||
|
Reference in New Issue
Block a user