PHP Magic Number Detector
This extension helps you detect magic numbers in PHP files and suggests replacing them with named constants.
Features
- Automatically detects magic numbers in PHP files.
- Provides warnings for detected magic numbers.
- Offers suggestions to replace magic numbers with named constants.
Installation
- Open Visual Studio Code.
- Go to Extensions (
Ctrl+Shift+X or Cmd+Shift+X ).
- Search for
PHP Magic Number Detector and click "Install".
Usage
- Open a PHP file.
- Run the command
Detect PHP Magic Numbers from the Command Palette (Ctrl+Shift+P or Cmd+Shift+P ).
- View warnings directly in your editor for detected magic numbers.
Configuration
You can configure the allowed magic numbers in your settings.json file:
{
"magicNumberDetector.allowedNumbers": [0, 1]
}
License
MIT
| |