@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param \Psr\Cache\CacheItemInterface $item |
63 | - * @return mixed |
|
63 | + * @return boolean |
|
64 | 64 | * @throws phpFastCacheInvalidArgumentException |
65 | 65 | */ |
66 | 66 | protected function driverWrite(CacheItemInterface $item) |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * @param string $optionName |
148 | 148 | * @param mixed $optionValue |
149 | - * @return bool |
|
149 | + * @return boolean|null |
|
150 | 150 | * @throws phpFastCacheInvalidArgumentException |
151 | 151 | */ |
152 | 152 | public static function isValidOption($optionName, $optionValue) |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
182 | - * @return array |
|
182 | + * @return string[] |
|
183 | 183 | */ |
184 | 184 | public static function getValidOptions() |
185 | 185 | { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | - * @return array |
|
190 | + * @return string[] |
|
191 | 191 | */ |
192 | 192 | public static function getRequiredOptions() |
193 | 193 | { |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | public function dispatch($eventName, ...$args) |
70 | 70 | { |
71 | 71 | $eventName = 'on' . ucfirst($eventName); |
72 | - if(array_key_exists($eventName, $this->events)){ |
|
73 | - foreach ($this->events[ $eventName ] as $event) { |
|
72 | + if (array_key_exists($eventName, $this->events)) { |
|
73 | + foreach ($this->events[$eventName] as $event) { |
|
74 | 74 | call_user_func_array($event, $args); |
75 | 75 | } |
76 | 76 | } |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function __call($name, $arguments) |
86 | 86 | { |
87 | - if(strpos($name, 'on') === 0){ |
|
88 | - if(is_callable($arguments[0])){ |
|
89 | - if(isset($arguments[1]) && is_string($arguments[0])){ |
|
87 | + if (strpos($name, 'on') === 0) { |
|
88 | + if (is_callable($arguments[0])) { |
|
89 | + if (isset($arguments[1]) && is_string($arguments[0])) { |
|
90 | 90 | $this->events[$name][$arguments[1]] = $arguments[0]; |
91 | - }else { |
|
91 | + } else { |
|
92 | 92 | $this->events[$name][] = $arguments[0]; |
93 | 93 | } |
94 | - }else{ |
|
94 | + } else { |
|
95 | 95 | throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0]))); |
96 | 96 | } |
97 | - }else{ |
|
97 | + } else { |
|
98 | 98 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
99 | 99 | } |
100 | 100 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function unbindEventCallback($eventName, $callbackName) |
108 | 108 | { |
109 | - if(isset($this->events[$eventName][$callbackName])){ |
|
109 | + if (isset($this->events[$eventName][$callbackName])) { |
|
110 | 110 | unset($this->events[$eventName][$callbackName]); |
111 | 111 | return true; |
112 | 112 | } |
@@ -88,13 +88,13 @@ |
||
88 | 88 | if(is_callable($arguments[0])){ |
89 | 89 | if(isset($arguments[1]) && is_string($arguments[0])){ |
90 | 90 | $this->events[$name][$arguments[1]] = $arguments[0]; |
91 | - }else { |
|
91 | + } else { |
|
92 | 92 | $this->events[$name][] = $arguments[0]; |
93 | 93 | } |
94 | - }else{ |
|
94 | + } else{ |
|
95 | 95 | throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0]))); |
96 | 96 | } |
97 | - }else{ |
|
97 | + } else{ |
|
98 | 98 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
99 | 99 | } |
100 | 100 | } |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function getCreationDate() |
83 | 83 | { |
84 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
84 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
85 | 85 | return $this->creationDate; |
86 | - }else{ |
|
86 | + } else { |
|
87 | 87 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
88 | 88 | } |
89 | 89 | } |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function setCreationDate(\DateTimeInterface $date) |
97 | 97 | { |
98 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
98 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
99 | 99 | $this->creationDate = $date; |
100 | 100 | return $this; |
101 | - }else{ |
|
101 | + } else { |
|
102 | 102 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
103 | 103 | } |
104 | 104 | } |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function getModificationDate() |
111 | 111 | { |
112 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
112 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
113 | 113 | return $this->modificationDate; |
114 | - }else{ |
|
114 | + } else { |
|
115 | 115 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
116 | 116 | } |
117 | 117 | } |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function setModificationDate(\DateTimeInterface $date) |
125 | 125 | { |
126 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
126 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
127 | 127 | $this->modificationDate = $date; |
128 | 128 | return $this; |
129 | - }else{ |
|
129 | + } else { |
|
130 | 130 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
131 | 131 | } |
132 | 132 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | public function removeTag($tagName) |
294 | 294 | { |
295 | 295 | if (($key = array_search($tagName, $this->tags)) !== false) { |
296 | - unset($this->tags[ $key ]); |
|
296 | + unset($this->tags[$key]); |
|
297 | 297 | $this->removedTags[] = $tagName; |
298 | 298 | } |
299 | 299 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | final public function __debugInfo() |
370 | 370 | { |
371 | 371 | $info = get_object_vars($this); |
372 | - $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')'; |
|
372 | + $info['driver'] = 'object(' . get_class($info['driver']) . ')'; |
|
373 | 373 | |
374 | 374 | return (array) $info; |
375 | 375 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | if($this->driver->getConfig()['itemDetailedDate']){ |
85 | 85 | return $this->creationDate; |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
88 | 88 | } |
89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if($this->driver->getConfig()['itemDetailedDate']){ |
99 | 99 | $this->creationDate = $date; |
100 | 100 | return $this; |
101 | - }else{ |
|
101 | + } else{ |
|
102 | 102 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
103 | 103 | } |
104 | 104 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | if($this->driver->getConfig()['itemDetailedDate']){ |
113 | 113 | return $this->modificationDate; |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
116 | 116 | } |
117 | 117 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if($this->driver->getConfig()['itemDetailedDate']){ |
127 | 127 | $this->modificationDate = $date; |
128 | 128 | return $this; |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
131 | 131 | } |
132 | 132 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $this->driver->setItem($this); |
44 | 44 | } else { |
45 | 45 | throw new phpFastCacheInvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', |
46 | - gettype($key))); |
|
46 | + gettype($key))); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @param \Psr\Cache\CacheItemInterface $item |
65 | - * @return mixed |
|
65 | + * @return boolean |
|
66 | 66 | * @throws phpFastCacheInvalidArgumentException |
67 | 67 | */ |
68 | 68 | protected function driverWrite(CacheItemInterface $item) |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | protected function driverRead(CacheItemInterface $item) |
81 | 81 | { |
82 | 82 | return [ |
83 | - self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
84 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | - self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
83 | + self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
84 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | + self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
86 | 86 | ]; |
87 | 87 | } |
88 | 88 | /** |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | { |
132 | 132 | $stat = new driverStatistic(); |
133 | 133 | $stat->setInfo('[Devfalse] A void info string') |
134 | - ->setSize(0) |
|
135 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
136 | - ->setRawData(false); |
|
134 | + ->setSize(0) |
|
135 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
136 | + ->setRawData(false); |
|
137 | 137 | |
138 | 138 | return $stat; |
139 | 139 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @param \Psr\Cache\CacheItemInterface $item |
65 | - * @return mixed |
|
65 | + * @return boolean |
|
66 | 66 | * @throws phpFastCacheInvalidArgumentException |
67 | 67 | */ |
68 | 68 | protected function driverWrite(CacheItemInterface $item) |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | protected function driverRead(CacheItemInterface $item) |
81 | 81 | { |
82 | 82 | return [ |
83 | - self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
84 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | - self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
83 | + self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
84 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | + self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
86 | 86 | ]; |
87 | 87 | } |
88 | 88 | |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | { |
133 | 133 | $stat = new driverStatistic(); |
134 | 134 | $stat->setInfo('[Devtrue] A void info string') |
135 | - ->setSize(0) |
|
136 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
137 | - ->setRawData(true); |
|
135 | + ->setSize(0) |
|
136 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
137 | + ->setRawData(true); |
|
138 | 138 | |
139 | 139 | return $stat; |
140 | 140 | } |