Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 17, 2025

This PR adds support for the shipmonk/name-collision-detector tool to the setup-php action, following the existing pattern for other ShipMonk composer-based tools.

What is name-collision-detector?

The shipmonk/name-collision-detector is a fast PHP tool that detects duplicate class, interface, enum, trait, constant, or function names within the same namespace. It helps prevent ambiguous class resolution issues that can cause hard-to-debug problems in PHP projects.

Usage

After this PR, users can include the tool in their GitHub Actions workflows:

- name: Setup PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: name-collision-detector

- name: Check for name collisions
  run: detect-collisions src tests

Changes Made

  1. Added tool configuration in src/configs/tools.json:

    • Type: composer (installed via Composer)
    • Repository: shipmonk/name-collision-detector
    • Scope: scoped (for proper isolation)
  2. Added comprehensive test coverage in __tests__/tools.test.ts:

    • Linux platform support
    • macOS (Darwin) platform support
    • Windows platform support
  3. Generated expected output: The tool will be installed using add_composer_tool name-collision-detector name-collision-detector shipmonk/ scoped

Benefits

  • Fast detection: Analyzes ~10,000 files in seconds
  • Comprehensive coverage: Detects all types of name collisions (classes, interfaces, enums, traits, constants, functions)
  • CI integration: Returns non-zero exit code when duplicates are found
  • Configurable: Supports collision-detector.json configuration file
  • Consistent pattern: Follows the same implementation pattern as other ShipMonk tools like composer-dependency-analyser

Testing

  • All existing tests pass (327 tests)
  • New tests verify correct installation script generation across all platforms
  • Manual testing confirms the tool installs and functions correctly
  • Code formatting and linting checks pass

This addition enhances the PHP development experience by providing an easy way to catch name collision issues early in the development cycle.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Create a PR for shipmonk/name-collision-detector, based on previous PRs for adding composer based tools Add support for shipmonk/name-collision-detector tool Jul 17, 2025
@Copilot Copilot AI requested a review from shivammathur July 17, 2025 07:26
Copilot finished work on behalf of shivammathur July 17, 2025 07:26
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (011ab6e) to head (879090a).
Report is 5 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop      #973   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          805       805           
  Branches       284       285    +1     
=========================================
  Hits           805       805           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Owner

@shivammathur shivammathur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please add an entry in the tools section in the README as well similar to how other tools are documented.

Copy link
Contributor Author

Copilot AI commented Jul 17, 2025

LGTM, please add an entry in the tools section in the README as well similar to how other tools are documented.

Added name-collision-detector to the README tools section as requested. The tool is now documented alongside other supported tools in the tools list. (commit a3845d8)

@Copilot Copilot AI requested a review from shivammathur July 17, 2025 08:02
Copilot finished work on behalf of shivammathur July 17, 2025 08:02
@Copilot Copilot AI requested a review from shivammathur July 17, 2025 08:08
Copilot finished work on behalf of shivammathur July 17, 2025 08:08
@shivammathur shivammathur marked this pull request as ready for review July 17, 2025 08:11
@shivammathur shivammathur changed the base branch from main to develop July 17, 2025 08:12
@shivammathur shivammathur merged commit 1897d72 into develop Jul 17, 2025
66 checks passed
@shivammathur shivammathur deleted the copilot/fix-74435ef3-8c22-4393-8d87-090d0d41f7fa branch July 17, 2025 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants