Skip to content

Commit

Permalink
Merge pull request #11 from sanovskiy/dev
Browse files Browse the repository at this point in the history
NamingStyle now allows digits in strings
  • Loading branch information
sanovskiy authored Mar 20, 2024
2 parents a0c9f8b + b36e7f2 commit 3f02441
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/NamingStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ class NamingStyle
{
public static function isUpperCamelCase(string $str): bool
{
return preg_match('/^[A-Z][a-zA-Z]*$/', $str) === 1;
return preg_match('/^[A-Z][a-zA-Z\d]*$/', $str) === 1;
}

public static function isLowerCamelCase(string $str): bool
{
return preg_match('/^[a-z]*[A-Z][a-zA-Z]*$/', $str) === 1;
return preg_match('/^[a-z]*[A-Z][a-zA-Z\d]*$/', $str) === 1;
}

public static function isSnakeCase(string $str): bool
{
return preg_match('/^[a-z]+(_[a-z]+)*$/', $str) === 1;
return preg_match('/^[a-z\d]+(_[a-z\d]+)*$/', $str) === 1;
}

public static function isScreamingSnakeCase(string $str): bool
{
return preg_match('/^[A-Z]+(_[A-Z]+)*$/', $str) === 1;
return preg_match('/^[A-Z\d]+(_[A-Z\d]+)*$/', $str) === 1;
}

public static function toSnakeCase(string $str): string
Expand Down

0 comments on commit 3f02441

Please sign in to comment.