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
4 changes: 2 additions & 2 deletions MO4/Library/PregLibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class PregLibrary
public static function mo4_preg_split($pattern, $subject, $limit=-1, $flags=0): array
{
$pregSplitResult = \preg_split($pattern, $subject, $limit, $flags);
// @phan-suppress-next-line PhanTypeComparisonToArray
if (false === $pregSplitResult) {
// @phan-suppress-next-line PhanTypeComparisonFromArray
if ($pregSplitResult === false) {
throw new RuntimeException('Unexpected Error in MO4 Coding Standard.');
}

Expand Down
2 changes: 1 addition & 1 deletion MO4/Sniffs/Commenting/PropertyCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected function processTokenWithinScope(
$stackPtr,
'NoDocBlockAllowed'
);
} else if (0 !== \strpos($tokens[$postComment]['content'], '//')
} else if (\strpos($tokens[$postComment]['content'], '//') !== 0
&& \substr($tokens[$postComment]['content'], -2) !== '*/'
) {
$phpcsFile->addError(
Expand Down
6 changes: 3 additions & 3 deletions MO4/Sniffs/Formatting/AlphabeticalUseStatementsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function process(File $phpcsFile, $stackPtr): void

// Ignore function () use () {...}.
$isNonImportUse = $this->checkIsNonImportUse($phpcsFile, $stackPtr);
if (true === $isNonImportUse) {
if ($isNonImportUse === true) {
return;
}

Expand Down Expand Up @@ -137,7 +137,7 @@ public function process(File $phpcsFile, $stackPtr): void
$fixable = $phpcsFile->addFixableError($msg, $currentPtr, $code, [$this->order]);
}

if (true === $fixable) {
if ($fixable === true) {
// Find the correct position in current use block.
$newDestinationPtr
= $this->findNewDestination($phpcsFile, $stackPtr, $currentImport);
Expand Down Expand Up @@ -241,7 +241,7 @@ private function checkIsNonImportUse(File $phpcsFile, int $stackPtr): bool
true
);

if (false !== $prev) {
if ($prev !== false) {
$prevToken = $tokens[$prev];

if ($prevToken['code'] === T_CLOSE_PARENTHESIS) {
Expand Down
10 changes: 5 additions & 5 deletions MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function process(File $phpcsFile, $stackPtr): void
);

foreach ($typeTokens as $typeToken) {
if (true === \in_array($typeToken, $useStatements, true)) {
if (\in_array($typeToken, $useStatements, true) === true) {
continue;
}

Expand Down Expand Up @@ -287,7 +287,7 @@ protected function getNamespace(File $phpcsFile, int $start, int $end): string
true
);

if (false === $namespaceStart) {
if ($namespaceStart === false) {
return '';
}

Expand Down Expand Up @@ -389,9 +389,9 @@ private function checkShorthandPossible(
);
}//end if

if (true === $fixable) {
if ($fixable === true) {
$phpcsFile->fixer->beginChangeset();
if (true === $isDocBlock) {
if ($isDocBlock === true) {
$tokens = $phpcsFile->getTokens();
$oldContent = $tokens[$startPtr]['content'];
$newContent = \str_replace($className, $replacement, $oldContent);
Expand All @@ -401,7 +401,7 @@ private function checkShorthandPossible(
$phpcsFile->fixer->replaceToken($i, '');
}

if (true === $replaceClassName) {
if ($replaceClassName === true) {
$phpcsFile->fixer->replaceToken($endPtr, $replacement);
}
}
Expand Down