Skip to content

Commit

Permalink
Merge pull request #85 from TravisCarden/issue-82
Browse files Browse the repository at this point in the history
Add support for a string phpcodesniffer-search-depth config value set via `composer config`
  • Loading branch information
Potherca committed Sep 22, 2019
2 parents dda5b1d + 248bee8 commit 6fa8d1e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Plugin.php
Expand Up @@ -441,9 +441,9 @@ private function getMaxDepth()
$maxDepth = $extra[self::KEY_MAX_DEPTH];
$minDepth = $this->getMinDepth();

if (is_int($maxDepth) === false /* Must be an integer */
|| $maxDepth <= $minDepth /* Larger than the minimum */
|| is_float($maxDepth) === true /* Within the boundaries of integer */
if ((string) (int) $maxDepth !== (string) $maxDepth /* Must be an integer or cleanly castable to one */
|| $maxDepth <= $minDepth /* Larger than the minimum */
|| is_float($maxDepth) === true /* Within the boundaries of integer */
) {
$message = vsprintf(
self::MESSAGE_ERROR_WRONG_MAX_DEPTH,
Expand All @@ -458,7 +458,7 @@ private function getMaxDepth()
}
}

return $maxDepth;
return (int) $maxDepth;
}

/**
Expand Down

0 comments on commit 6fa8d1e

Please sign in to comment.