$line) { $actual_line_number = $line_offset + $line_num + 1; $trimmed = trim($line); // Skip comments if (str_starts_with($trimmed, '//') || str_starts_with($trimmed, '*')) { continue; } // Check for render() method definition // Match: render() { or async render() { // But not: on_render() or other_render() or renderSomething() if (preg_match('/^(?:async\s+)?render\s*\([^)]*\)\s*\{/', $trimmed)) { $this->add_violation( $file_path, $actual_line_number, "Component class '{$class_name}' overrides render() method. This is not allowed in JQHTML components.", trim($line), 'Use lifecycle methods instead: on_render() for initial render setup, on_create() for post-render initialization, or on_ready() for final setup. The render() method is reserved for the framework to render templates.', 'high' ); } // Also check for static render method (which would also be wrong) if (preg_match('/^static\s+(?:async\s+)?render\s*\([^)]*\)\s*\{/', $trimmed)) { $this->add_violation( $file_path, $actual_line_number, "Component class '{$class_name}' defines a static render() method. This is not allowed in JQHTML components.", trim($line), 'Use lifecycle methods instead: on_render() for initial render setup, on_create() for post-render initialization, or on_ready() for final setup.', 'high' ); } } } } }