Skip to content

Conversation

@yamadashy
Copy link
Owner

Summary

  • Add playground directory with sample PHP files for testing PHPStan friendly formatter
  • Add composer playground script for easy testing
  • Update README with detailed editorUrl configuration documentation

Changes

Playground

  • playground/type_errors.php - Type mismatches, nullable handling
  • playground/undefined_errors.php - Undefined variables, methods, classes
  • playground/dead_code.php - Unreachable code, unused methods
  • playground/missing_types.php - Missing type declarations
  • playground/logic_errors.php - Division by zero, impossible comparisons

Documentation

  • Document available placeholders (%%file%%, %%relFile%%, %%line%%)
  • Add examples for PhpStorm, VSCode, and Sublime Text
  • Add note about Docker/container environments requiring %%relFile%%

Configuration

  • Exclude playground from CS Fixer (.php-cs-fixer.dist.php)
  • Add composer playground script
  • Add editorUrl examples as comments in phpstan.neon.dist

Test plan

  • Run composer playground to verify errors are detected and formatted correctly
  • Run composer tests to ensure existing tests pass

🤖 Generated with Claude Code

- Add playground directory with sample PHP files that trigger various PHPStan errors
  - type_errors.php: Type mismatches, nullable handling
  - undefined_errors.php: Undefined variables, methods, classes
  - dead_code.php: Unreachable code, unused methods
  - missing_types.php: Missing type declarations
  - logic_errors.php: Division by zero, impossible comparisons
- Add composer playground script for easy testing
- Exclude playground from CS Fixer and PHPStan analysis
- Update README with detailed editorUrl configuration:
  - Document available placeholders (%file%, %relFile%, %line%)
  - Add examples for PhpStorm, VSCode, and Sublime Text
  - Add note about Docker/container environments
- Add editorUrl examples as comments in phpstan.neon.dist

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@gemini-code-assist
Copy link

Summary of Changes

Hello @yamadashy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a dedicated playground environment with sample PHP files to facilitate robust testing and development of the PHPStan friendly formatter. It also significantly improves the documentation for the editorUrl configuration, making it easier for users to integrate PHPStan with their preferred IDEs and development setups, especially in containerized environments. A new Composer script streamlines the testing process for these new playground files.

Highlights

  • New Playground Directory: A new playground directory has been added, containing various PHP files specifically designed to demonstrate different types of PHPStan errors (e.g., type, undefined, dead code, missing types, logic errors). This serves as a dedicated environment for testing and validating the friendly formatter.
  • Composer Playground Script: A new composer playground script has been introduced, simplifying the process of running PHPStan analysis on the newly added playground files with a specific configuration.
  • Enhanced Editor URL Documentation: The README.md has been significantly updated with comprehensive documentation for the editorUrl configuration option. This includes details on available placeholders (%%file%%, %%relFile%%, %%line%%), and practical examples for popular IDEs like PhpStorm, VSCode, and Sublime Text, along with guidance for Docker/container environments.
  • Configuration Updates: The playground directory is now excluded from PHP-CS-Fixer to prevent linting errors on the intentionally error-prone test files. Additionally, phpstan.neon.dist includes commented-out editorUrl examples for quick reference.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@yamadashy yamadashy merged commit 942a38e into main Nov 29, 2025
18 checks passed
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a playground environment for testing the friendly formatter and significantly improves the documentation for the editorUrl feature. The changes are well-structured, and the addition of a playground is a great idea for manual testing and demonstration.

My review focuses on the new documentation and configurations. I've found a few areas where the examples for editorUrl could be clearer and more consistent across the README.md and phpstan.neon.dist files. Additionally, the editorUrl configuration within the new playground seems to be incorrect for VSCode and will likely not work as intended. My detailed comments provide suggestions to address these points.

friendly:
lineBefore: 3
lineAfter: 3
editorUrl: 'vscode://file/%%relFile%%:%%line%%'

Choose a reason for hiding this comment

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

high

The editorUrl for VSCode is configured with %%relFile%%. The vscode://file/ protocol handler generally requires an absolute file path to work correctly. When running composer playground, PHPStan is executed from the project root, and %%relFile%% will resolve to a path like playground/type_errors.php. The resulting URL vscode://file/playground/type_errors.php is a relative path and will likely fail to open the file in VSCode. To ensure the links work during testing, you should use %%file%% to get the absolute path, as documented in the README for local setups.

        editorUrl: 'vscode://file/%%file%%:%%line%%'

editorUrl: 'vscode://file/%%file%%:%%line%%'
# VSCode (with relative path - for Docker environments, requires base path)
editorUrl: 'vscode://file//your/local/project/path/%%relFile%%:%%line%%'

Choose a reason for hiding this comment

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

medium

The double slash // after vscode://file: can be confusing. While it might be technically valid in some URI parsers, a single slash is more conventional for absolute file paths and less likely to cause confusion. The format vscode://file/path/to/file is what's typically expected and is easier to read.

Suggested change
editorUrl: 'vscode://file//your/local/project/path/%%relFile%%:%%line%%'
editorUrl: 'vscode://file/your/local/project/path/%%relFile%%:%%line%%'

lineBefore: 2
lineAfter: 2
# editorUrl examples:
# - PhpStorm: 'phpstorm://open?file=%%relFile%%&line=%%line%%'

Choose a reason for hiding this comment

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

medium

This example for PhpStorm uses %%relFile%%, which is typically for containerized environments. However, the main README.md example for PhpStorm uses %%file%% for the standard local setup. To avoid confusion, it would be better to use %%file%% here to represent the most common local development scenario.

        # - PhpStorm: 'phpstorm://open?file=%%file%%&line=%%line%%'

lineAfter: 2
# editorUrl examples:
# - PhpStorm: 'phpstorm://open?file=%%relFile%%&line=%%line%%'
# - VSCode (local): 'vscode://file//path/to/project/%%relFile%%:%%line%%'

Choose a reason for hiding this comment

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

medium

The comment (local) is misleading for this VSCode example. This configuration, which uses %%relFile%% and requires prepending a local project path, is characteristic of running PHPStan in a container (like Docker) while editing files locally. A true 'local' setup would typically use %%file%%. I suggest changing (local) to something like (Docker/Remote) to more accurately describe the use case. Also, the double slash // can be simplified to a single / for clarity.

        # - VSCode (Docker/Remote): 'vscode://file/path/to/project/%%relFile%%:%%line%%'

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