Skip to content

Commit

Permalink
Added support for a string phpcodesniffer-search-depth config value i…
Browse files Browse the repository at this point in the history
…n order to support setting it with `composer config`.
  • Loading branch information
TravisCarden committed Sep 9, 2019
1 parent e749410 commit 89a525e
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 89a525e

Please sign in to comment.