Skip to content

Commit 63b5500

Browse files
committed
Fix typos and update CHANGELOG for 2.2.2
1 parent cf4fc8e commit 63b5500

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## [2.2.2] - 2021-01-09
6+
7+
### Fixed
8+
9+
- Fix `getOccurrencesAfter` returns empty array when `$inclusive` is `false` and `$limit` is not set [#93](https://github.com/rlanvin/php-rrule/pull/93)
10+
511
## [2.2.1] - 2020-12-09
612

713
### Fixed
@@ -196,7 +202,8 @@
196202

197203
- First release, everything before that was unversioned (`dev-master` was used).
198204

199-
[Unreleased]: https://github.com/rlanvin/php-rrule/compare/v2.2.1...HEAD
205+
[Unreleased]: https://github.com/rlanvin/php-rrule/compare/v2.2.2...HEAD
206+
[2.2.2]: https://github.com/rlanvin/php-rrule/compare/v2.2.1...v2.2.2
200207
[2.2.1]: https://github.com/rlanvin/php-rrule/compare/v2.2.0...v2.2.1
201208
[2.2.0]: https://github.com/rlanvin/php-rrule/compare/v2.1.0...v2.2.0
202209
[2.1.0]: https://github.com/rlanvin/php-rrule/compare/v2.0.0...v2.1.0

src/RRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ protected function getTimeSet($hour, $minute, $second)
13141314
* at year 1 to Jan 1st 10.00 at year 2.
13151315
*
13161316
* In order to make a "smart jump", we would have to have a way to determine
1317-
* the gap between the next occurence arithmetically. I think that would require
1317+
* the gap between the next occurrence arithmetically. I think that would require
13181318
* to analyze each "BYXXX" rule part that "Limit" the set (see the RFC page 43)
13191319
* at the given frequency. For example, a YEARLY frequency doesn't need "smart
13201320
* jump" at all; MONTHLY and WEEKLY frequencies only need to check BYMONTH;

src/RRuleTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function getOccurrencesBetween($begin, $end, $limit = null)
9999
return $res;
100100
}
101101

102-
public function getOccurrencesAfter($date, $inclusive = false, $limit = null)
102+
public function getOccurrencesAfter($date, $inclusive = false, $limit = null)
103103
{
104104
if ($inclusive || ! $this->occursAt($date)) {
105105
return $this->getOccurrencesBetween($date, null, $limit);

tests/RRuleTest.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ public function rfcExamples()
12531253
date_create('1999-03-11 09:00:00'),
12541254
date_create('1999-03-12 09:00:00'),
12551255
date_create('1999-03-13 09:00:00'))),
1256-
// Every Tuesday, every other month, 6 occurences.
1256+
// Every Tuesday, every other month, 6 occurrences.
12571257
array(
12581258
array('freq' => 'monthly', 'count' => 6, 'interval' => 2, 'byday' => 'TU', 'dtstart' => '1997-09-02 09:00:00'),
12591259
array(date_create('1997-09-02 09:00:00'),
@@ -1501,7 +1501,7 @@ public function testRfcExamples($rule, $occurrences)
15011501
}
15021502

15031503
/**
1504-
* Rules that generate no occurence, because of a bad combination of BYXXX parts
1504+
* Rules that generate no occurrence, because of a bad combination of BYXXX parts
15051505
* This tests are here to ensure that the lib will not go into an infinite loop.
15061506
*/
15071507
public function rulesWithoutOccurrences()
@@ -1525,7 +1525,7 @@ public function rulesWithoutOccurrences()
15251525
'count' => 1
15261526
)),
15271527

1528-
// haven't found a weekly rule with no occurence yet
1528+
// haven't found a weekly rule with no occurrence yet
15291529

