Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for a string phpcodesniffer-search-depth config value set via composer config #85

Merged
merged 1 commit into from Sep 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 */
Potherca marked this conversation as resolved.
Show resolved Hide resolved
|| $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