Skip to main content

SystemsDK

Blog Details

  • Home
  • PHP Copy/Paste Detector v9.1.0

PHP Copy/Paste Detector v9.1.0

SystemsDK Announces PHPCPD 9.1.0: The Enterprise Standard for PHP Code Duplication Analysis

We are thrilled to announce the official release of PHP Copy/Paste Detector (PHPCPD) version 9.1.0. As the active maintainers of this essential static analysis tool, SystemsDK has heavily re-architected the original abandoned package to meet the strict demands of modern enterprise environments and PHP 8.4+ standards.

This substantial update focuses heavily on seamless CI/CD integration, advanced false-positive management, and configuration as code, ensuring your team can enforce DRY (Don’t Repeat Yourself) principles without disrupting automated workflows.

🚀 Seamless CI/CD & Pipeline Integration

Modern development relies on automated pipelines. Version 9.1.0 introduces powerful new features designed specifically for CI/CD environments:

  • GitHub Code Scanning & SARIF 2.1.0: We have added native SARIF 2.1.0 and JSON loggers. You can now pipe duplicate code alerts directly into the GitHub Security dashboard or GitLab CI for native PR annotations.

  • Granular Pipeline Controls: New --max-percentage and --ignore-violations-on-exit flags give DevOps engineers precise control over when a build should fail, allowing for progressive technical debt reduction (fixes #190).

  • Quiet Mode: The new --quiet option suppresses all non-essential CLI output, keeping your CI build logs clean and readable (fixes #205).

🛠️ Configuration as Code

  • Fluent Config Builder: Say goodbye to long, messy command-line arguments. PHPCPD now supports a fluent configuration builder loaded automatically from a phpcpd.config.php file. We have included a .dist template to help teams easily version-control their analysis rules and share them across the repository.

✨ Advanced Detection & Noise Reduction

Static analysis is only useful if developers trust the output. We have significantly upgraded the core detection engine to eliminate noise and false positives:

  • Smart Overlap Filter: A brand-new overlap filter automatically detects and prevents the duplicate reporting of intersecting or nested clone ranges, drastically cleaning up report output.

  • Overhauled --exclude Logic: The directory scanning bug has been completely fixed. The engine now uses exact path segment matching, meaning excluding a Vendor directory will safely ignore it without accidentally skipping a Vendor2 directory.

  • Improved Fuzzy Matching: We have implemented [inconsistent] clone detection and fixed the underlying fuzzy matching logic to catch structurally identical code even when variable names differ.

  • Attribute Boundary Fixes: Parsing strategies have been updated to perfectly detect boundaries for PHP attributes, ensuring stable analysis regardless of how your codebase is structured.

📊 Enterprise Auditing & Transparency

  • #[SuppressCpd] Audit Counters: While the #[SuppressCpd] attribute allows developers to intentionally ignore unavoidable duplication (like generated code), enterprise transparency requires oversight. PHPCPD 9.1.0 now includes built-in audit counters for suppressed clones, injecting these metrics directly into the CLI output, JSON, and XML (PMD-CPD) reports.

⚙️ Under the Hood

To ensure maximum security and performance, all Composer dependencies have been brought up to date for modern PHP ecosystems. Alongside these technical updates, we have completely rewritten the documentation to provide comprehensive, enterprise-grade guidelines for installation, configuration, and CI/CD integration.

You can explore the full changelog, review the updated architecture, and learn how to integrate PHPCPD 9.1.0 into your workflows by visiting our official repository.

Read the Full Documentation on GitHub