Skip to main content

drep/languages/definitions/
php.rs

1//! PHP: PHP_CodeSniffer over `.php`.
2
3use crate::languages::spec::{
4    DEFAULT_TOOL_TIMEOUT_SECS, DiagnosticsStream, LanguageSupport, OutputFormat, ToolSpec,
5};
6
7/// PHP deterministic checker.
8pub static PHPCS: ToolSpec = ToolSpec {
9    name: "phpcs",
10    command: &["phpcs", "--report=json"],
11    local_paths: &["vendor/bin/phpcs"],
12    config_files: &[
13        "phpcs.xml",
14        "phpcs.xml.dist",
15        ".phpcs.xml",
16        ".phpcs.xml.dist",
17    ],
18    config_flag: None,
19    output_format: OutputFormat::Phpcs,
20    diagnostics_stream: DiagnosticsStream::Stdout,
21    timeout_secs: DEFAULT_TOOL_TIMEOUT_SECS,
22    timeout_context: None,
23    establishes_compilation: false,
24    serial_in_repository: false,
25    accepts_files: true,
26};
27
28/// PHP language entry.
29pub static PHP: LanguageSupport = LanguageSupport {
30    name: "php",
31    display_name: "PHP",
32    extensions: &[".php"],
33    filenames: &[],
34    filename_prefixes: &[],
35    tools: &[&PHPCS],
36    conventions: &[
37        "Undefined variables and array keys relied on as null",
38        "Type juggling in == comparisons",
39        "SQL and shell commands built by string interpolation",
40        "Unescaped output of user input in templates",
41    ],
42    vendored_dirs: &["vendor"],
43};
44
45/// The family's entries in registration order. See `ALL_LANGUAGES`.
46pub(crate) static FAMILY: &[&LanguageSupport] = &[&PHP];