Completed
Push — master ( f59019...093bae )
by Guillaume
04:06
created
src/Breaker.php 1 patch
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param string                   $name
67 67
      * @param array                    $config
68 68
      * @param Cache                    $store
69
-     * @param Handler                  $handler
69
+     * @param HandlerInterface                  $handler
70 70
      * @param EventDispatcherInterface $dispatcher
71 71
      */
72 72
     public function __construct(
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      * addListener.
144 144
      *
145 145
      * @param string         $eventName
146
-     * @param \Closure|array $listener
146
+     * @param \Closure $listener
147 147
      */
148 148
     public function addListener($eventName, $listener)
149 149
     {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      *
156 156
      * @param Circuit $circuit
157 157
      *
158
-     * @return bool
158
+     * @return boolean|null
159 159
      */
160 160
     protected function isClosed($circuit)
161 161
     {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      *
174 174
      * @param Circuit $circuit
175 175
      *
176
-     * @return bool
176
+     * @return boolean|null
177 177
      */
178 178
     protected function isOpen($circuit)
179 179
     {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      *
192 192
      * @param Circuit $circuit
193 193
      *
194
-     * @return bool
194
+     * @return boolean|null
195 195
      */
196 196
     protected function isHalfOpen($circuit)
197 197
     {
Please login to merge, or discard this patch.
tests/BreakerTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function testMultiProcess()
28 28
     {
29
-        $fileCache  = new FilesystemCache($this->dir, 'txt');
29
+        $fileCache = new FilesystemCache($this->dir, 'txt');
30 30
         $breaker = new Breaker('github_api', ['ignore_exceptions' => true], $fileCache);
31 31
         $breaker2 = new Breaker('github_api', ['ignore_exceptions' => true], $fileCache);
32 32
 
33 33
         $breaker1FailureCount = 0;
34 34
 
35
-        $breaker->addListener(CircuitEvents::FAILURE, function (Event $event) use (&$breaker1FailureCount) {
35
+        $breaker->addListener(CircuitEvents::FAILURE, function(Event $event) use (&$breaker1FailureCount) {
36 36
             $breaker1FailureCount = $event->getCircuit()->getFailures();
37 37
         });
38 38
 
39
-        $breaker2->addListener(CircuitEvents::FAILURE, function (Event $event) use (&$breaker1FailureCount) {
39
+        $breaker2->addListener(CircuitEvents::FAILURE, function(Event $event) use (&$breaker1FailureCount) {
40 40
             $this->assertEquals($breaker1FailureCount, $event->getCircuit()->getFailures());
41 41
         });
42 42
 
43
-        $fn = function () {
43
+        $fn = function() {
44 44
             throw new CustomException("An error as occured");
45 45
         };
46 46
 
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
             ['exclude_exceptions' => [CustomException::class]]
61 61
         );
62 62
 
63
-        $breaker->addListener(CircuitEvents::OPEN, function (Event $event) {
63
+        $breaker->addListener(CircuitEvents::OPEN, function(Event $event) {
64 64
             $this->assertInstanceOf(Circuit::class, $event->getCircuit());
65 65
         });
66 66
 
67 67
         $this->setExpectedException('Eljam\CircuitBreaker\Exception\CircuitOpenException');
68 68
 
69
-        $fn = function () {
69
+        $fn = function() {
70 70
             throw new CustomException("An error as occured");
71 71
         };
72 72
 
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
             ]
89 89
         );
90 90
 
91
-        $breaker->addListener(CircuitEvents::HALF_OPEN, function (Event $event) {
91
+        $breaker->addListener(CircuitEvents::HALF_OPEN, function(Event $event) {
92 92
             $this->assertInstanceOf(Circuit::class, $event->getCircuit());
93 93
         });
94 94
 
95
-        $fn = function () {
95
+        $fn = function() {
96 96
             throw new CustomException("An error as occured");
97 97
         };
98 98
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
         sleep(2);
108 108
 
109
-        $fnPass = function () {
109
+        $fnPass = function() {
110 110
             return 'ok';
111 111
         };
112 112
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $breaker = new Breaker('simple_echo');
122 122
         $hello = 'eljam';
123 123
 
124
-        $fn = function () use ($hello) {
124
+        $fn = function() use ($hello) {
125 125
             return $hello;
126 126
         };
127 127
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         );
142 142
         $hello = 'eljam';
143 143
 
144
-        $fn = function () use ($hello) {
144
+        $fn = function() use ($hello) {
145 145
             throw new CustomException("An error as occured");
146 146
 
147 147
             return $hello;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
         $this->setExpectedException('Eljam\CircuitBreaker\Exception\CustomException');
166 166
 
167
-        $fn = function () use ($hello) {
167
+        $fn = function() use ($hello) {
168 168
             throw new CustomException("An error as occured");
169 169
 
170 170
             return $hello;
Please login to merge, or discard this patch.