Created
February 27, 2015 14:09
-
-
Save beberlei/6a5a6b65839d35bb27f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main/php/PDepend/Engine.php b/src/main/php/PDepend/Engine.php | |
index 6675b21..4efe826 100644 | |
--- a/src/main/php/PDepend/Engine.php | |
+++ b/src/main/php/PDepend/Engine.php | |
@@ -213,7 +213,7 @@ class Engine | |
{ | |
$dir = realpath($directory); | |
- if (!is_dir($dir)) { | |
+ if (!is_dir((string)$dir)) { | |
throw new \InvalidArgumentException("Invalid directory '{$directory}' added."); | |
} | |
@@ -230,7 +230,7 @@ class Engine | |
{ | |
$fileName = realpath($file); | |
- if (!is_file($fileName)) { | |
+ if (!is_file((string)$fileName)) { | |
throw new \InvalidArgumentException(sprintf('The given file "%s" does not exist.', $file)); | |
} | |
diff --git a/src/main/php/PDepend/Input/ExcludePathFilter.php b/src/main/php/PDepend/Input/ExcludePathFilter.php | |
index 370ba23..fee28b6 100644 | |
--- a/src/main/php/PDepend/Input/ExcludePathFilter.php | |
+++ b/src/main/php/PDepend/Input/ExcludePathFilter.php | |
@@ -118,6 +118,6 @@ class ExcludePathFilter implements Filter | |
*/ | |
protected function notRelative($path) | |
{ | |
- return (preg_match($this->relative, $path) === 0); | |
+ return (preg_match($this->relative, (string)$path) === 0); | |
} | |
} | |
diff --git a/src/main/php/PDepend/Input/ExtensionFilter.php b/src/main/php/PDepend/Input/ExtensionFilter.php | |
index 5451123..1850d85 100644 | |
--- a/src/main/php/PDepend/Input/ExtensionFilter.php | |
+++ b/src/main/php/PDepend/Input/ExtensionFilter.php | |
@@ -77,7 +77,7 @@ class ExtensionFilter implements Filter | |
*/ | |
public function accept($relative, $absolute) | |
{ | |
- $extension = pathinfo($relative, PATHINFO_EXTENSION); | |
+ $extension = pathinfo((string)$relative, PATHINFO_EXTENSION); | |
return in_array($extension, $this->extensions); | |
} | |
diff --git a/src/main/php/PDepend/Report/Jdepend/Chart.php b/src/main/php/PDepend/Report/Jdepend/Chart.php | |
index ea03fbe..8d48b14 100644 | |
--- a/src/main/php/PDepend/Report/Jdepend/Chart.php | |
+++ b/src/main/php/PDepend/Report/Jdepend/Chart.php | |
@@ -196,9 +196,9 @@ class Chart extends AbstractASTVisitor implements CodeAwareGenerator, FileAwareG | |
foreach ($items as $item) { | |
if ($item['distance'] < $bias) { | |
- $ellipse = $good->cloneNode(true); | |
+ $ellipse = $good->cloneNode(1); | |
} else { | |
- $ellipse = $bad->cloneNode(true); | |
+ $ellipse = $bad->cloneNode(1); | |
} | |
$r = 15; | |
if ($diff !== 0) { | |
diff --git a/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php b/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php | |
index ac7128b..385a876 100644 | |
--- a/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php | |
+++ b/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php | |
@@ -582,7 +582,7 @@ class PHPTokenizerInternal implements Tokenizer | |
$startColumn += strlen($token[1]); | |
} else { | |
$startColumn = strlen( | |
- substr($token[1], strrpos($token[1], "\n") + 1) | |
+ (string)substr($token[1], strrpos($token[1], "\n") + 1) | |
) + 1; | |
} | |
@@ -638,7 +638,7 @@ class PHPTokenizerInternal implements Tokenizer | |
$startColumn += strlen($image); | |
} else { | |
$startColumn = strlen( | |
- substr($image, strrpos($image, "\n") + 1) | |
+ (string)substr($image, strrpos($image, "\n") + 1) | |
) + 1; | |
} | |
diff --git a/src/main/php/PDepend/TextUI/Runner.php b/src/main/php/PDepend/TextUI/Runner.php | |
index d34d48f..2e4e09b 100644 | |
--- a/src/main/php/PDepend/TextUI/Runner.php | |
+++ b/src/main/php/PDepend/TextUI/Runner.php | |
@@ -317,7 +317,7 @@ class Runner | |
$this->parseErrors[] = $exception->getMessage(); | |
} | |
} catch (\Exception $e) { | |
- throw new \RuntimeException($e->getMessage(), self::EXCEPTION_EXIT); | |
+ throw new \RuntimeException($e->getMessage(), self::EXCEPTION_EXIT, $e); | |
} | |
return self::SUCCESS_EXIT; | |
diff --git a/src/main/php/PDepend/Util/IdBuilder.php b/src/main/php/PDepend/Util/IdBuilder.php | |
index 46ab150..febe4f9 100644 | |
--- a/src/main/php/PDepend/Util/IdBuilder.php | |
+++ b/src/main/php/PDepend/Util/IdBuilder.php | |
@@ -92,7 +92,7 @@ class IdBuilder | |
return $this->forOffsetItem( | |
$type, | |
- ltrim(strrchr(strtolower(get_class($type)), '_'), '_') | |
+ ltrim((string)strrchr(strtolower(get_class($type)), '_'), '_') | |
); | |
} | |
@@ -136,7 +136,7 @@ class IdBuilder | |
*/ | |
protected function hash($string) | |
{ | |
- return substr(base_convert(md5($string), 16, 36), 0, 11); | |
+ return substr(base_convert(md5((string)$string), 16, 36), 0, 11); | |
} | |
/** | |
diff --git a/src/test/php/PDepend/Report/Jdepend/ChartTest.php b/src/test/php/PDepend/Report/Jdepend/ChartTest.php | |
index 71a15c5..04cfd1e 100644 | |
--- a/src/test/php/PDepend/Report/Jdepend/ChartTest.php | |
+++ b/src/test/php/PDepend/Report/Jdepend/ChartTest.php | |
@@ -275,14 +275,14 @@ class ChartTest extends AbstractTest | |
$ellipseA = $xpath->query("//s:ellipse[@title='package0']")->item(0); | |
$matrixA = $ellipseA->getAttribute('transform'); | |
preg_match('/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/', $matrixA, $matches); | |
- $this->assertEquals(1, $matches[1]); | |
- $this->assertEquals(1, $matches[4]); | |
+ $this->assertEquals(1, (int)$matches[1]); | |
+ $this->assertEquals(1, (int)$matches[4]); | |
$ellipseB = $xpath->query("//s:ellipse[@title='package1']")->item(0); | |
$matrixB = $ellipseB->getAttribute('transform'); | |
preg_match('/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/', $matrixB, $matches); | |
- $this->assertEquals(0.3333333, $matches[1], null, 0.000001); | |
- $this->assertEquals(0.3333333, $matches[4], null, 0.000001); | |
+ $this->assertEquals(0.3333333, (int)$matches[1], null, 0.000001); | |
+ $this->assertEquals(0.3333333, (int)$matches[4], null, 0.000001); | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment