Development Setup

Local setup guide to contribute efficiently to Doctrine Doctor.


Prerequisites

  • PHP 8.4+
  • Composer 2+
  • Git

Clone

git clone https://github.com/YOUR-USERNAME/doctrine-doctor.git
cd doctrine-doctor
git remote add upstream https://github.com/ahmed-bhs/doctrine-doctor.git

Install

composer install

Quality Commands

Use the project Composer scripts:

# Tests
composer test

# Static analysis
composer phpstan

# Coding standards (ECS)
composer ecs

# Complete checks
composer check

Auto-fix commands:

composer cs:fix

Project Structure

doctrine-doctor/
├── src/
│   ├── Analyzer/
│   ├── Collection/
│   ├── DTO/
│   ├── Factory/
│   ├── Issue/
│   ├── Suggestion/
│   ├── Template/
│   └── ValueObject/
├── tests/
├── config/
├── docs/
└── CHANGELOG.md

Typical Workflow

  • Create a branch:
git checkout -b feature/my-change
  • Implement changes + focused tests
  • Run composer check
  • Commit:
git add .
git commit -m "feat: add XYZ analyzer"
  • Push + open PR

Debugging

Enable bundle debug options:

doctrine_doctor:
    profiler:
        show_debug_info: true
    debug:
        enabled: true
        internal_logging: true

Note: internal_logging adds overhead; use it only when investigating issues.


Local Integration Test (Symfony app)

symfony new test-app
cd test-app

In the app composer.json:

{
  "repositories": [
    {
      "type": "path",
      "url": "../doctrine-doctor"
    }
  ]
}

Then:

composer require --dev ahmed-bhs/doctrine-doctor:@dev

Before Opening PR

  • composer check passes
  • docs updated when behavior/config changes
  • root changelog (CHANGELOG.md) updated when relevant