feat(php): add PHP to SupportedLanguages enum and file extension detection

Uncomment PHP = 'php' in both CLI and web SupportedLanguages enums.
Add .php, .phtml, .php3/.4/.5/.8 extension detection to getLanguageFromFilename()
in both packages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Güneş Bizim 2026-02-25 01:03:44 +03:00
parent 6be54ce9d3
commit 7883bf2cf0
4 changed files with 14 additions and 2 deletions

View file

@ -8,7 +8,7 @@ export enum SupportedLanguages {
CSharp = 'csharp',
Go = 'go',
Rust = 'rust',
// PHP = 'php',
PHP = 'php',
// Ruby = 'ruby',
// Swift = 'swift',
}

View file

@ -25,6 +25,12 @@ export const getLanguageFromFilename = (filename: string): SupportedLanguages |
if (filename.endsWith('.go')) return SupportedLanguages.Go;
// Rust
if (filename.endsWith('.rs')) return SupportedLanguages.Rust;
// PHP (all common extensions)
if (filename.endsWith('.php') || filename.endsWith('.phtml') ||
filename.endsWith('.php3') || filename.endsWith('.php4') ||
filename.endsWith('.php5') || filename.endsWith('.php8')) {
return SupportedLanguages.PHP;
}
return null;
};

View file

@ -8,7 +8,7 @@ export enum SupportedLanguages {
CSharp = 'csharp',
Go = 'go',
Rust = 'rust',
// PHP = 'php',
PHP = 'php',
// Ruby = 'ruby',
// Swift = 'swift',
}

View file

@ -31,6 +31,12 @@ export const getLanguageFromFilename = (filename: string): SupportedLanguages |
if (filename.endsWith('.go')) return SupportedLanguages.Go;
// Rust
if (filename.endsWith('.rs')) return SupportedLanguages.Rust;
// PHP (all common extensions)
if (filename.endsWith('.php') || filename.endsWith('.phtml') ||
filename.endsWith('.php3') || filename.endsWith('.php4') ||
filename.endsWith('.php5') || filename.endsWith('.php8')) {
return SupportedLanguages.PHP;
}
return null;
};