Passed
Push — addMultipleObservanceShifts ( 065e25...90c241 )
by Andreas
02:45 queued 54s
created
src/GregorianWeekday.php 2 patches
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -20,130 +20,130 @@
 block discarded – undo
20 20
 
21 21
 final class GregorianWeekday
22 22
 {
23
-	/** @var string */
24
-	private $value;
23
+    /** @var string */
24
+    private $value;
25 25
 
26
-	/** @var array<string> */
27
-	private static $instances = [];
26
+    /** @var array<string> */
27
+    private static $instances = [];
28 28
 
29
-	private const MONDAY = 'monday';
30
-	private const TUESDAY = 'tuesday';
31
-	private const WEDNESDAY = 'wednesday';
32
-	private const THURSDAY = 'thursday';
33
-	private const FRIDAY = 'friday';
34
-	private const SATURDAY = 'saturday';
35
-	private const SUNDAY = 'sunday';
29
+    private const MONDAY = 'monday';
30
+    private const TUESDAY = 'tuesday';
31
+    private const WEDNESDAY = 'wednesday';
32
+    private const THURSDAY = 'thursday';
33
+    private const FRIDAY = 'friday';
34
+    private const SATURDAY = 'saturday';
35
+    private const SUNDAY = 'sunday';
36 36
 
37
-	private function __construct(string $value)
37
+    private function __construct(string $value)
38 38
     {
39
-		$this->value = $value;
40
-	}
41
-
42
-	public function getValue(): string
43
-	{
44
-		return $this->value;
45
-	}
46
-
47
-	public static function monday(): self
48
-	{
49
-		if (! isset(self::$instances[self::MONDAY])) {
50
-			self::$instances[self::MONDAY] = new self(self::MONDAY);
51
-		}
52
-
53
-		return self::$instances[self::MONDAY];
54
-	}
55
-
56
-	public static function tuesday(): self
57
-	{
58
-		if (! isset(self::$instances[self::TUESDAY])) {
59
-			self::$instances[self::TUESDAY] = new self(self::TUESDAY);
60
-		}
61
-
62
-		return self::$instances[self::TUESDAY];
63
-	}
64
-
65
-	public static function wednesday(): self
66
-	{
67
-		if (! isset(self::$instances[self::WEDNESDAY])) {
68
-			self::$instances[self::WEDNESDAY] = new self(self::WEDNESDAY);
69
-		}
70
-
71
-		return self::$instances[self::WEDNESDAY];
72
-	}
73
-
74
-	public static function thursday(): self
75
-	{
76
-		if (! isset(self::$instances[self::THURSDAY])) {
77
-			self::$instances[self::THURSDAY] = new self(self::THURSDAY);
78
-		}
79
-
80
-		return self::$instances[self::THURSDAY];
81
-	}
82
-
83
-	public static function friday(): self
84
-	{
85
-		if (! isset(self::$instances[self::FRIDAY])) {
86
-			self::$instances[self::FRIDAY] = new self(self::FRIDAY);
87
-		}
88
-
89
-		return self::$instances[self::FRIDAY];
90
-	}
91
-
92
-	public static function saturday(): self
93
-	{
94
-		if (! isset(self::$instances[self::SATURDAY])) {
95
-			self::$instances[self::SATURDAY] = new self(self::SATURDAY);
96
-		}
97
-
98
-		return self::$instances[self::SATURDAY];
99
-	}
100
-
101
-	public static function sunday(): self
102
-	{
103
-		if (! isset(self::$instances[self::SUNDAY])) {
104
-			self::$instances[self::SUNDAY] = new self(self::SUNDAY);
105
-		}
106
-
107
-		return self::$instances[self::SUNDAY];
108
-	}
109
-
110
-	public static function fromString(string $weekday): self
111
-	{
112
-		if (! method_exists(self::class, strtolower($weekday))) {
113
-			throw new RuntimeException('Weekday not found');
114
-		}
115
-
116
-		return [self::class, strtolower($weekday)]();
117
-	}
118
-
119
-	public static function fromDateTimeInterface(DateTimeInterface $date): self
120
-	{
121
-		return self::fromString($date->format('l'));
122
-	}
123
-
124
-	public static function fromIntlWeekday(int $weekday): self
125
-	{
126
-		$mapper = [
127
-			IntlCalendar::DOW_SUNDAY    => 'sunday',
128
-			IntlCalendar::DOW_MONDAY    => 'monday',
129
-			IntlCalendar::DOW_TUESDAY   => 'tuesday',
130
-			IntlCalendar::DOW_WEDNESDAY => 'wednesday',
131
-			IntlCalendar::DOW_THURSDAY  => 'thursday',
132
-			IntlCalendar::DOW_FRIDAY    => 'friday',
133
-			IntlCalendar::DOW_SATURDAY  => 'saturday',
134
-		];
135
-		if (! isset($mapper[$weekday])) {
136
-			throw new UnexpectedValueException(sprintf(
137
-				'IntlCalendar weekday %s could not be resolved',
138
-				$weekday
139
-			));
140
-		}
141
-
142
-		return self::fromString($mapper[$weekday]);
143
-	}
144
-
145
-	public function __toString(): string
146
-	{
147
-		return $this->getValue();
148
-	}
39
+        $this->value = $value;
40
+    }
41
+
42
+    public function getValue(): string
43
+    {
44
+        return $this->value;
45
+    }
46
+
47
+    public static function monday(): self
48
+    {
49
+        if (! isset(self::$instances[self::MONDAY])) {
50
+            self::$instances[self::MONDAY] = new self(self::MONDAY);
51
+        }
52
+
53
+        return self::$instances[self::MONDAY];
54
+    }
55
+
56
+    public static function tuesday(): self
57
+    {
58
+        if (! isset(self::$instances[self::TUESDAY])) {
59
+            self::$instances[self::TUESDAY] = new self(self::TUESDAY);
60
+        }
61
+
62
+        return self::$instances[self::TUESDAY];
63
+    }
64
+
65
+    public static function wednesday(): self
66
+    {
67
+        if (! isset(self::$instances[self::WEDNESDAY])) {
68
+            self::$instances[self::WEDNESDAY] = new self(self::WEDNESDAY);
69
+        }
70
+
71
+        return self::$instances[self::WEDNESDAY];
72
+    }
73
+
74
+    public static function thursday(): self
75
+    {
76
+        if (! isset(self::$instances[self::THURSDAY])) {
77
+            self::$instances[self::THURSDAY] = new self(self::THURSDAY);
78
+        }
79
+
80
+        return self::$instances[self::THURSDAY];
81
+    }
82
+
83
+    public static function friday(): self
84
+    {
85
+        if (! isset(self::$instances[self::FRIDAY])) {
86
+            self::$instances[self::FRIDAY] = new self(self::FRIDAY);
87
+        }
88
+
89
+        return self::$instances[self::FRIDAY];
90
+    }
91
+
92
+    public static function saturday(): self
93
+    {
94
+        if (! isset(self::$instances[self::SATURDAY])) {
95
+            self::$instances[self::SATURDAY] = new self(self::SATURDAY);
96
+        }
97
+
98
+        return self::$instances[self::SATURDAY];
99
+    }
100
+
101
+    public static function sunday(): self
102
+    {
103
+        if (! isset(self::$instances[self::SUNDAY])) {
104
+            self::$instances[self::SUNDAY] = new self(self::SUNDAY);
105
+        }
106
+
107
+        return self::$instances[self::SUNDAY];
108
+    }
109
+
110
+    public static function fromString(string $weekday): self
111
+    {
112
+        if (! method_exists(self::class, strtolower($weekday))) {
113
+            throw new RuntimeException('Weekday not found');
114
+        }
115
+
116
+        return [self::class, strtolower($weekday)]();
117
+    }
118
+
119
+    public static function fromDateTimeInterface(DateTimeInterface $date): self
120
+    {
121
+        return self::fromString($date->format('l'));
122
+    }
123
+
124
+    public static function fromIntlWeekday(int $weekday): self
125
+    {
126
+        $mapper = [
127
+            IntlCalendar::DOW_SUNDAY    => 'sunday',
128
+            IntlCalendar::DOW_MONDAY    => 'monday',
129
+            IntlCalendar::DOW_TUESDAY   => 'tuesday',
130
+            IntlCalendar::DOW_WEDNESDAY => 'wednesday',
131
+            IntlCalendar::DOW_THURSDAY  => 'thursday',
132
+            IntlCalendar::DOW_FRIDAY    => 'friday',
133
+            IntlCalendar::DOW_SATURDAY  => 'saturday',
134
+        ];
135
+        if (! isset($mapper[$weekday])) {
136
+            throw new UnexpectedValueException(sprintf(
137
+                'IntlCalendar weekday %s could not be resolved',
138
+                $weekday
139
+            ));
140
+        }
141
+
142
+        return self::fromString($mapper[$weekday]);
143
+    }
144
+
145
+    public function __toString(): string
146
+    {
147
+        return $this->getValue();
148
+    }
149 149
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 	public static function monday(): self
48 48
 	{
49
-		if (! isset(self::$instances[self::MONDAY])) {
49
+		if (!isset(self::$instances[self::MONDAY])) {
50 50
 			self::$instances[self::MONDAY] = new self(self::MONDAY);
51 51
 		}
52 52
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 	public static function tuesday(): self
57 57
 	{
58
-		if (! isset(self::$instances[self::TUESDAY])) {
58
+		if (!isset(self::$instances[self::TUESDAY])) {
59 59
 			self::$instances[self::TUESDAY] = new self(self::TUESDAY);
60 60
 		}
61 61
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 	public static function wednesday(): self
66 66
 	{
67
-		if (! isset(self::$instances[self::WEDNESDAY])) {
67
+		if (!isset(self::$instances[self::WEDNESDAY])) {
68 68
 			self::$instances[self::WEDNESDAY] = new self(self::WEDNESDAY);
69 69
 		}
70 70
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 	public static function thursday(): self
75 75
 	{
76
-		if (! isset(self::$instances[self::THURSDAY])) {
76
+		if (!isset(self::$instances[self::THURSDAY])) {
77 77
 			self::$instances[self::THURSDAY] = new self(self::THURSDAY);
78 78
 		}
79 79
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 	public static function friday(): self
84 84
 	{
85
-		if (! isset(self::$instances[self::FRIDAY])) {
85
+		if (!isset(self::$instances[self::FRIDAY])) {
86 86
 			self::$instances[self::FRIDAY] = new self(self::FRIDAY);
87 87
 		}
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	public static function saturday(): self
93 93
 	{
94
-		if (! isset(self::$instances[self::SATURDAY])) {
94
+		if (!isset(self::$instances[self::SATURDAY])) {
95 95
 			self::$instances[self::SATURDAY] = new self(self::SATURDAY);
96 96
 		}
97 97
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 	public static function sunday(): self
102 102
 	{
103
-		if (! isset(self::$instances[self::SUNDAY])) {
103
+		if (!isset(self::$instances[self::SUNDAY])) {
104 104
 			self::$instances[self::SUNDAY] = new self(self::SUNDAY);
105 105
 		}
106 106
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 	public static function fromString(string $weekday): self
111 111
 	{
112
-		if (! method_exists(self::class, strtolower($weekday))) {
112
+		if (!method_exists(self::class, strtolower($weekday))) {
113 113
 			throw new RuntimeException('Weekday not found');
114 114
 		}
115 115
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			IntlCalendar::DOW_FRIDAY    => 'friday',
133 133
 			IntlCalendar::DOW_SATURDAY  => 'saturday',
134 134
 		];
135
-		if (! isset($mapper[$weekday])) {
135
+		if (!isset($mapper[$weekday])) {
136 136
 			throw new UnexpectedValueException(sprintf(
137 137
 				'IntlCalendar weekday %s could not be resolved',
138 138
 				$weekday
Please login to merge, or discard this patch.
src/SwapDirection.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -12,52 +12,52 @@
 block discarded – undo
12 12
 
13 13
 final class SwapDirection
14 14
 {
15
-	/** @var string */
16
-	private $value;
15
+    /** @var string */
16
+    private $value;
17 17
 
18
-	/** @var array<string> */
19
-	private static $instances = [];
18
+    /** @var array<string> */
19
+    private static $instances = [];
20 20
 
21
-	private const FORWARD = 'forward';
22
-	private const REWIND = 'rewind';
21
+    private const FORWARD = 'forward';
22
+    private const REWIND = 'rewind';
23 23
 
24
-	private function __construct(string $value)
24
+    private function __construct(string $value)
25 25
     {
26
-		$this->value = $value;
27
-	}
28
-
29
-	public function getValue(): string
30
-	{
31
-		return $this->value;
32
-	}
33
-
34
-	public function getDateTimeDirection(): string
35
-	{
36
-		switch ($this->value) {
37
-			case self::REWIND:
38
-				return 'previous';
39
-			case self::FORWARD:
40
-				return 'next';
41
-			default:
42
-				return '';
43
-		}
44
-	}
45
-
46
-	public static function forward(): self
47
-	{
48
-		if (! isset(self::$instances[self::FORWARD])) {
49
-			self::$instances[self::FORWARD] = new self(self::FORWARD);
50
-		}
51
-
52
-		return self::$instances[self::FORWARD];
53
-	}
54
-
55
-	public static function rewind(): self
56
-	{
57
-		if (! isset(self::$instances[self::REWIND])) {
58
-			self::$instances[self::REWIND] = new self(self::REWIND);
59
-		}
60
-
61
-		return self::$instances[self::REWIND];
62
-	}
26
+        $this->value = $value;
27
+    }
28
+
29
+    public function getValue(): string
30
+    {
31
+        return $this->value;
32
+    }
33
+
34
+    public function getDateTimeDirection(): string
35
+    {
36
+        switch ($this->value) {
37
+            case self::REWIND:
38
+                return 'previous';
39
+            case self::FORWARD:
40
+                return 'next';
41
+            default:
42
+                return '';
43
+        }
44
+    }
45
+
46
+    public static function forward(): self
47
+    {
48
+        if (! isset(self::$instances[self::FORWARD])) {
49
+            self::$instances[self::FORWARD] = new self(self::FORWARD);
50
+        }
51
+
52
+        return self::$instances[self::FORWARD];
53
+    }
54
+
55
+    public static function rewind(): self
56
+    {
57
+        if (! isset(self::$instances[self::REWIND])) {
58
+            self::$instances[self::REWIND] = new self(self::REWIND);
59
+        }
60
+
61
+        return self::$instances[self::REWIND];
62
+    }
63 63
 }
Please login to merge, or discard this patch.
src/Factory/SwapDecoratorFactory.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -22,48 +22,48 @@
 block discarded – undo
22 22
 
23 23
 final class SwapDecoratorFactory implements DecorateFromDomElement
24 24
 {
25
-	public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface
26
-	{
27
-		$rules = [];
25
+    public function decorate(HolidayIteratorItemInterface $element, DOMElement $domElement): HolidayIteratorItemInterface
26
+    {
27
+        $rules = [];
28 28
 
29
-		if ($domElement->hasAttribute('forwardto') && $domElement->hasAttribute('forwardwhen')) {
30
-			$rules[] = $this->createRuleFrom($domElement->getAttribute('forwardto'), $domElement->getAttribute('forwardwhen'), SwapDirection::forward());
31
-		}
32
-		if ($domElement->hasAttribute('alternateforwardto') && $domElement->hasAttribute('alternateforwardwhen')) {
33
-			$rules[] = $this->createRuleFrom($domElement->getAttribute('alternateforwardto'), $domElement->getAttribute('alternateforwardwhen'), SwapDirection::forward());
34
-		}
35
-		if ($domElement->hasAttribute('rewindto') && $domElement->hasAttribute('rewindwhen')) {
36
-			$rules[] = $this->createRuleFrom($domElement->getAttribute('rewindto'), $domElement->getAttribute('rewindwhen'), SwapDirection::rewind());
37
-		}
38
-		if ($domElement->hasAttribute('alternaterewindto') && $domElement->hasAttribute('alternaterewindwhen')) {
39
-			$rules[] = $this->createRuleFrom($domElement->getAttribute('alternaterewindto'), $domElement->getAttribute('alternaterewindwhen'), SwapDirection::rewind());
40
-		}
29
+        if ($domElement->hasAttribute('forwardto') && $domElement->hasAttribute('forwardwhen')) {
30
+            $rules[] = $this->createRuleFrom($domElement->getAttribute('forwardto'), $domElement->getAttribute('forwardwhen'), SwapDirection::forward());
31
+        }
32
+        if ($domElement->hasAttribute('alternateforwardto') && $domElement->hasAttribute('alternateforwardwhen')) {
33
+            $rules[] = $this->createRuleFrom($domElement->getAttribute('alternateforwardto'), $domElement->getAttribute('alternateforwardwhen'), SwapDirection::forward());
34
+        }
35
+        if ($domElement->hasAttribute('rewindto') && $domElement->hasAttribute('rewindwhen')) {
36
+            $rules[] = $this->createRuleFrom($domElement->getAttribute('rewindto'), $domElement->getAttribute('rewindwhen'), SwapDirection::rewind());
37
+        }
38
+        if ($domElement->hasAttribute('alternaterewindto') && $domElement->hasAttribute('alternaterewindwhen')) {
39
+            $rules[] = $this->createRuleFrom($domElement->getAttribute('alternaterewindto'), $domElement->getAttribute('alternaterewindwhen'), SwapDirection::rewind());
40
+        }
41 41
 
42
-		if ($rules === []) {
43
-			return $element;
44
-		}
42
+        if ($rules === []) {
43
+            return $element;
44
+        }
45 45
 
46
-		$day = CalendarDayFactory::createCalendarDay(
47
-			(int) $domElement->getAttribute('day'),
48
-			(int) $domElement->getAttribute('month'),
49
-			($domElement->hasAttribute('calendar') ? $domElement->getAttribute('calendar') : 'gregorian')
50
-		);
46
+        $day = CalendarDayFactory::createCalendarDay(
47
+            (int) $domElement->getAttribute('day'),
48
+            (int) $domElement->getAttribute('month'),
49
+            ($domElement->hasAttribute('calendar') ? $domElement->getAttribute('calendar') : 'gregorian')
50
+        );
51 51
 
52
-		if ($domElement->hasAttribute('year')) {
53
-			$day->setYear((int) $domElement->getAttribute('year'));
54
-		}
52
+        if ($domElement->hasAttribute('year')) {
53
+            $day->setYear((int) $domElement->getAttribute('year'));
54
+        }
55 55
 
56
-		return new SwapDecorator($element, $day, ...$rules);
57
-	}
56
+        return new SwapDecorator($element, $day, ...$rules);
57
+    }
58 58
 
59
-	private function createRuleFrom(string $to, string $when, SwapDirection $direction): SwapRule
60
-	{
61
-		return new SwapRule(
62
-			$direction,
63
-			GregorianWeekday::fromString($to),
64
-			...array_map(function ($item) {
65
-				return GregorianWeekday::fromString($item);
66
-			}, explode(' ', $when))
67
-		);
68
-	}
59
+    private function createRuleFrom(string $to, string $when, SwapDirection $direction): SwapRule
60
+    {
61
+        return new SwapRule(
62
+            $direction,
63
+            GregorianWeekday::fromString($to),
64
+            ...array_map(function ($item) {
65
+                return GregorianWeekday::fromString($item);
66
+            }, explode(' ', $when))
67
+        );
68
+    }
69 69
 }
Please login to merge, or discard this patch.
src/IteratorItem/SwapDecorator.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -21,59 +21,59 @@
 block discarded – undo
21 21
 
22 22
 class SwapDecorator implements HolidayIteratorItemInterface
23 23
 {
24
-	public function __construct(HolidayIteratorItemInterface $rule, CalendarDay $day, SwapRule ...$swapRules)
25
-	{
26
-		$this->rule = $rule;
27
-		$this->day = $day;
28
-		$this->swapRules = $swapRules;
29
-	}
24
+    public function __construct(HolidayIteratorItemInterface $rule, CalendarDay $day, SwapRule ...$swapRules)
25
+    {
26
+        $this->rule = $rule;
27
+        $this->day = $day;
28
+        $this->swapRules = $swapRules;
29
+    }
30 30
 
31
-	public function dateMatches(DateTimeInterface $date): bool
32
-	{
33
-		$year = (int) $date->format('Y');
34
-		$weekday = GregorianWeekday::fromIntlWeekday($this->day->getWeekdayForGregorianYear($year));
35
-		foreach ($this->swapRules as $rule) {
36
-			if ($this->ruleMatches($rule, $weekday)) {
37
-				return $this->isModifiedDate($date, $rule->getSwapToDay(), $rule->getDirection());
38
-			}
39
-		}
31
+    public function dateMatches(DateTimeInterface $date): bool
32
+    {
33
+        $year = (int) $date->format('Y');
34
+        $weekday = GregorianWeekday::fromIntlWeekday($this->day->getWeekdayForGregorianYear($year));
35
+        foreach ($this->swapRules as $rule) {
36
+            if ($this->ruleMatches($rule, $weekday)) {
37
+                return $this->isModifiedDate($date, $rule->getSwapToDay(), $rule->getDirection());
38
+            }
39
+        }
40 40
 
41
-		return $this->rule->dateMatches($date);
42
-	}
41
+        return $this->rule->dateMatches($date);
42
+    }
43 43
 
44
-	public function getName(): string
45
-	{
46
-		return $this->rule->getName();
47
-	}
44
+    public function getName(): string
45
+    {
46
+        return $this->rule->getName();
47
+    }
48 48
 
49
-	public function isHoliday(): bool
50
-	{
51
-		return $this->rule->isHoliday();
52
-	}
49
+    public function isHoliday(): bool
50
+    {
51
+        return $this->rule->isHoliday();
52
+    }
53 53
 
54
-	private function ruleMatches(SwapRule $rule, GregorianWeekday $weekday): bool
55
-	{
56
-		return in_array($weekday, $rule->getSwapWhenDays(), true);
57
-	}
54
+    private function ruleMatches(SwapRule $rule, GregorianWeekday $weekday): bool
55
+    {
56
+        return in_array($weekday, $rule->getSwapWhenDays(), true);
57
+    }
58 58
 
59
-	private function isModifiedDate(DateTimeInterface $dateTime, GregorianWeekday $modifiedDay, SwapDirection $direction): bool
60
-	{
61
-		$cal = $this->day->getCalendar();
62
-		$cal = CalendarDay::setGregorianYearForDate((int) $dateTime->format('Y'), $cal);
63
-		$day = $cal->toDateTime();
64
-		$day->modify($direction->getDateTimeDirection() . ' ' . $modifiedDay);
65
-		$cal->setTime($day->getTimestamp() * 1000);
66
-		$cal2 = $this->day->getCalendar();
67
-		$cal2->setTime($dateTime->getTimestamp() * 1000);
59
+    private function isModifiedDate(DateTimeInterface $dateTime, GregorianWeekday $modifiedDay, SwapDirection $direction): bool
60
+    {
61
+        $cal = $this->day->getCalendar();
62
+        $cal = CalendarDay::setGregorianYearForDate((int) $dateTime->format('Y'), $cal);
63
+        $day = $cal->toDateTime();
64
+        $day->modify($direction->getDateTimeDirection() . ' ' . $modifiedDay);
65
+        $cal->setTime($day->getTimestamp() * 1000);
66
+        $cal2 = $this->day->getCalendar();
67
+        $cal2->setTime($dateTime->getTimestamp() * 1000);
68 68
 
69
-		if ($this->day->hasYearSet() && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) {
70
-			return false;
71
-		}
69
+        if ($this->day->hasYearSet() && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) {
70
+            return false;
71
+        }
72 72
 
73
-		if ($cal->get(IntlCalendar::FIELD_MONTH) !== $cal2->get(IntlCalendar::FIELD_MONTH)) {
74
-			return false;
75
-		}
73
+        if ($cal->get(IntlCalendar::FIELD_MONTH) !== $cal2->get(IntlCalendar::FIELD_MONTH)) {
74
+            return false;
75
+        }
76 76
 
77
-		return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $cal2->get(IntlCalendar::FIELD_DAY_OF_MONTH);
78
-	}
77
+        return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $cal2->get(IntlCalendar::FIELD_DAY_OF_MONTH);
78
+    }
79 79
 }
Please login to merge, or discard this patch.