Skip to content

Commit

Permalink
Add extensions naming conventions to ext_skel.php
Browse files Browse the repository at this point in the history
- first character is a letter
- followed by any number of letters, numbers, or underscores
- prefferred are lower case letters
  • Loading branch information
petk committed May 14, 2019
1 parent 63e43e1 commit 44952cd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ext/ext_skel.php
Expand Up @@ -226,6 +226,13 @@ function process_args($argv, $argc) {
error('The skeleton directory was not found');
}

// Validate extension name
if (!preg_match('/^[a-z][a-z0-9_]+$/i', $options['ext'])) {
error('Invalid extension name. Valid names start with a letter,'
.' followed by any number of letters, numbers, or underscores.'
.' Using only lower case letters is preferred.');
}

$options['ext'] = str_replace(['\\', '/'], '', strtolower($options['ext']));

return $options;
Expand Down

0 comments on commit 44952cd

Please sign in to comment.