@@ -106,67 +106,67 @@ use Solarium\Core\Event\Events;
106106// this very simple plugin shows a timing for each event and display some request debug info
107107class BasicDebug extends Solarium\Core\Plugin\AbstractPlugin
108108{
109- protected $start;
110- protected $output = array() ;
109+ protected float $start;
110+ protected array $output = [] ;
111111
112112 // This method is called when the plugin is registered with the client.
113113 protected function initPluginType(): void
114114 {
115115 $this->start = microtime(true);
116116
117117 $dispatcher = $this->client->getEventDispatcher();
118- $dispatcher->addListener(Events::PRE_CREATE_REQUEST, array( $this, 'preCreateRequest') );
119- $dispatcher->addListener(Events::POST_CREATE_REQUEST, array( $this, 'postCreateRequest') );
120- $dispatcher->addListener(Events::PRE_EXECUTE_REQUEST, array( $this, 'preExecuteRequest') );
121- $dispatcher->addListener(Events::POST_EXECUTE_REQUEST, array( $this, 'postExecuteRequest') );
122- $dispatcher->addListener(Events::PRE_CREATE_RESULT, array( $this, 'preCreateResult') );
123- $dispatcher->addListener(Events::POST_CREATE_RESULT, array( $this, 'postCreateResult') );
124- $dispatcher->addListener(Events::PRE_EXECUTE, array( $this, 'preExecute') );
125- $dispatcher->addListener(Events::POST_EXECUTE, array( $this, 'postExecute') );
126- $dispatcher->addListener(Events::PRE_CREATE_QUERY, array( $this, 'preCreateQuery') );
127- $dispatcher->addListener(Events::POST_CREATE_QUERY, array( $this, 'postCreateQuery') );
118+ $dispatcher->addListener(Events::PRE_CREATE_REQUEST, [ $this, 'preCreateRequest'] );
119+ $dispatcher->addListener(Events::POST_CREATE_REQUEST, [ $this, 'postCreateRequest'] );
120+ $dispatcher->addListener(Events::PRE_EXECUTE_REQUEST, [ $this, 'preExecuteRequest'] );
121+ $dispatcher->addListener(Events::POST_EXECUTE_REQUEST, [ $this, 'postExecuteRequest'] );
122+ $dispatcher->addListener(Events::PRE_CREATE_RESULT, [ $this, 'preCreateResult'] );
123+ $dispatcher->addListener(Events::POST_CREATE_RESULT, [ $this, 'postCreateResult'] );
124+ $dispatcher->addListener(Events::PRE_EXECUTE, [ $this, 'preExecute'] );
125+ $dispatcher->addListener(Events::POST_EXECUTE, [ $this, 'postExecute'] );
126+ $dispatcher->addListener(Events::PRE_CREATE_QUERY, [ $this, 'preCreateQuery'] );
127+ $dispatcher->addListener(Events::POST_CREATE_QUERY, [ $this, 'postCreateQuery'] );
128128 }
129129
130130 // This method is called if the plugin is removed from the client.
131131 public function deinitPlugin(): void
132132 {
133133 $dispatcher = $this->client->getEventDispatcher();
134- $dispatcher->removeListener(Events::PRE_CREATE_REQUEST, array( $this, 'preCreateRequest') );
135- $dispatcher->removeListener(Events::POST_CREATE_REQUEST, array( $this, 'postCreateRequest') );
136- $dispatcher->removeListener(Events::PRE_EXECUTE_REQUEST, array( $this, 'preExecuteRequest') );
137- $dispatcher->removeListener(Events::POST_EXECUTE_REQUEST, array( $this, 'postExecuteRequest') );
138- $dispatcher->removeListener(Events::PRE_CREATE_RESULT, array( $this, 'preCreateResult') );
139- $dispatcher->removeListener(Events::POST_CREATE_RESULT, array( $this, 'postCreateResult') );
140- $dispatcher->removeListener(Events::PRE_EXECUTE, array( $this, 'preExecute') );
141- $dispatcher->removeListener(Events::POST_EXECUTE, array( $this, 'postExecute') );
142- $dispatcher->removeListener(Events::PRE_CREATE_QUERY, array( $this, 'preCreateQuery') );
143- $dispatcher->removeListener(Events::POST_CREATE_QUERY, array( $this, 'postCreateQuery') );
134+ $dispatcher->removeListener(Events::PRE_CREATE_REQUEST, [ $this, 'preCreateRequest'] );
135+ $dispatcher->removeListener(Events::POST_CREATE_REQUEST, [ $this, 'postCreateRequest'] );
136+ $dispatcher->removeListener(Events::PRE_EXECUTE_REQUEST, [ $this, 'preExecuteRequest'] );
137+ $dispatcher->removeListener(Events::POST_EXECUTE_REQUEST, [ $this, 'postExecuteRequest'] );
138+ $dispatcher->removeListener(Events::PRE_CREATE_RESULT, [ $this, 'preCreateResult'] );
139+ $dispatcher->removeListener(Events::POST_CREATE_RESULT, [ $this, 'postCreateResult'] );
140+ $dispatcher->removeListener(Events::PRE_EXECUTE, [ $this, 'preExecute'] );
141+ $dispatcher->removeListener(Events::POST_EXECUTE, [ $this, 'postExecute'] );
142+ $dispatcher->removeListener(Events::PRE_CREATE_QUERY, [ $this, 'preCreateQuery'] );
143+ $dispatcher->removeListener(Events::POST_CREATE_QUERY, [ $this, 'postCreateQuery'] );
144144 }
145145
146- protected function timer($event)
146+ protected function timer($event): void
147147 {
148148 $time = round(microtime(true) - $this->start, 5);
149149 $this->output[] = '['.$time.'] ' . $event;
150150 }
151151
152- public function display()
152+ public function display(): void
153153 {
154154 echo implode('<br />', $this->output);
155155 }
156156
157- public function preCreateRequest()
157+ public function preCreateRequest(): void
158158 {
159159 $this->timer('preCreateRequest');
160160 }
161161
162- public function postCreateRequest()
162+ public function postCreateRequest(): void
163163 {
164164 $this->timer('postCreateRequest');
165165 }
166166
167167 // This method uses the available param(s) (see plugin abstract class).
168168 // You can access or modify data this way.
169- public function preExecuteRequest($event)
169+ public function preExecuteRequest($event): void
170170 {
171171 $this->timer('preExecuteRequest');
172172
@@ -176,37 +176,37 @@ class BasicDebug extends Solarium\Core\Plugin\AbstractPlugin
176176 $this->output[] = 'Request URI: ' . $event->getRequest()->getUri();
177177 }
178178
179- public function postExecuteRequest()
179+ public function postExecuteRequest(): void
180180 {
181181 $this->timer('postExecuteRequest');
182182 }
183183
184- public function preCreateResult()
184+ public function preCreateResult(): void
185185 {
186186 $this->timer('preCreateResult');
187187 }
188188
189- public function postCreateResult()
189+ public function postCreateResult(): void
190190 {
191191 $this->timer('postCreateResult');
192192 }
193193
194- public function preExecute()
194+ public function preExecute(): void
195195 {
196196 $this->timer('preExecute');
197197 }
198198
199- public function postExecute()
199+ public function postExecute(): void
200200 {
201201 $this->timer('postExecute');
202202 }
203203
204- public function preCreateQuery()
204+ public function preCreateQuery(): void
205205 {
206206 $this->timer('preCreateResult');
207207 }
208208
209- public function postCreateQuery()
209+ public function postCreateQuery(): void
210210 {
211211 $this->timer('postCreateResult');
212212 }
@@ -266,7 +266,7 @@ class MyQuery extends Select
266266// this very simple plugin that modifies the default querytype mapping
267267class QueryCustomizer extends AbstractPlugin
268268{
269- public function initPlugin($client, $options)
269+ public function initPlugin($client, $options): void
270270 {
271271 $client->registerQueryType(
272272 Client::QUERY_SELECT,
0 commit comments