11<?php
2+
23declare (strict_types=1 );
34
45namespace Arkitect \Analyzer ;
@@ -30,7 +31,7 @@ public function enterNode(Node $node): void
3031
3132 foreach ($ node ->implements as $ interface ) {
3233 $ this ->classDescriptionBuilder
33- ->addInterface ($ interface ->toString (), $ interface ->getLine ());
34+ ->addInterface ($ interface ->toString (), $ interface ->getLine ());
3435 }
3536
3637 if (!$ node ->isAnonymous () && null !== $ node ->extends ) {
@@ -76,7 +77,8 @@ public function enterNode(Node $node): void
7677 *
7778 * @see FileVisitorTest::test_it_should_return_errors_for_const_outside_namespace
7879 */
79- if ($ node instanceof Node \Expr \ClassConstFetch
80+ if (
81+ $ node instanceof Node \Expr \ClassConstFetch
8082 && method_exists ($ node ->class , 'toString ' )
8183 ) {
8284 if ($ this ->isSelfOrStaticOrParent ($ node ->class ->toString ())) {
@@ -93,7 +95,8 @@ public function enterNode(Node $node): void
9395 *
9496 * @see FileVisitorTest::test_should_returns_all_dependencies
9597 */
96- if ($ node instanceof Node \Expr \StaticCall
98+ if (
99+ $ node instanceof Node \Expr \StaticCall
97100 && method_exists ($ node ->class , 'toString ' )
98101 ) {
99102 if ($ this ->isSelfOrStaticOrParent ($ node ->class ->toString ())) {
@@ -104,7 +107,8 @@ public function enterNode(Node $node): void
104107 ->addDependency (new ClassDependency ($ node ->class ->toString (), $ node ->getLine ()));
105108 }
106109
107- if ($ node instanceof Node \Expr \Instanceof_
110+ if (
111+ $ node instanceof Node \Expr \Instanceof_
108112 && method_exists ($ node ->class , 'toString ' )
109113 ) {
110114 if ($ this ->isSelfOrStaticOrParent ($ node ->class ->toString ())) {
@@ -114,11 +118,13 @@ public function enterNode(Node $node): void
114118 ->addDependency (new ClassDependency ($ node ->class ->toString (), $ node ->getLine ()));
115119 }
116120
117- if ($ node instanceof Node \Expr \New_
121+ if (
122+ $ node instanceof Node \Expr \New_
118123 && !($ node ->class instanceof Node \Expr \Variable)
119124 ) {
120- if ((method_exists ($ node ->class , 'isAnonymous ' ) && $ node ->class ->isAnonymous ())
121- || !method_exists ($ node ->class , 'toString ' )) {
125+ if ((method_exists ($ node ->class , 'isAnonymous ' ) && true === $ node ->class ->isAnonymous ())
126+ || !method_exists ($ node ->class , 'toString ' )
127+ ) {
122128 return ;
123129 }
124130
@@ -215,7 +221,7 @@ public function enterNode(Node $node): void
215221 $ returnType = $ node ->returnType ;
216222 if ($ returnType instanceof Node \Name \FullyQualified) {
217223 $ this ->classDescriptionBuilder
218- ->addDependency (new ClassDependency ($ returnType ->toString (), $ returnType ->getLine ()));
224+ ->addDependency (new ClassDependency ($ returnType ->toString (), $ returnType ->getLine ()));
219225 }
220226 }
221227 }
@@ -271,7 +277,7 @@ private function addParamDependency(Node\Param $node): void
271277 $ type = $ nullableType ->type ;
272278 }
273279
274- if (method_exists ($ type , 'isSpecialClassName ' ) && $ type ->isSpecialClassName ()) {
280+ if (method_exists ($ type , 'isSpecialClassName ' ) && true === $ type ->isSpecialClassName ()) {
275281 return ;
276282 }
277283
0 commit comments