File tree Expand file tree Collapse file tree
src/Requests/PostSubscription
tests/Requests/PostSubscription Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 "php" : " ^8.2" ,
2929 "ext-json" : " *" ,
3030 "guzzlehttp/guzzle" : " ^6.3|^7.2" ,
31- "myclabs/php-enum" : " ^1.8" ,
3231 "psr/log" : " ^2|^3" ,
3332 "symfony/validator" : " ^6.4|^7.0"
3433 },
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function jsonSerialize(): array
2727 ];
2828
2929 if ($ this ->operator !== null ) {
30- $ data ['operator ' ] = $ this ->operator ->getValue () ;
30+ $ data ['operator ' ] = $ this ->operator ->value ;
3131 }
3232
3333 return $ data ;
Original file line number Diff line number Diff line change 44
55namespace Keboola \NotificationClient \Requests \PostSubscription ;
66
7- use DomainException ;
8- use MyCLabs \Enum \Enum ;
9-
10- /**
11- * @method static self EQUAL()
12- * @method static self LESS_THAN()
13- * @method static self GREATER_THAN()
14- * @method static self LESS_THAN_OR_EQUAL()
15- * @method static self GREATER_THAN_OR_EQUAL()
16- *
17- * @phpstan-extends Enum<string>
18- */
19- class FilterOperator extends Enum
7+ enum FilterOperator: string
208{
21- // phpcs:disable SlevomatCodingStandard.Classes.UnusedPrivateElements
22- // @phpstan-ignore-next-line
23- private const EQUAL = '== ' ; // can't be called EQUALS because there is a method called `equals` on base Enum class
24- // @phpstan-ignore-next-line
25- private const LESS_THAN = '< ' ;
26- // @phpstan-ignore-next-line
27- private const GREATER_THAN = '> ' ;
28- // @phpstan-ignore-next-line
29- private const LESS_THAN_OR_EQUAL = '<= ' ;
30- // @phpstan-ignore-next-line
31- private const GREATER_THAN_OR_EQUAL = '>= ' ;
32- // phpcs:enable SlevomatCodingStandard.Classes.UnusedPrivateElements
9+ case Equal = '== ' ;
10+ case LessThan = '< ' ;
11+ case GreaterThan = '> ' ;
12+ case LessThanOrEqual = '<= ' ;
13+ case GreaterThanOrEqual = '>= ' ;
3314}
Original file line number Diff line number Diff line change @@ -14,15 +14,15 @@ class FilterOperatorTest extends TestCase
1414 */
1515 public function testOperatorValues (FilterOperator $ operator , string $ expectedValue ): void
1616 {
17- self ::assertSame ($ expectedValue , $ operator ->getValue () );
17+ self ::assertSame ($ expectedValue , $ operator ->value );
1818 }
1919
2020 public function provideOperatorValues (): iterable
2121 {
22- yield 'equals ' => [FilterOperator::EQUAL () , '== ' ];
23- yield 'less than ' => [FilterOperator::LESS_THAN () , '< ' ];
24- yield 'greater than ' => [FilterOperator::GREATER_THAN () , '> ' ];
25- yield 'less than or equals ' => [FilterOperator::LESS_THAN_OR_EQUAL () , '<= ' ];
26- yield 'greater than or equals ' => [FilterOperator::GREATER_THAN_OR_EQUAL () , '>= ' ];
22+ yield 'equals ' => [FilterOperator::Equal , '== ' ];
23+ yield 'less than ' => [FilterOperator::LessThan , '< ' ];
24+ yield 'greater than ' => [FilterOperator::GreaterThan , '> ' ];
25+ yield 'less than or equals ' => [FilterOperator::LessThanOrEqual , '<= ' ];
26+ yield 'greater than or equals ' => [FilterOperator::GreaterThanOrEqual , '>= ' ];
2727 }
2828}
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public function testJsonSerialize(): void
2424
2525 public function testJsonSerializeWithOperator (): void
2626 {
27- $ filter = new Filter ('someName ' , 'someValue ' , FilterOperator::GREATER_THAN_OR_EQUAL () );
27+ $ filter = new Filter ('someName ' , 'someValue ' , FilterOperator::GreaterThanOrEqual );
2828 self ::assertSame (
2929 [
3030 'field ' => 'someName ' ,
You can’t perform that action at this time.
0 commit comments