History
Version 1320
at Thursday 17 June 2010 11:45:18 UTC # Fix for different class count results implemented and tested. This issue was caused by the invalid use of an internal class without the leading default namespace backslash.Diff
| 1319 | 1320 | /tests/PHP/Depend/Bugs/EndLessLoopBetweenForParentClassBug152Test.php |
|---|---|---|
| 121 | 121 | ->getParameters() |
| 122 | 122 | ->current() |
| 123 | 123 | ->getClass(); |
| 124 | + } | |
| 124 | 125 | |
| 126 | + /** | |
| 127 | + * testParserDoesNotDetectThrownInternalExceptionClassAsPartOfPackage | |
| 128 | + * | |
| 129 | + * @return void | |
| 130 | + * @covers stdClass | |
| 131 | + * @group pdepend | |
| 132 | + * @group pdepend::bugs | |
| 133 | + * @group regressiontest | |
| 134 | + * @group barbaz | |
| 135 | + */ | |
| 136 | + public function testParserDoesNotDetectThrownInternalExceptionClassAsPartOfPackage() | |
| 137 | + { | |
| 138 | + $classes = self::parseTestCaseSource(__METHOD__) | |
| 139 | + ->current() | |
| 140 | + ->getClasses(); | |
| 125 | 141 | |
| 142 | + $this->assertEquals(1, count($classes)); | |
| 126 | 143 | } |
| 127 | 144 | } |
| 1319 | 1320 | /tests/PHP/Depend/_code/bugs/152/testParserDoesNotDetectThrownInternalExceptionClassAsPartOfPackage.php |
| 2 | +<?php | |
| 3 | +namespace nspace; | |
| 4 | + | |
| 5 | +class Clazz | |
| 6 | +{ | |
| 7 | + function method() | |
| 8 | + { | |
| 9 | + throw new \InvalidArgumentException('Lorem ipsum...', 123); | |
| 10 | + } | |
| 11 | +} | |
| 12 | + | |
| 13 | +$obj = new Clazz(); | |
| 14 | +$obj->method(); | |
| 1319 | 1320 | /PHP/Depend/Parser.php |
| 4638 | 4638 | private function _parseQualifiedName() |
| 4639 | 4639 | { |
| 4640 | 4640 | $fragments = $this->_parseQualifiedNameRaw(); |
| 4641 | - | |
| 4641 | + | |
| 4642 | 4642 | // Check for fully qualified name |
| 4643 | 4643 | if ($fragments[0] === '\\') { |
| 4644 | 4644 | return join('', $fragments); |
| 1319 | 1320 | /PHP/Depend/Metrics/Hierarchy/Analyzer.php |
| 234 | 234 | */ |
| 235 | 235 | public function visitClass(PHP_Depend_Code_Class $class) |
| 236 | 236 | { |
| 237 | + if (false === $class->isUserDefined()) { | |
| 238 | + return; | |
| 239 | + } | |
| 240 | + | |
| 237 | 241 | $this->fireStartClass($class); |
| 238 | 242 | |
| 239 | 243 | ++$this->_cls; |