Skip to content

Commit

Permalink
Remove parameter type hints in classes implementing ArrayAccess.
Browse files Browse the repository at this point in the history
They're not needed for PHP compatibility and they caused WPCS to throw errors
since the docblocks didn't match.
  • Loading branch information
bradyvercher committed Oct 9, 2024
1 parent ad97049 commit c901d7d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/Authentication/ApiKey/ApiKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ private function format_date( int $timestamp, string $format = null ): string {
*
* @since 0.3.0
*
* @param mixed $name Field name.
* @param string $name Field name.
* @return bool
*/
public function offsetExists( mixed $name ): bool {
public function offsetExists( $name ): bool {
return isset( $this->data[ $name ] );
}

Expand All @@ -196,10 +196,10 @@ public function offsetExists( mixed $name ): bool {
*
* @since 0.3.0
*
* @param mixed $name Field name.
* @param string $name Field name.
* @return mixed
*/
public function offsetGet( mixed $name ): mixed {
public function offsetGet( $name ): mixed {
$method = "get_{$name}";

if ( method_exists( $this, $method ) ) {
Expand All @@ -218,10 +218,10 @@ public function offsetGet( mixed $name ): mixed {
*
* @since 0.3.0
*
* @param mixed $name Field name.
* @param array $value Field value.
* @param string $name Field name.
* @param array $value Field value.
*/
public function offsetSet( mixed $name, $value ): void {
public function offsetSet( $name, $value ): void {
if ( ! $this->is_protected_field( $name ) ) {
$this->data[ $name ] = $value;
}
Expand All @@ -232,9 +232,9 @@ public function offsetSet( mixed $name, $value ): void {
*
* @since 0.3.0
*
* @param mixed $name Field name.
* @param string $name Field name.
*/
public function offsetUnset( mixed $name ): void {
public function offsetUnset( $name ): void {
if ( ! $this->is_protected_field( $name ) ) {
unset( $this->data[ $name ] );
}
Expand Down
18 changes: 9 additions & 9 deletions src/PackageType/BasePackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ public function is_update_available(): bool {
*
* @since 0.3.0
*
* @param mixed $name Property name.
* @param string $name Property name.
* @return bool
*/
public function offsetExists( mixed $name ): bool {
public function offsetExists( $name ): bool {
return method_exists( $this, "get_{$name}" );
}

Expand All @@ -407,10 +407,10 @@ public function offsetExists( mixed $name ): bool {
*
* @since 0.3.0
*
* @param mixed $name Property name.
* @param string $name Property name.
* @return mixed
*/
public function offsetGet( mixed $name ): mixed {
public function offsetGet( $name ): mixed {
$method = "get_{$name}";

if ( ! method_exists( $this, $method ) ) {
Expand All @@ -425,10 +425,10 @@ public function offsetGet( mixed $name ): mixed {
*
* @since 0.3.0
*
* @param mixed $name Property name.
* @param array $value Property value.
* @param string $name Property name.
* @param array $value Property value.
*/
public function offsetSet( mixed $name, $value ): void {
public function offsetSet( $name, $value ): void {
// Prevent properties from being modified.
}

Expand All @@ -437,9 +437,9 @@ public function offsetSet( mixed $name, $value ): void {
*
* @since 0.3.0
*
* @param mixed $name Property name.
* @param string $name Property name.
*/
public function offsetUnset( mixed $name ): void {
public function offsetUnset( $name ): void {
// Prevent properties from being modified.
}
}

0 comments on commit c901d7d

Please sign in to comment.