Skip to content

Conversation

@curry684
Copy link
Contributor

@curry684 curry684 commented Nov 8, 2022

If a problem is emitted proper DX says you should also suggest a solution.

If a problem is emitted proper DX says you should also suggest a solution.
Copy link
Contributor

@staabm staabm left a comment

Choose a reason for hiding this comment

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

I like.

@drupol
Copy link
Contributor

drupol commented Nov 10, 2022

I like it too !

There's also this that might be an option : https://packagist.org/packages/composer/xdebug-handler

@staabm
Copy link
Contributor

staabm commented Nov 10, 2022

There's also this that might be an option

its already used in phpstan, see

"composer/xdebug-handler": "^3.0.3",

$errorOutput->getStyle()->note('You are running with "--xdebug" enabled, but the Xdebug PHP extension is not active. The process will not halt at breakpoints.');
} elseif (!$allowXdebug && XdebugHandler::isXdebugActive()) {
$errorOutput->getStyle()->note('The Xdebug PHP extension is active, but "--xdebug" is not used. This may slow down performance and the process will not halt at breakpoints.');
$errorOutput->getStyle()->note('The Xdebug PHP extension is active, but "--xdebug" is not used. This may slow down performance and the process will not halt at breakpoints. Run with XDEBUG_MODE=off to disable Xdebug and remove this message.');
Copy link
Member

Choose a reason for hiding this comment

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

I'd argue that this message isn't still clear enough. What does "Run with XDEBUG_MODE=off" mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that it's not totally clear, but phpstan is a developer tool, and to developers this is at least a firm push in the right direction. A better explanation would take at least 4 lines, likely more, and at that point I think you're crossing the line it should be explained thoroughly at https://phpstan.org/user-guide/command-line-usage, and the warning itself should just be as it is now.

If the verbose explanation is in the docs people who need it can and will google "phpstan xdebug_mode=off" and find it right away.

@curry684
Copy link
Contributor Author

curry684 commented Nov 10, 2022

If phpstan/phpstan#8343 is merged we could link to https://phpstan.org/user-guide/command-line-usage#--xdebug in the note.

(you may not want to add documentation permalinks to the sources, in that case the google argument still holds)

@ondrejmirtes
Copy link
Member

I'm not really keen on this. It's not the only solution you can do, and the environment variable was introduced only pretty recently with Xdebug 3... Sorry, I decided no to merge this.

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.

4 participants