Skip to content

Commit c5702ba

Browse files
committed
Revert "OXDEV-8213: Move order of filter condition check"
This reverts commit b6d6f82.
1 parent 3add3ee commit c5702ba

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

CHANGELOG-v9.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### Added
1010
- `DataType\Filter\AbstractNumberFilter`
11-
- `DataType\Filter\StringFilter::matches()` to check if string match the filter conditions
1211

1312
### Changed
1413
- Use `DataType\Filter\AbstractNumberFilter` for `DataType\Filter\IntegerFilter` and `DataType\Filter\FloatFilter`

src/DataType/Filter/StringFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ public function contains(): ?string
4444

4545
public function matches(string $value): bool
4646
{
47-
if ($this->equals !== null && $value !== $this->equals) {
47+
if ($this->contains !== null && !str_contains($value, $this->contains)) {
4848
return false;
4949
}
5050

51-
if ($this->contains !== null && !str_contains($value, $this->contains)) {
51+
if ($this->equals !== null && $value !== $this->equals) {
5252
return false;
5353
}
5454

tests/Unit/DataType/Filter/StringFilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public static function matchesDataProvider(): \Generator
171171

172172
yield "test match begins with " => [
173173
'stringForTrueCase' => 'this start',
174-
'stringForFalseCase' => 'this does not start with',
174+
'stringForFalseCase' => 'this deos not start with',
175175
'initFilter' => new StringFilter(beginsWith: 'this start')
176176
];
177177
}

0 commit comments

Comments
 (0)