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

Move escaping functions related functionality to dedicated EscapingFunctionsTrait #2249

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jun 14, 2023

Move escaping functions related functionality to dedicated EscapingFunctionsTrait

The escaping function lists are only used by a small set of sniffs, so are better placed in a dedicated trait.

The choice for a trait over a class is due to the public properties allowing for adding additional functions to these lists.

Moving both the base function lists + the public properties to the same trait will allow us to encapsulate all the functionality related to the use of these lists in one place.

The $escapingFunctions and the $autoEscapedFunctions properties, containing the base lists, have also been made private.

Checking whether or not something is an escaping function should now be done by calling the EscapingFunctionsTrait::is_escaping_function() and/or the EscapingFunctionsTrait::is_auto_escaped_function() methods.

Related to #1465

…unctionsTrait`

The escaping function lists are only used by a small set of sniffs, so are better placed in a dedicated trait.

The choice for a `trait` over a `class` is due to the `public` properties allowing for adding additional functions to these lists.

Moving both the base function lists + the `public` properties to the same trait will allow us to encapsulate all the functionality related to the use of these lists in one place.

The `$escapingFunctions` and the `$autoEscapedFunctions` properties, containing the base lists, have also been made `private`.

Checking whether or not something is an escaping function should now be done by calling the `EscapingFunctionsTrait::is_escaping_function()` and/or the `EscapingFunctionsTrait::is_auto_escaped_function()` methods.

Related to 1465
Copy link
Member

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dingo-d dingo-d merged commit 281fe65 into develop Jun 15, 2023
@dingo-d dingo-d deleted the feature/new-escapingfunctionstrait branch June 15, 2023 06:13
@jrfnl jrfnl mentioned this pull request Jun 16, 2023
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.

3 participants