Skip to content

Commit 9cb3da9

Browse files
committed
chore!: remove unused Utils::to_snake_case() and Utils::deprecate_property
1 parent b67aa5a commit 9cb3da9

3 files changed

Lines changed: 3 additions & 66 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
- chore!: Bump minimum required WordPress version to 6.7
77
- chore!: Bump minimum required Gravity Forms version to 2.9.0
88
- chore!: Bump minimum required WPGraphQL version to 2.5.0
9-
- chore!: Removed the following deprecated fields: `FieldWithPhoneFormat._phoneFormatExperimental` field. `FieldWithProductField.productField` field.
10-
- chore!: Changed the following field types: `FieldWithPhoneFormat.phoneFormat` from `PhoneFieldFormatEnum` to `GfPhoneFormat`.
9+
- chore!: Remove the following deprecated fields: `FieldWithPhoneFormat._phoneFormatExperimental` field. `FieldWithProductField.productField` field.
10+
- chore!: Change the following field types: `FieldWithPhoneFormat.phoneFormat` from `PhoneFieldFormatEnum` to `GfPhoneFormat`.
11+
- chore!: Remove the following unused methods: `Utils::to_snake_case()`, `Utils::deprecate_property()`.
1112
- chore: Test compatibility against PHP 8.5.
1213

1314
## [v0.13.4]

src/Utils/Utils.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,6 @@
2525
* Class - Utils
2626
*/
2727
class Utils {
28-
/**
29-
* Adds deprecation reason to GraphQL field property.
30-
*
31-
* @param array<string,mixed> $property The field property to deprecate.
32-
* @param string $reason The reason for the deprecation. Should be wrapped in __().
33-
*
34-
* @return array<string,mixed>
35-
* @since 0.2.0
36-
*/
37-
public static function deprecate_property( array $property, string $reason ): array {
38-
$property_key = array_key_first( $property );
39-
40-
// Add deprecation reason to property.
41-
if ( isset( $property_key ) ) {
42-
$property[ $property_key ]['deprecationReason'] = $reason;
43-
}
44-
45-
return $property;
46-
}
47-
48-
/**
49-
* Converts a string to snake_case.
50-
*
51-
* @since 0.4.0
52-
*
53-
* @param string $s the original string.
54-
*/
55-
public static function to_snake_case( $s ): string {
56-
return strtolower( (string) preg_replace( [ '/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/' ], '$1_$2', $s ) );
57-
}
58-
5928
/**
6029
* Converts a string to PascalCase.
6130
*

tests/unit/UtilsUtilsTest.php

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,6 @@
1111
* Class - UtilsUtilsTest
1212
*/
1313
class UtilsUtilsTest extends \Codeception\Test\Unit {
14-
/**
15-
* Tests that deprecationReason is added to the property definition.
16-
*/
17-
public function testDeprecateProperty(): void {
18-
$property = [
19-
'propertyName' => [
20-
'type' => 'String',
21-
'description' => 'Some description',
22-
],
23-
];
24-
25-
$deprecationReason = 'This is a test deprecation';
26-
27-
$deprecatedProperty = Utils::deprecate_property( $property, $deprecationReason );
28-
29-
$this->assertEquals( $deprecationReason, $deprecatedProperty['propertyName']['deprecationReason'] );
30-
}
31-
32-
/**
33-
* Tests Utils::to_snake_case() .
34-
*/
35-
public function testToSnakeCase() {
36-
$expected = 'test_string_case';
37-
38-
$string = 'testStringCase';
39-
$to_snake_case = Utils::to_snake_case( $string );
40-
$this->assertEquals( $expected, $to_snake_case );
41-
42-
$string = 'TestStringCase';
43-
$to_snake_case = Utils::to_snake_case( $string );
44-
$this->assertEquals( $expected, $to_snake_case );
45-
}
46-
4714
/**
4815
* Tests Utils::truncate() .
4916
*/

0 commit comments

Comments
 (0)