Skip to content

BC Check analyzes PHP code between two git commits to detect backward compatibility (BC) breaking changes using AST parsing.

License

Notifications You must be signed in to change notification settings

Phauthentic/backward-compatibility-checker

Repository files navigation

BC Check - Backward Compatibility Checker for PHP

BC Check analyzes PHP code between two git commits to detect backward compatibility (BC) breaking changes using AST parsing. It helps library maintainers follow Semantic Versioning by identifying changes that could break dependent code.

"With a system of the size and importance of API, it is necessary to have some formalized rules to govern how updates are incorporated while still keeping the API stable." — Semantic Versioning 2.0.0

Features 💎

  • BC Break Detection:
    • Detects removed public/protected classes, methods, properties, and constants
    • Detects method signature changes (parameters, types, defaults)
    • Detects return type changes
    • Detects visibility reductions
    • Detects added final, abstract, static, readonly modifiers
    • Detects interface implementation changes
    • Detects parent class changes
  • Flexible Configuration:
    • YAML-based configuration
    • Regex patterns for include/exclude filtering
    • Custom source directories
    • External detector loading for custom BC break detection
  • Multiple Output Formats:
    • Human-readable text output
    • JSON output for programmatic use
    • GitHub Actions annotations
    • SARIF (Static Analysis Results Interchange Format)
    • Checkstyle XML
    • JUnit XML
    • GitLab Code Quality
  • CI/CD Ready:
    • Exit codes for build success/failure
    • GitHub Actions, GitLab CI, CircleCI, Jenkins examples
    • Docker support

Installation ⚙️

composer require --dev phauthentic/bc-check

Or download the PHAR from the releases page.

Documentation 📚

Quick Start 🚀

# Basic usage
vendor/bin/bc-check check /path/to/repo v1.0.0 v2.0.0

# With configuration file
vendor/bin/bc-check check /path/to/repo v1.0.0 v2.0.0 --config=bc-check.yaml

# JSON output
vendor/bin/bc-check check /path/to/repo v1.0.0 v2.0.0 --format=json

For more usage examples and options, see the Usage Guide.

Reporting Issues 🪲

If you find a bug or have a feature request, please open an issue on the GitHub repository.

When reporting issues, please provide:

  • PHP version
  • BC Check version
  • Minimal code example that reproduces the issue
  • Expected vs actual behavior

License ⚖️

Copyright Florian Krämer

Licensed under the MIT License.

About

BC Check analyzes PHP code between two git commits to detect backward compatibility (BC) breaking changes using AST parsing.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages