Tyson Andre edited this page Oct 8, 2018 · 34 revisions

Using Phan

Setting up Phan

Getting Started
Start here for getting Phan installed and running on your code base.

Annotating Your Source Code
This document describes how to add types to your code via doc block annotations. (e.g. @param, @return, @var, @suppress)

About Union Types
An explanation of what union types are and how to use them.

Tutorial for Analyzing a Large Sloppy Code Base
A tutorial providing some guidance on how to get started analyzing your code and get to a place where static analysis is actually useful.

Improving Phan Analysis

Incrementally Strengthening Analysis
A guide to how Phan can be configured to slowly increase the strength of the analysis.

Issue Types Caught by Phan
An enumeration of error types, examples that cause them and tips on how to resolve the issues

Phan Config Settings
Documents Phan's config settings. These affect the strictness of analysis, what files are analyzed, etc.

Typing Parameters
A guide to handling interactions between Phan's @param types and declared parameter types or type-hints.

How To Use Stubs
Details on setting up a stubs directory for making code available to Phan that isn't loaded on its runtime.

Speeding up Phan Analysis
A list of suggestions that may help speed up Phan analysis on your project.

Using Advanced Features

Generic Types
Phan has primordial support for generic (templated) classes via type the annotations @template and @inherits and via a type syntax of the form Class<T> that may be referenced within doc-block annotations.

Editor Support
This article explains how to set up support for Phan in an editor/IDE. Vim, Emacs, and VS Code have plugins/extensions written for them. This article also explains how to create plugins/extensions for an editor.

Using Phan Daemon Mode
Daemon mode lets you request Phan results from your editor or IDE to detect Phan issues for a single file, with much lower latency than a full analysis.

Frequently Asked Questions

Frequently Asked Questions
A document with answers to common issues encountered when getting started with Phan.

Different Issue Sets On Different Numbers of CPUs
A document describing issues that may be seen when running Phan on more than one core, and workarounds.

What Static Analysis Lets You Do
A document describing various benefits of running a static analyzer on your code.

Developers' Guides

Developer's Guide To Phan
A guide for developers looking to hack on Phan.

Writing Plugins for Phan
A guide to writing one-off plugins for Phan.

How To Create a Phan Release
Follow this checklist when creating a new release of Phan.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.