All Projects → voku → PHPDoctor

voku / PHPDoctor

Licence: Apache-2.0 license
🏥 PHPDoctor: Check files, full directories or strings for missing or bad PHPDoc types.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to PHPDoctor

Lyra
No description or website provided.
Stars: ✭ 23 (-57.41%)
Mutual labels:  static-analysis
qulice
Quality Police for Java projects: aggregator of Checkstyle, PMD, and SpotBugs
Stars: ✭ 286 (+429.63%)
Mutual labels:  static-analysis
phantom-types
Phantom types for Python.
Stars: ✭ 120 (+122.22%)
Mutual labels:  static-analysis
IntelliJ-Luanalysis
Type-safe Lua IDE Plugin for IntelliJ IDEA
Stars: ✭ 118 (+118.52%)
Mutual labels:  static-analysis
localhost-sonarqube
Analysing source code locally with SonarQube in a Docker environment.
Stars: ✭ 17 (-68.52%)
Mutual labels:  static-analysis
inline-plz
Inline your lint messages
Stars: ✭ 32 (-40.74%)
Mutual labels:  static-analysis
luli
A static analysis and linter tool for Lua
Stars: ✭ 45 (-16.67%)
Mutual labels:  static-analysis
phpstan-phpspec
PhpSpec extension for PHPStan
Stars: ✭ 19 (-64.81%)
Mutual labels:  static-analysis
Vehicle-Security-Toolkit
汽车/安卓/固件/代码安全测试工具集
Stars: ✭ 367 (+579.63%)
Mutual labels:  static-analysis
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-74.07%)
Mutual labels:  static-analysis
aparoid
Static and dynamic Android application security analysis
Stars: ✭ 62 (+14.81%)
Mutual labels:  static-analysis
klever
Read-only mirror of the Klever Git repository
Stars: ✭ 18 (-66.67%)
Mutual labels:  static-analysis
dlint
Dlint is a tool for encouraging best coding practices and helping ensure Python code is secure.
Stars: ✭ 130 (+140.74%)
Mutual labels:  static-analysis
phpcs-psr4-sniff
[READ-ONLY] PHP_CodeSniffer sniff that checks class name matches PSR-4 project structure.
Stars: ✭ 23 (-57.41%)
Mutual labels:  static-analysis
bismon
persistent monitor (for static source code analysis, GCC based)
Stars: ✭ 45 (-16.67%)
Mutual labels:  static-analysis
gospal
Go static program analyser
Stars: ✭ 56 (+3.7%)
Mutual labels:  static-analysis
swap-detector
A library for detecting swapped arguments in function calls, and a Clang Static Analyzer plugin used to demonstrate the library.
Stars: ✭ 19 (-64.81%)
Mutual labels:  static-analysis
ramllint
RAML Linter
Stars: ✭ 18 (-66.67%)
Mutual labels:  static-analysis
dmn-check
A tool which performs static analyses on Decision Model Notation (DMN) files to detect bugs
Stars: ✭ 34 (-37.04%)
Mutual labels:  static-analysis
cmake-init
The missing CMake project initializer
Stars: ✭ 1,071 (+1883.33%)
Mutual labels:  static-analysis

Build Status Codacy Badge Latest Stable Version License Donate to this project using Paypal Donate to this project using Patreon

🏥 PHPDoctor

Check PHP files or directories for missing types.

If you already use PHPStan for your type checks but sometimes someone in the team still commit non typed code, then PHPDoctor is for you.

Install via "phar" (recommended)

https://github.com/voku/PHPDoctor/releases

Install via "composer require"

composer require-dev voku/phpdoctor

Quick Start

Usage:
  analyse [options] [--] <path...>

Arguments:
  path                                                                                   The path to analyse

Options:
      --autoload-file[=AUTOLOAD-FILE]                                                    The path to your autoloader. [default: ""]
      --access[=ACCESS]                                                                  Check for "public|protected|private" methods. [default: "public|protected|private"]
      --skip-ambiguous-types-as-error[=SKIP-AMBIGUOUS-TYPES-AS-ERROR]                    Skip check for ambiguous types. (false or true) [default: "false"]
      --skip-deprecated-functions[=SKIP-DEPRECATED-FUNCTIONS]                            Skip check for deprecated functions / methods. (false or true) [default: "false"]
      --skip-functions-with-leading-underscore[=SKIP-FUNCTIONS-WITH-LEADING-UNDERSCORE]  Skip check for functions / methods with leading underscore. (false or true) [default: "false"]
      --skip-parse-errors[=SKIP-PARSE-ERRORS]                                            Skip parse errors in the output. (false or true) [default: "true"]
      --path-exclude-regex[=PATH-EXCLUDE-REGEX]                                          Skip some paths via regex e.g. "#/vendor/|/other/.*/path/#i" [default: "#/vendor/|/tests/#i"]

Demo

Parse a string:

$code = '
<?php declare(strict_types = 1);   
     
class HelloWorld
{
    /**
     * @param mixed $date
     */ 
    public function sayHello($date): void
    {
        echo \'Hello, \' . $date->format(\'j. n. Y\');
    }
}';

$phpdocErrors = PhpCodeChecker::checkFromString($code);

// [8]: missing parameter type for HelloWorld->sayHello() | parameter:date']

Ignore errors

You can use <phpdoctor-ignore-this-line/> in @param or @return phpdocs to ignore the errors directly in your code.

/**
 * @param mixed $lall <p>this is mixed but it is ok, because ...</p> <phpdoctor-ignore-this-line/>
 *
 * @return array <phpdoctor-ignore-this-line/>
 */
function foo_ignore($lall) {
    return $lall;
}

Building the PHAR file

Prepare: https://github.com/phar-io/phive

phive install humbug/box
php tools/box compile --debug

Support

For support and donations please visit Github | Issues | PayPal | Patreon.

For status updates and release announcements please visit Releases | Twitter | Patreon.

For professional support please contact me.

Thanks

  • Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
  • Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
  • Thanks to Travis CI for being the most awesome, easiest continous integration tool out there!
  • Thanks to StyleCI for the simple but powerfull code style check.
  • Thanks to PHPStan && Psalm for really great Static analysis tools and for discover bugs in the code!
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].