|
| 1 | +# Troubleshooting |
| 2 | + |
| 3 | +This section covers common issues you might encounter when using the PHP Booster and how to resolve them. |
| 4 | + |
| 5 | +## Integration Issues |
| 6 | + |
| 7 | +### Integration Script Fails |
| 8 | + |
| 9 | +**Problem**: The integration script fails with errors about missing dependencies. |
| 10 | + |
| 11 | +**Solution**: |
| 12 | +1. Ensure you have all required tools installed: |
| 13 | + ```bash |
| 14 | + # Check if curl is available |
| 15 | + which curl |
| 16 | + |
| 17 | + # For DDEV projects, ensure DDEV is running |
| 18 | + ddev status |
| 19 | + ``` |
| 20 | + |
| 21 | +2. Run the integration script in verbose mode to see detailed error messages. |
| 22 | + |
| 23 | +### Files Not Created |
| 24 | + |
| 25 | +**Problem**: Expected booster files are not created in your project. |
| 26 | + |
| 27 | +**Solution**: |
| 28 | +1. Check that you ran the integration script from your project root |
| 29 | +2. Verify you have write permissions in the project directory |
| 30 | +3. Check if your project has any conflicting files that might prevent creation |
| 31 | + |
| 32 | +### Permission Errors |
| 33 | + |
| 34 | +**Problem**: Permission denied errors when running integration. |
| 35 | + |
| 36 | +**Solution**: |
| 37 | +```bash |
| 38 | +# Ensure execute permissions on scripts |
| 39 | +chmod +x tools/runner.sh |
| 40 | +chmod +x tools/git-hooks/setup.sh |
| 41 | + |
| 42 | +# For DDEV projects |
| 43 | +ddev restart |
| 44 | +``` |
| 45 | + |
| 46 | +## Git Hooks Issues |
| 47 | + |
| 48 | +### Pre-commit Hook Fails |
| 49 | + |
| 50 | +**Problem**: Pre-commit hook fails with "Could not open input file" errors. |
| 51 | + |
| 52 | +**Solution**: This is usually a path resolution issue in DDEV containers. |
| 53 | + |
| 54 | +1. Check that the hook script has correct file paths: |
| 55 | + ```bash |
| 56 | + # Check pre-commit hook |
| 57 | + cat .husky/pre-commit.bash |
| 58 | + |
| 59 | + # Ensure runner script exists |
| 60 | + ls -la tools/runner.sh |
| 61 | + ``` |
| 62 | + |
| 63 | +2. For DDEV, restart the container: |
| 64 | + ```bash |
| 65 | + ddev restart |
| 66 | + ``` |
| 67 | + |
| 68 | +### Branch Name Validation Fails |
| 69 | + |
| 70 | +**Problem**: Valid branch names are rejected or invalid ones are accepted. |
| 71 | + |
| 72 | +**Solution**: Check your branch naming configuration: |
| 73 | + |
| 74 | +1. Review the validation config: |
| 75 | + ```bash |
| 76 | + cat validate-branch-name.config.cjs |
| 77 | + ``` |
| 78 | + |
| 79 | +2. Test branch validation manually: |
| 80 | + ```bash |
| 81 | + # Test current branch |
| 82 | + node_modules/.bin/validate-branch-name |
| 83 | + |
| 84 | + # Test specific branch name |
| 85 | + node_modules/.bin/validate-branch-name -t "feature/PRJ-123-my-feature" |
| 86 | + ``` |
| 87 | + |
| 88 | +3. Common valid patterns: |
| 89 | + - `feature/PRJ-123-my-feature` |
| 90 | + - `fix/ERM-456-bug-fix` |
| 91 | + - `chore/update-docs` |
| 92 | + |
| 93 | +### Commit Message Validation Issues |
| 94 | + |
| 95 | +**Problem**: Commit messages are rejected even when they seem correct. |
| 96 | + |
| 97 | +**Solution**: |
| 98 | +1. Ensure you're following Conventional Commits format: |
| 99 | + ``` |
| 100 | + type(scope): description |
| 101 | + |
| 102 | + Examples: |
| 103 | + feat: add user authentication |
| 104 | + fix(auth): correct password validation |
| 105 | + chore: update dependencies |
| 106 | + ``` |
| 107 | + |
| 108 | +2. Check commitlint configuration: |
| 109 | + ```bash |
| 110 | + cat commitlint.config.ts |
| 111 | + ``` |
| 112 | + |
| 113 | +## Tool Integration Issues |
| 114 | + |
| 115 | +### Composer Scripts Not Working |
| 116 | + |
| 117 | +**Problem**: `composer ecs`, `composer phpstan`, etc. commands fail. |
| 118 | + |
| 119 | +**Solution**: |
| 120 | +1. Verify tools are installed: |
| 121 | + ```bash |
| 122 | + composer show | grep -E "(phpstan|rector|symplify|psalm)" |
| 123 | + ``` |
| 124 | + |
| 125 | +2. For DDEV projects, use DDEV commands: |
| 126 | + ```bash |
| 127 | + ddev composer ecs |
| 128 | + ddev composer phpstan |
| 129 | + ``` |
| 130 | + |
| 131 | +3. Check if composer scripts exist: |
| 132 | + ```bash |
| 133 | + cat composer.json | jq '.scripts' |
| 134 | + ``` |
| 135 | + |
| 136 | +### ECS/PHPStan Path Issues |
| 137 | + |
| 138 | +**Problem**: Code quality tools can't find files or have path resolution errors. |
| 139 | + |
| 140 | +**Solution**: This often happens with DDEV containerization. |
| 141 | + |
| 142 | +1. Use the runner script: |
| 143 | + ```bash |
| 144 | + # Instead of direct tool calls |
| 145 | + bash tools/runner.sh vendor/bin/ecs check src/ |
| 146 | + |
| 147 | + # Use composer scripts (recommended) |
| 148 | + ddev composer ecs |
| 149 | + ``` |
| 150 | + |
| 151 | +2. Check tool configurations have correct paths: |
| 152 | + ```bash |
| 153 | + # Check ECS config |
| 154 | + cat ecs.php |
| 155 | + |
| 156 | + # Check PHPStan config |
| 157 | + cat phpstan.neon.dist |
| 158 | + ``` |
| 159 | + |
| 160 | +## DDEV Issues |
| 161 | + |
| 162 | +### Container Not Starting |
| 163 | + |
| 164 | +**Problem**: DDEV containers fail to start or show errors. |
| 165 | + |
| 166 | +**Solution**: |
| 167 | +1. Check DDEV status and logs: |
| 168 | + ```bash |
| 169 | + ddev status |
| 170 | + ddev logs |
| 171 | + ``` |
| 172 | + |
| 173 | +2. Restart DDEV: |
| 174 | + ```bash |
| 175 | + ddev restart |
| 176 | + ``` |
| 177 | + |
| 178 | +3. If containers are corrupted, recreate: |
| 179 | + ```bash |
| 180 | + ddev delete -y |
| 181 | + ddev start |
| 182 | + ``` |
| 183 | + |
| 184 | +### Performance Issues |
| 185 | + |
| 186 | +**Problem**: DDEV is slow or unresponsive. |
| 187 | + |
| 188 | +**Solution**: |
| 189 | +1. Configure Mutagen for better file sync performance (especially on macOS): |
| 190 | + ```bash |
| 191 | + ddev config --mutagen-enabled |
| 192 | + ddev restart |
| 193 | + ``` |
| 194 | + |
| 195 | +2. Exclude unnecessary directories from sync: |
| 196 | + ```yaml |
| 197 | + # In .ddev/config.yaml |
| 198 | + upload_dirs: |
| 199 | + - storage/app/uploads |
| 200 | + ``` |
| 201 | +
|
| 202 | +## Testing Issues |
| 203 | +
|
| 204 | +### Integration Tests Failing |
| 205 | +
|
| 206 | +**Problem**: The test script fails when running integration tests. |
| 207 | +
|
| 208 | +**Solution**: |
| 209 | +1. Check requirements: |
| 210 | + ```bash |
| 211 | + ./tools/internal-test/test-integration.py env-check |
| 212 | + ``` |
| 213 | + |
| 214 | +2. Clean test environment: |
| 215 | + ```bash |
| 216 | + ./tools/internal-test/test-integration.py clean |
| 217 | + ``` |
| 218 | + |
| 219 | +3. Run individual test steps to isolate issues: |
| 220 | + ```bash |
| 221 | + # Test setup only |
| 222 | + ./tools/internal-test/test-integration.py setup |
| 223 | + |
| 224 | + # Test integration only |
| 225 | + ./tools/internal-test/test-integration.py integrate |
| 226 | + |
| 227 | + # Check status |
| 228 | + ./tools/internal-test/test-integration.py status |
| 229 | + ``` |
| 230 | + |
| 231 | +### Test Environment Cleanup |
| 232 | + |
| 233 | +**Problem**: Test environments are not cleaned up properly. |
| 234 | + |
| 235 | +**Solution**: |
| 236 | +```bash |
| 237 | +# Automatic cleanup |
| 238 | +./tools/internal-test/test-integration.py clean |
| 239 | + |
| 240 | +# Manual cleanup if script fails |
| 241 | +cd tests/laravel/test-project && ddev delete -y |
| 242 | +rm -rf tests/laravel/test-project |
| 243 | +rm -rf tests/symfony/test-project |
| 244 | + |
| 245 | +# Clean Docker resources if needed |
| 246 | +docker system prune -f |
| 247 | +``` |
| 248 | + |
| 249 | +## IDE Configuration Issues |
| 250 | + |
| 251 | +### VSCode Extensions Not Working |
| 252 | + |
| 253 | +**Problem**: Recommended VSCode extensions don't provide expected functionality. |
| 254 | + |
| 255 | +**Solution**: |
| 256 | +1. Check extensions are installed: |
| 257 | + ```bash |
| 258 | + code --list-extensions |
| 259 | + ``` |
| 260 | + |
| 261 | +2. Install missing extensions: |
| 262 | + ```bash |
| 263 | + # Install from workspace recommendations |
| 264 | + code --install-extension ms-vscode-remote.remote-containers |
| 265 | + code --install-extension DEVSENSE.phptools-vscode |
| 266 | + ``` |
| 267 | + |
| 268 | +3. Check extension settings in `.vscode/settings.json` |
| 269 | + |
| 270 | +### PHPStorm Integration Issues |
| 271 | + |
| 272 | +**Problem**: PHPStorm doesn't recognize the project structure or DDEV. |
| 273 | + |
| 274 | +**Solution**: |
| 275 | +1. Install and configure DDEV Integration plugin |
| 276 | +2. Set up PHP interpreter to use DDEV: |
| 277 | + - Go to Settings → PHP → Servers |
| 278 | + - Add new server with DDEV configuration |
| 279 | +3. Check `.phpstorm` directory configuration files |
| 280 | + |
| 281 | +## Getting Help |
| 282 | + |
| 283 | +If you're still experiencing issues: |
| 284 | + |
| 285 | +1. Check the [GitHub Issues](https://github.com/TerrorSquad/php-blueprint/issues) for similar problems |
| 286 | +2. Run the test script to validate your setup: |
| 287 | + ```bash |
| 288 | + ./tools/internal-test/test-integration.py full |
| 289 | + ``` |
| 290 | +3. Create a new issue with: |
| 291 | + - Your operating system and PHP version |
| 292 | + - DDEV version (if applicable) |
| 293 | + - Full error output |
| 294 | + - Steps to reproduce the issue |
0 commit comments