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

QA/PHP 8.0 | Don't use reserved keywords as param names #561

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Sep 18, 2021

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility/readability of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

Related to #533

QA/PHP 8.0 | Jar::before_redirect_check(): don't use reserved keywords as param names

This changes the parameter name for the Jar::before_redirect_check() function from $return to $response and updates all uses of the parameter in the function to match.

Includes fixing the docblock, in which the parameter name already didn't match the previous parameter name.

QA/PHP 8.0 | Requests::flatten(): don't use reserved keywords as param names

This changes the parameter name for the Requests::flatten() function from $array to $dictionary and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | Cookie::domain_matches(): don't use reserved keywords as param names

This changes the parameter name for the Cookie::domain_matches() function from $string to $domain and updates all uses of the parameter in the function to match.

Includes changing the name of the function local $domain_string variable to $cookie_domain and updating the inline comments for comprehensibility as they had become unclear with the new names in play.

QA/PHP 8.0 | Cookie::parse(): don't use reserved keywords as param names

This changes the parameter name for the Cookie::parse() function from $string to $cookie_header and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | IdnaEncoder::encode(): don't use reserved keywords as param names

This changes the parameter name for the IdnaEncoder::encode() function from $string to $hostname and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | IdnaEncoder::to_ascii(): don't use reserved keywords as param names

This changes the parameter name for the IdnaEncoder::to_ascii() function from $string to $text and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | IdnaEncoder::is_ascii(): don't use reserved keywords as param names

This changes the parameter name for the IdnaEncoder::is_ascii() function from $string to $text and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | IdnaEncoder::nameprep(): don't use reserved keywords as param names

This changes the parameter name for the IdnaEncoder::nameprep() function from $string to $text and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | Iri::replace_invalid_with_pct_encoding(): don't use reserved keywords as param names

This changes the parameter name for the Iri::replace_invalid_with_pct_encoding() function from $string to $text and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | Iri::remove_iunreserved_percent_encoded(): don't use reserved keywords as param names

This changes the parameter name for the Iri::remove_iunreserved_percent_encoded() function from $match to $regex_match and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | Iri::to_uri(): don't use reserved keywords as param names

This changes the parameter name for the Iri::to_uri() function from $string to $iri and updates all uses of the parameter in the function to match.

QA/PHP 8.0 | Test bootstrap: don't use reserved keywords as param names

While this use in the test bootstrap is not problematic, for consistency, it is changed as well.

…s as param names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `Jar::before_redirect_check()` function from `$return` to `$response` and updates all uses of the parameter in the function to match.

Includes fixing the docblock, in which the parameter name already didn't match the previous parameter name.
…m names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `Requests::flatten()` function from `$array` to `$dictionary` and updates all uses of the parameter in the function to match.
… param names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `Cookie::domain_matches()` function from `$string` to `$domain` and updates all uses of the parameter in the function to match.

Includes changing the name of the function local `$domain_string` variable to `$cookie_domain` and updating the inline comments for comprehensibility as they had become unclear with the new names in play.
While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `Cookie::parse()` function from `$string` to `$cookie_header` and updates all uses of the parameter in the function to match.
…ram names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `IdnaEncoder::encode()` function from `$string` to `$hostname` and updates all uses of the parameter in the function to match.
…param names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `IdnaEncoder::to_ascii()` function from `$string` to `$text` and updates all uses of the parameter in the function to match.
…param names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `IdnaEncoder::is_ascii()` function from `$string` to `$text` and updates all uses of the parameter in the function to match.
…param names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `IdnaEncoder::nameprep()` function from `$string` to `$text` and updates all uses of the parameter in the function to match.
…rved keywords as param names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `Iri::replace_invalid_with_pct_encoding()` function from `$string` to `$text` and updates all uses of the parameter in the function to match.
…erved keywords as param names

While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `Iri::remove_iunreserved_percent_encoded()` function from `$match` to `$regex_match` and updates all uses of the parameter in the function to match.
While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

This changes the parameter name for the `Iri::to_uri()` function from `$string` to `$iri` and updates all uses of the parameter in the function to match.
While using reserved keywords as parameter names is perfectly valid PHP, I would strongly recommend against it as this decreases the comprehensibility of code when these parameter names are subsequently used in function calls using named parameters (PHP 8.0+).

While this use in the test bootstrap is not problematic, for consistency, it is changed as well.
@jrfnl jrfnl added this to the 2.0.0 milestone Sep 18, 2021
@schlessera schlessera merged commit be67578 into develop Sep 23, 2021
@schlessera schlessera deleted the feature/533-dont-use-reserved-keywords-as-param-names branch September 23, 2021 10:00
@jrfnl jrfnl mentioned this pull request Nov 7, 2021
14 tasks
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.

2 participants