15301530
// every 7 days, monday, starting a wednesday (still nope)
15311531
array(array(
@@ -1785,10 +1785,10 @@ public function notOccurrences()
17851785
/**
17861786
* @dataProvider notOccurrences
17871787
*/
1788-
public function testNotOccurrences($rule, $not_occurences)
1788+
public function testNotOccurrences($rule, $not_occurrences)
17891789
{
17901790
$rule = new RRule($rule);
1791-
foreach ($not_occurences as $date) {
1791+
foreach ($not_occurrences as $date) {
17921792
$this->assertFalse($rule->occursAt($date), "Rule must not match $date");
17931793
}
17941794
}
@@ -1912,6 +1912,7 @@ public function occurrencesAfter()
19121912
{
19131913
return [
19141914
["DTSTART:20170101\nRRULE:FREQ=DAILY;UNTIL=20170103", '2017-01-01', false, null, [date_create('2017-01-02'), date_create('2017-01-03')]],
1915+
["DTSTART:20170101\nRRULE:FREQ=DAILY;UNTIL=20170103", '2017-01-01', true, null, [date_create('2017-01-01'), date_create('2017-01-02'), date_create('2017-01-03')]],
19151916
["DTSTART:20170101\nRRULE:FREQ=DAILY", '2017-02-01', false, 2, [date_create('2017-02-02'),date_create('2017-02-03')]],
19161917
["DTSTART:20170101\nRRULE:FREQ=DAILY", '2017-02-01', true, 2, [date_create('2017-02-01'),date_create('2017-02-02')]],
19171918
["DTSTART:20170101\nRRULE:FREQ=DAILY;INTERVAL=2", '2017-01-02', true, 2, [date_create('2017-01-03'),date_create('2017-01-05')]],
@@ -1929,6 +1930,17 @@ public function testGetOccurrencesAfter($rrule, $date, $inclusive, $limit, $expe
19291930
$this->assertEquals($expected, $occurrences);
19301931
}
19311932

1933+
public function testGetOccurrencesAfterThrowsLogicException()
1934+
{
1935+
$this->expectException(\LogicException::class);
1936+
$this->expectExceptionMessage("Cannot get all occurrences of an infinite recurrence rule.");
1937+
$rrule = new RRule(array(
1938+
'FREQ' => 'DAILY',
1939+
'DTSTART' => '2017-01-01'
1940+
));
1941+
$rrule->getOccurrencesAfter('2017-01-01');
1942+
}
1943+
19321944
public function occurrencesBefore()
19331945
{
19341946
return [
@@ -2730,31 +2742,31 @@ public function testDateTimeMutableReferenceBug()
27302742
$occurrence->modify('+1 day');
27312743
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with foreach (cached)');
27322744

2733-
// getOccurences
2745+
// getOccurrences
27342746
$occurrences = $rrule->getOccurrences();
27352747
$this->assertEquals(date_create('2007-01-01'), $occurrences[0]);
27362748
$occurrences[0]->modify('+1 day');
27372749
$this->assertEquals(date_create('2007-01-02'), $occurrences[0]);
2738-
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with getOccurences (uncached version)');
2750+
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with getOccurrences (uncached version)');
27392751

27402752
$occurrences = $rrule->getOccurrences();
27412753
$this->assertEquals(date_create('2007-01-01'), $occurrences[0]);
27422754
$occurrences[0]->modify('+1 day');
27432755
$this->assertEquals(date_create('2007-01-02'), $occurrences[0]);
2744-
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with getOccurences (cached version)');
2756+
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with getOccurrences (cached version)');
27452757

27462758
// getOccurrencesBetween
27472759
$occurrences = $rrule->getOccurrencesBetween(null, null);
27482760
$this->assertEquals(date_create('2007-01-01'), $occurrences[0]);
27492761
$occurrences[0]->modify('+1 day');
27502762
$this->assertEquals(date_create('2007-01-02'), $occurrences[0]);
2751-
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with getOccurences (uncached version)');
2763+
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with getOccurrences (uncached version)');
27522764

27532765
$occurrences = $rrule->getOccurrencesBetween(null, null);
27542766
$this->assertEquals(date_create('2007-01-01'), $occurrences[0]);
27552767
$occurrences[0]->modify('+1 day');
27562768
$this->assertEquals(date_create('2007-01-02'), $occurrences[0]);
2757-
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with getOccurences (cached version)');
2769+
$this->assertEquals(date_create('2007-01-01'), $rrule[0], 'No modification possible with getOccurrences (cached version)');
27582770
}
27592771

27602772
public function testGetRule()

0 commit comments

Comments
 (0)