\s*\[(.*?)\]/s", $define_content, $include_matches)) { return; // No include array found } $include_content = $include_matches[1]; // Check if it references __DIR__ or the directory path $has_dir_reference = false; // Check for __DIR__ usage if (str_contains($include_content, '__DIR__')) { $has_dir_reference = true; } // Check for the relative directory path (e.g., 'rsx/app/demo') if (str_contains($include_content, "'" . $dir_path) || str_contains($include_content, '"' . $dir_path)) { $has_dir_reference = true; } if (!$has_dir_reference) { // Get bundle class name for better message $class_name = $metadata['class'] ?? basename($file_path, '.php'); $this->add_violation( $file_path, 0, "Bundle {$class_name} should include its own directory in the 'include' array", null, "Add '__DIR__' or '{$dir_path}' to the bundle's include array to ensure all module files are included.\n" . "Note: This is a convention rather than a hard requirement. If your bundle intentionally doesn't need " . "to include its own directory, add the following comment to grant an exception: @CONV-BUNDLE-02-EXCEPTION", $this->get_default_severity() ); } } }