PHPSA\Analyzer\Pass\Statement\PropertyDefinitionDefaultValue::pass PHP Method

pass() public method

public pass ( $stmt, Context $context ) : boolean
$stmt
$context PHPSA\Context
return boolean
    public function pass($stmt, Context $context)
    {
        if ($stmt->default instanceof Node\Expr) {
            $compiled = $context->getExpressionCompiler()->compile($stmt->default);
            if ($compiled->getType() == CompiledExpression::NULL) {
                $context->notice('property_definition_default_value', 'null is default and is not needed.', $stmt);
                return true;
            }
        }
        return false;
    }
PropertyDefinitionDefaultValue