Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New NamingConventions class #119

Merged
merged 1 commit into from
Mar 26, 2020
Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Mar 26, 2020

.. for working with identifier names (namespace names, class/trait/interface names, function names, variable and constant names).

Initially this class comes with two new utility methods, but the intention is to add a range of additional utilities for common naming conventions (camelCase, snake_case etc) and conversions between those conventions in the near future.

For now, the class contains the following methods:

  • isValidIdentifierName() - to verify whether an arbitrary text string is valid as an identifier name in PHP. A leading $ for a variable should be removed prior to passing the name to this method. Returns boolean.
  • isEqual() - to check if two arbitrary identifier names will be seen as the same in PHP. This method is specifically aimed at the "case-insensitive" (but not really) identifier names, like namespace, class and function names. Do NOT use this method for variables or constants! Returns boolean.

Includes dedicated unit tests.

.. for working with identifier names (namespace names, class/trait/interface names, function names, variable and constant names).

Initially this class comes with two new utility methods, but the intention is to add a range of additional utilities for common naming conventions (camelCase, snake_case etc) and conversions between those conventions in the near future.

For now, the class contains the following methods:
* `isValidIdentifierName()` - to verify whether an arbitrary text string is valid as an identifier name in PHP. A leading `$` for a variable should be removed prior to passing the name to this method. Returns boolean.
* `isEqual()` - to check if two arbitrary identifier names will be seen as the same in PHP. This method is specifically aimed at the "case-insensitive" (but not really) identifier names, like namespace, class and function names. Do NOT use this method for variables or constants! Returns boolean.

Includes dedicated unit tests.
@jrfnl jrfnl added this to the 1.0.0 milestone Mar 26, 2020
@jrfnl jrfnl merged commit 0ba4de2 into develop Mar 26, 2020
@jrfnl jrfnl deleted the feature/new-namingconventions-class branch March 26, 2020 02:16
@jrfnl jrfnl modified the milestones: 1.0.0, 1.0.0-alpha3 May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant