RepositoryPHP
PH

phan/phan

Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.

5.6ksao
367fork
765issue
5lượt xem

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: phan

#1 Repository của tháng

1
TINIX TRENDING·Chủ đề: analyzer

#1 Repository của tháng

1
TINIX TRENDING·Chủ đề: static-analysis

#1 Repository của tháng

🛠️ Phan: Static analyzer PHP thông minh, chứng minh sai lẗn thay vì đúng

Phan ưu tiên giảm thiểu false-positive, chứng minh incorrectness thay vì correctness.

Phan là static analyzer dành cho PHP, được thiết kế để tìm kiếm các vấn đề phổ biến và kiểm tra tính tương thích kiểu dữ liệu khi thông tin kiểu khả dụng hoặc có thể suy luận được. Dự án hỗ trợ phân tích cú pháp PHP từ 8.1 đến 8.5, đòi hỏi PHP 8.1+ và php-ast extension (phiên bản 1.1.3+ cho PHP 8.4+).

✨ Điểm nổi bật

  • Cài đặt qua Composer: composer require phan/phan, khởi tạo cấu hình bằng phan --init.
  • Phân tích định nghĩa: kiểm tra methods, functions, classes, traits, interfaces, constants, properties và variables.
  • Kiểu dữ liệu & arity: kiểm tra type safety và số lượng tham số gọi hàm/method/closure.
  • Tương thích PHP 8.x: hỗ trợ kiểm tra backward compatibility và tính năng mới (property hooks, enums, union types...).
  • Phát hiện code chết: --dead-code-detection tìm unused/dead/unreachable code.
  • Biến & use chưa dùng: --unused-variable-detection và --unused-variable-detection cho use statements.
  • Điều kiện dư thừa: --redundant-condition-detection phát hiện conditions luôn đúng/sai hoặc casts vô nghĩa.
  • Sửa tự động: --automatic-fix tự động sửa một số loại lỗi như unused use statements.
  • Hỗ trợ namespace, traits, variadics: phân tích sâu các cấu trúc ngôn ngữ PHP.
  • Union & Generic Types: hỗ trợ @template, int[], array{key:string}...

💡 Vì sao đáng chú ý

Khác với các static analyzer chỉ kiểm tra surface-level, Phan mang tư duy "chứng minh sai lẗn" — ưu tiên tìm lỗi thực sự thay vì báo động giả. Phan hiểu biết flow control cơ bản, track giá trị trong arrays/integers/strings, giúp giảm false-positive đáng kể. Phù hợp tích hợp CI để bắt lỗi trước runtime, đặc biệt mạnh với legacy codebases cần nâng dần độ strictness.


#StaticAnalysis #PHP #CodeQuality #TiniX

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryPHP
phpstan/phpstan

PHP Static Analysis Tool - discover bugs in your code without running it!

14.2k
Dec 1, 2026
RepositoryRust
analysis-tools-dev/static-analysis

⚙️ A curated list of static analysis (SAST) tools and linters for all programming languages, config files, build tools, and more. The focus is on tools which improve code quality.

14.9k
Nov 30, 2026
RepositoryJava
SonarSource/sonar-java

:coffee: SonarSource Static Analyzer for Java Code Quality and Security

1.2k
Nov 27, 2026
RepositoryPHP
nikic/PHP-Parser

A PHP parser written in PHP

17.5k
Nov 28, 2026
RepositoryPHP
PHP-CS-Fixer/PHP-CS-Fixer

A tool to automatically fix PHP Coding Standards issues

13.6k
Nov 27, 2026
RepositoryRust
astral-sh/ruff

An extremely fast Python linter and code formatter, written in Rust.

51.6k
Nov 30, 2026
RepositoryC
semgrep/semgrep

Lightweight static analysis for many languages. Find bug variants with patterns that look like source code.

18.1k
Dec 1, 2026
RepositoryOCaml
meta/infer

A static analyzer for Java, C, C++, and Objective-C

15.8k
Nov 27, 2026
RepositoryJava
checkstyle/checkstyle

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.

9.7k
Nov 27, 2026