public function enterNode(Node $node)
    {
        if ($node instanceof Namespace_) {
            $this->namespace = isset($node->name) ? $node->name->parts : [];
        } elseif ($node instanceof Class_) {
            $constructor = null;
            foreach ($node->stmts as $stmt) {
                if ($stmt instanceof ClassMethod) {
                    // If we find a new-style constructor, no need to look for the old-style
                    if ('__construct' === \strtolower($stmt->name)) {
                        $this->validateConstructor($stmt, $node);

                        return;
                    }

                    // We found a possible old-style constructor (unless there is also a __construct method)
                    if (empty($this->namespace) && \strtolower($node->name) === \strtolower($stmt->name)) {
                        $constructor = $stmt;
                    }
                }
            }

            if ($constructor) {
                $this->validateConstructor($constructor, $node);
            }
        }
    }
public function enterNode(Node $node)
    {
        if ($node instanceof Namespace_) {
            $this->namespace = isset($node->name) ? $node->name->parts : [];
        } elseif ($node instanceof Class_) {
            $constructor = null;
            foreach ($node->stmts as $stmt) {
                if ($stmt instanceof ClassMethod) {
                    // If we find a new-style constructor, no need to look for the old-style
                    if ('__construct' === \strtolower($stmt->name)) {
                        $this->validateConstructor($stmt, $node);

                        return;
                    }

                    // We found a possible old-style constructor (unless there is also a __construct method)
                    if (empty($this->namespace) && \strtolower($node->name) === \strtolower($stmt->name)) {
                        $constructor = $stmt;
                    }
                }
            }

            if ($constructor) {
                $this->validateConstructor($constructor, $node);
            }
        }
    }
public function enterNode ( Node $ node ) { if ( $ node instanceof Namespace_ ) { $ this -> namespace = isset ( $ node -> name ) ? $ node -> name -> parts : [ ] ; } elseif ( $ node instanceof Class_ ) { $ constructor = null ; foreach ( $ node -> stmts as $ stmt ) { if ( $ stmt instanceof ClassMethod ) { // If we find a new-style constructor, no need to look for the old-style if ( '__construct' === \ strtolower ( $ stmt -> name ) ) { $ this -> validateConstructor ( $ stmt , $ node ) ; return ; } // We found a possible old-style constructor (unless there is also a __construct method) if ( empty ( $ this -> namespace ) && \ strtolower ( $ node -> name ) === \ strtolower ( $ stmt -> name ) ) { $ constructor = $ stmt ; } } } if ( $ constructor ) { $ this -> validateConstructor ( $ constructor , $ node ) ; } } }
Validate that the constructor is not static and does not have a return type.

@throws FatalErrorException the constructor function is static
@throws FatalErrorException the constructor function has a return type

@param Node $node
Validate that the constructor is not static and does not have a return type .