Skip to content

Commit

Permalink
Utils/CustomPrefixes: make methods final
Browse files Browse the repository at this point in the history
Traits cannot be `final`, but their methods can be, though this will only have an effect if a class `use`-ing the trait is being extended.

All the same, the `final` keyword on the methods should serve as a warning to anyone who wants to overload these methods that they probably shouldn't.
  • Loading branch information
jrfnl committed Dec 14, 2023
1 parent 430f365 commit baf14f2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Yoast/Utils/CustomPrefixesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ trait CustomPrefixesTrait {
*
* @return void
*/
protected function validate_prefixes() {
final protected function validate_prefixes() {
if ( $this->previous_prefixes === $this->prefixes ) {
return;
}
Expand Down Expand Up @@ -109,7 +109,7 @@ protected function filter_prefixes( $prefixes ) {
*
* @return array<string>
*/
protected function filter_allow_only_namespace_prefixes( $prefixes ) {
final protected function filter_allow_only_namespace_prefixes( $prefixes ) {
$filtered = [];
foreach ( $prefixes as $prefix ) {
if ( \strpos( $prefix, '\\' ) === false ) {
Expand All @@ -129,7 +129,7 @@ protected function filter_allow_only_namespace_prefixes( $prefixes ) {
*
* @return array<string>
*/
protected function filter_exclude_lowercase_prefixes( $prefixes ) {
final protected function filter_exclude_lowercase_prefixes( $prefixes ) {
$filtered = [];
foreach ( $prefixes as $prefix ) {
if ( \strtolower( $prefix ) === $prefix ) {
Expand Down

0 comments on commit baf14f2

Please sign in to comment.