-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add playground for testing and improve editorUrl documentation #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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]>
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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%%' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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%%' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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%%' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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%%' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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%%'
Summary
playgrounddirectory with sample PHP files for testing PHPStan friendly formattercomposer playgroundscript for easy testingeditorUrlconfiguration documentationChanges
Playground
playground/type_errors.php- Type mismatches, nullable handlingplayground/undefined_errors.php- Undefined variables, methods, classesplayground/dead_code.php- Unreachable code, unused methodsplayground/missing_types.php- Missing type declarationsplayground/logic_errors.php- Division by zero, impossible comparisonsDocumentation
%%file%%,%%relFile%%,%%line%%)%%relFile%%Configuration
.php-cs-fixer.dist.php)composer playgroundscriptphpstan.neon.distTest plan
composer playgroundto verify errors are detected and formatted correctlycomposer teststo ensure existing tests pass🤖 Generated with Claude Code