Skip to content

Commit e6d2b38

Browse files
author
mikey179
committed
deprecate bovigo\assert\predicate\Predicate::negate() in favor of bovigo\assert\predicate\not()
1 parent be21e3c commit e6d2b38

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
### BC breaks
55

6-
* deprecated `bovigo\assert\predicate\Predicate::asWellAs()` in favor of the new `bovigo\assert\predicate\Predicate::and()` method, will be removed with 2.0.0
7-
* deprecated `bovigo\assert\predicate\Predicate::orElse()` in favor of the new `bovigo\assert\predicate\Predicate::or()` method, will be removed with 2.0.0
6+
* deprecated `bovigo\assert\predicate\Predicate::asWellAs()` in favor of `bovigo\assert\predicate\Predicate::and()`, will be removed with 2.0.0
7+
* deprecated `bovigo\assert\predicate\Predicate::orElse()` in favor of `bovigo\assert\predicate\Predicate::or()`, will be removed with 2.0.0
8+
* deprecated `bovigo\assert\predicate\Predicate::negate()` in favor of `bovigo\assert\predicate\not()`, will be removed with 2.0.0
89

910

1011
### Other changes

src/main/php/predicate/Predicate.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function orElse($other)
8383
* returns a negated version of this predicate
8484
*
8585
* @return \bovigo\assert\predicate\Predicate
86+
* @deprecated since 1.4.0, use not($predicate) instead, will be removed with 2.0.0
8687
*/
8788
public function negate()
8889
{

src/test/php/predicate/PredicateTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,24 @@ public function orReturnsOrPredicate()
116116

117117
/**
118118
* @test
119+
* @deprecated since 1.4.0, will be removed with 2.0.0
119120
*/
120121
public function negateReturnsNegatePredicate()
121122
{
122123
$predicate = new FooPredicate();
123124
assert($predicate->negate(), isInstanceOf(NegatePredicate::class));
124125
}
125126

127+
/**
128+
* @test
129+
* @since 1.4.0
130+
*/
131+
public function everyPredicateCanBeNegated()
132+
{
133+
$isNotFoo = not(new FooPredicate());
134+
assert('bar', $isNotFoo);
135+
}
136+
126137
/**
127138
* @test
128139
*/
@@ -148,7 +159,7 @@ public function assertionFailureContainsMeaningfulInformation()
148159
*/
149160
public function assertionFailureNegatedContainsMeaningfulInformation()
150161
{
151-
assert('foo', (new FooPredicate())->negate());
162+
assert('foo', not(new FooPredicate()));
152163
}
153164

154165
/**

0 commit comments

Comments
 (0)