PHPLint

PHPLint is a validator and documentator for PHP 5 and PHP 7 programs.

Version

4.0_20190206

Runtime

PHP Versions

Supported Languages

PHP

Official Documentation

http://www.icosaedro.it/phplint/index.html

YAML Configuration

phplint:

  • input:

    Patterns to include in reports.

    Note: The input patterns are not applied when running PHPLint in order to avoid false-positives as much as possible since PHPLint considers dependency between files and filtering the input files affects how PHPLint detects issues. Therefore, the files excluded by the patterns are always processed and you may even see logs related to the excluded files in the job console. However, Inspecode eventually ignores any issues detected on the excluded files when generating job reports.

  • ignore:

    Patterns to exclude from reports.

    Note: Just like input:, the ignore patterns are not applied when running PHPLint.

  • auto-fix:

    N/A

  • config-file:

    N/A

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.25 CPU with 960 MiB RAM.

      Inspecode automatically specifies -d memory_limit=<limit> to PHP in order to configure the maximum amount of memory that PHPLint is allowed to allocate according to this value. Inspecode reserves 240 MiB RAM for system, and makes the rest of RAM available to PHPLint for memory allocation. For example, -d memory_limit=720M is specified by default (for 0.25 CPU), -d memory_limit=5520M is specified for 1.5 CPU.

      Note: Inspecode uses a customized version of phpl script to specify the options to PHP through PHP_OPTS environment variable.

  • options:

    Below is the list of options that are supported:

    --php-version V         set PHP version V (either 5 or 7 (default))
    --modules-path PATH     set the path[s] to modules dir[s] (".")
    --[no-]is-module        parsed file is a module (FALSE)
    --[no-]recursive        follows require_once recursively (TRUE)
    --[no-]ctrl-check       check control chars in strings (TRUE)
    --[no-]ascii-ext-check  check extended ASCII chars in strings (TRUE)
    --[no-]print-notices    print notices  (TRUE)
    --[no-]print-warnings   print warnings (TRUE)
    --[no-]print-errors     print errors   (TRUE)
    --[no-]parse-phpdoc     parse DocBlock comments (TRUE)
    --[no-]print-context    print error context (FALSE)
    --[no-]print-source     print source (FALSE)
    --[no-]report-unused    report unused IDs (TRUE)
    --[no-]report-prototypes  reports methods' prototypes of the parsed classes
    --tab-size N            set tabulation to N spaces (8)
  • experimental:

    • incremental:

      N/A

      Note: The incremental analysis cannot be supported for PHPLint. This is because PHPLint validates source files with considering dependency between them and the results on unchanged files can be affected by changed files.

YAML Examples

  • With default options:

    inspecode:
      phplint: default
  • With custom machine:

    inspecode:
      phplint:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
  • With custom options:

    inspecode:
      phplint:
        options:
          --php-version: 7
          --tab-size: 4

False-Positives

PHPLint may detect false-positives especially when dependencies cannot be resolved properly. Inspecode attempts to avoid the false-positives by giving all source files to PHPLint in lexical order, but that is not a perfect solution. If the false-positives are detected in your repository, consider explicitly importing the modules and the packages your source depends on by following the document below.

http://www.icosaedro.it/phplint/phplint2/doc/tutorial.htm#generalstructureoftheprogram

results matching ""

    No results matching ""