Skip to content

Performant static analyzer for PHP, which is extremely easy to use. It helps you catch common mistakes in your PHP code.

Notifications You must be signed in to change notification settings

denzyldick/phanalist-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 

Repository files navigation

Performant static analyzer for PHP, which is extremely easy to use. It helps you catch common mistakes in your PHP code. It helps you improve your PHP code.

Example

Example

Usage

name: "Phanalist GitHub action."
on:
  push:
    branches:
      - "main"
jobs:
  install-phanalist:
    runs-on: ubuntu-latest
    permissions:
      # required for all workflows
      security-events: write
      # only required for workflows in private repositories
      actions: read
      contents: read
    steps:
      - uses: actions/checkout@v4
      - uses: denzyldick/[email protected]
        with:
          src: /app

Rules

The following rules are available:

Code Name Default options
E0000 Example rule
E0001 Opening tag position
E0002 Empty catch
E0003 Method modifiers
E0004 Uppercase constants
E0005 Capitalized class name
E0006 Property modifiers
E0007 Method parameters count check_constructor: true, max_parameters: 5
E0008 Return type signature
E0009 Cyclomatic complexity max_complexity: 10
E0010 Npath complexity max_complexity: 200
E0012 Service compatibility with Shared Memory Model include_namespaces: ["App\Service\"],
exclude_namespaces: [],
reset_interfaces: ["ResetInterface"]

Adding a new rule is a simple task, and this tutorial explains how to do it.

Articles

Read a series of chapters on https://dev.to/denzyldick to understand the project's internals. It is a great, easy-to-read introduction to this project.

  1. Write your static analyzer for PHP.
  2. How I made it impossible to write spaghetti code.
  3. Detecting spaghetti code in AST of a PHP source code.
  4. Getting Symfony app ready for Swoole, RoadRunner, and FrankenPHP (no AI involved).

About

Performant static analyzer for PHP, which is extremely easy to use. It helps you catch common mistakes in your PHP code.

Topics

Resources

Stars

Watchers

Forks