@@ -117,6 +117,9 @@ |
||
| 117 | 117 | return $this->addVisitors($analyzer, $this->visitors, 'analyze'); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | + /** |
|
| 121 | + * @param string $traverse |
|
| 122 | + */ |
|
| 120 | 123 | private function addVisitors(VisitableAnalyzer $analyzer, array $visitors, $traverse) |
| 121 | 124 | { |
| 122 | 125 | foreach($visitors as $key => $closure) |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - return $visitor; |
|
| 106 | + return $visitor; |
|
| 107 | 107 | }, |
| 108 | 108 | |
| 109 | 109 | 'dependency.interfaceSegregation' => function(array $config) { |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | $config = $this->configuration[$key]; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if(! isset($config['enabled']) || $config['enabled'] === true) |
|
| 130 | + if( ! isset($config['enabled']) || $config['enabled'] === true) |
|
| 131 | 131 | { |
| 132 | 132 | $analyzer->addVisitor($traverse, $closure($config)); |
| 133 | 133 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | private function initializeVisitors() |
| 48 | - { |
|
| 48 | + { |
|
| 49 | 49 | $this->visitors = array( |
| 50 | 50 | |
| 51 | 51 | 'property.public' => function(array $config) { |
@@ -12,6 +12,9 @@ |
||
| 12 | 12 | $parameterType, |
| 13 | 13 | $method; |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param string $parameterTypeName |
|
| 17 | + */ |
|
| 15 | 18 | public function __construct(Node $node, $parameterTypeName, $parameterType, $method) |
| 16 | 19 | { |
| 17 | 20 | parent::__construct($node); |
@@ -3,9 +3,6 @@ |
||
| 3 | 3 | namespace Solidifier\Defects; |
| 4 | 4 | |
| 5 | 5 | use Solidifier\Defect; |
| 6 | -use Solidifier\Visitors\ObjectType; |
|
| 7 | -use PhpParser\Node\Stmt\Property; |
|
| 8 | -use PhpParser\Node\Stmt\Class_; |
|
| 9 | 6 | |
| 10 | 7 | class PublicClass extends Defect |
| 11 | 8 | { |
@@ -86,6 +86,9 @@ |
||
| 86 | 86 | return $allowed; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | + /** |
|
| 90 | + * @return string |
|
| 91 | + */ |
|
| 89 | 92 | private function extractClassNameFromFullName($classFullname) |
| 90 | 93 | { |
| 91 | 94 | $classname = $classFullname; |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | public function addVisitor($traverseName, Visitor $visitor) |
| 35 | 35 | { |
| 36 | - if(! isset($this->nodeTraversers[$traverseName])) |
|
| 36 | + if( ! isset($this->nodeTraversers[$traverseName])) |
|
| 37 | 37 | { |
| 38 | 38 | throw new \RuntimeException("$traverseName is not a valid traverse step"); |
| 39 | 39 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | |
| 18 | 18 | public function addVisitor($traverseName, Visitor $visitor) |
| 19 | 19 | { |
| 20 | - if(! isset($this->visitors[$traverseName])) |
|
| 20 | + if( ! isset($this->visitors[$traverseName])) |
|
| 21 | 21 | { |
| 22 | 22 | $this->visitors[$traverseName] = array(); |
| 23 | 23 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $prettyPrint = new Standard(); |
| 22 | 22 | |
| 23 | 23 | $this->content = $this->twig->render( |
| 24 | - 'report.html.twig', |
|
| 24 | + 'report.html.twig', |
|
| 25 | 25 | array( |
| 26 | 26 | 'project' => 'Solidifier', |
| 27 | 27 | 'defects' => $this->sortDefectsByNamespace($defects), |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $namespace = implode('/', explode('/', $file, -1)); |
| 42 | 42 | |
| 43 | - if(! isset($result[$namespace])) |
|
| 43 | + if( ! isset($result[$namespace])) |
|
| 44 | 44 | { |
| 45 | 45 | $result[$namespace] = array(); |
| 46 | 46 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | { |
| 53 | 53 | $correspondingAttribute = strtolower(substr($methodName, 3)); |
| 54 | 54 | |
| 55 | - if(! isset($this->publicMethods[$correspondingAttribute])) |
|
| 55 | + if( ! isset($this->publicMethods[$correspondingAttribute])) |
|
| 56 | 56 | { |
| 57 | 57 | $this->publicMethods[$correspondingAttribute] = array(); |
| 58 | 58 | } |
@@ -20,11 +20,11 @@ |
||
| 20 | 20 | { |
| 21 | 21 | $this->privateAttributes = array(); |
| 22 | 22 | $this->publicMethods = array(); |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | elseif($node instanceof Property) |
| 25 | 25 | { |
| 26 | 26 | $this->enterProperty($node); |
| 27 | - } |
|
| 27 | + } |
|
| 28 | 28 | elseif($node instanceof ClassMethod) |
| 29 | 29 | { |
| 30 | 30 | $this->enterClassMethod($node); |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | { |
| 84 | 84 | $nbPublicMethods = count(array_filter($this->methods)); |
| 85 | 85 | |
| 86 | - if(((float)$nbPublicMethods / (float)$nbMethods) >= $this->threshold) |
|
| 86 | + if(((float) $nbPublicMethods / (float) $nbMethods) >= $this->threshold) |
|
| 87 | 87 | { |
| 88 | 88 | $this->dispatch(new \Solidifier\Defects\PublicClass($node)); |
| 89 | 89 | } |