-
Notifications
You must be signed in to change notification settings - Fork 146
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
fix: disable xdebug automatically #325
Conversation
0243c86
to
8aa9a3d
Compare
Thanks for your pull request to Laravel! Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include. If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions! |
This change gave a 10x performance improvement in my project (from 12 minutes to ~1 minute). See #309. Might be worth reconsidering. If not, maybe add a note in the docs about setting XDEBUG_MODE=off when running pint. |
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 idea behind this good, but the code doesn't reflect the goal of what pretend to be fixed.
Take my comments as contribution, i'm not contributor at all.
/* | ||
|-------------------------------------------------------------------------- | ||
| Restart If Xdebug Is Loaded | ||
|-------------------------------------------------------------------------- | ||
| | ||
| If the Xdebug extension is loaded, the application will automatically | ||
| restart unless the environment variable PINT_ALLOW_XDEBUG is set. This | ||
| ensures the application runs without the performance overhead of Xdebug. | ||
| | ||
*/ | ||
|
||
(new Composer\XdebugHandler\XdebugHandler('PINT'))->check(); | ||
|
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.
If you want update the bootstrap file, probably you'll need to design a contract for it.
Think about the idea of create a instance just to run one method and after that, release it into the void.
If you read more forward or deep, you'll understand that they bind classes to contracts.
"require-dev": { | ||
"composer/xdebug-handler": "^3.0.5", | ||
"friendsofphp/php-cs-fixer": "^3.66.0", |
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.
Adding a dependency can be convenient but the source must be trustfully.
Of course, composer is safe but is necessary?
The more decoupled and independent something is, the better.
This pull request addresses performance issues caused by the Xdebug extension being enabled during the execution of Pint. By incorporating the
Composer\XdebugHandler\XdebugHandler
class, the application will automatically restart without Xdebug unless the environment variablePINT_ALLOW_XDEBUG
is set. This ensures that Pint runs without the performance overhead associated with Xdebug.This fix might be related to the following issues: #309, #299 and #275.
Reference: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/ad0cc3078a93a8438edbc58e7e2094a8b38d7389/php-cs-fixer#L102-L105