diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-21 17:42:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-21 17:42:32 +0900 |
| commit | f05e1a55cf0d44e9611e06a3d7b4fccdcb90ce7b (patch) | |
| tree | b93311ab2473b988051f0285efb7181afe301fe5 /crates/shirabe/src/command/init_command.rs | |
| parent | 277dc4065d2eb0d6621a6aa56a299a0d2369caf7 (diff) | |
| download | php-shirabe-f05e1a55cf0d44e9611e06a3d7b4fccdcb90ce7b.tar.gz php-shirabe-f05e1a55cf0d44e9611e06a3d7b4fccdcb90ce7b.tar.zst php-shirabe-f05e1a55cf0d44e9611e06a3d7b4fccdcb90ce7b.zip | |
refactor(php-shim): split filter_var into per-filter functions
Replace the dispatch-on-constant filter_var() and filter_var_with_options()
with dedicated filter_var_boolean/url/email/ip and filter_var_int_with_range,
dropping the FILTER_VALIDATE_* constants and updating all call sites.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/init_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/init_command.rs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index f58952e..22cd75b 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -12,11 +12,11 @@ use shirabe_external_packages::symfony::console::input::ArrayInput; use shirabe_external_packages::symfony::console::input::InputInterface; use shirabe_external_packages::symfony::console::output::OutputInterface; use shirabe_php_shim::{ - FILE_IGNORE_NEW_LINES, FILTER_VALIDATE_EMAIL, InvalidArgumentException, PHP_EOL, PhpMixed, - array_filter, array_flip, array_flip_strings, array_intersect_key, array_keys, array_map, - basename, empty, explode, file, file_exists, file_get_contents, file_put_contents, - function_exists, get_current_user, implode, is_dir, is_string, preg_quote, realpath, - server_get, sprintf, str_replace, strpos, strtolower, trim, ucwords, + FILE_IGNORE_NEW_LINES, InvalidArgumentException, PHP_EOL, PhpMixed, array_filter, array_flip, + array_flip_strings, array_intersect_key, array_keys, array_map, basename, empty, explode, file, + file_exists, file_get_contents, file_put_contents, function_exists, get_current_user, implode, + is_dir, is_string, preg_quote, realpath, server_get, sprintf, str_replace, strpos, strtolower, + trim, ucwords, }; use std::cell::RefCell; use std::rc::Rc; @@ -1076,12 +1076,7 @@ impl InitCommand { } pub(crate) fn is_valid_email(&self, email: &str) -> bool { - // assume it's valid if we can't validate it - if !function_exists("filter_var") { - return true; - } - - shirabe_php_shim::filter_var(email, FILTER_VALIDATE_EMAIL) + shirabe_php_shim::filter_var_email(email) } fn update_dependencies(&self, output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) { |
