Skip to content

Commit 0055036

Browse files
committed
Merge pull request #36 from neeckeloo/feature/use-short-array-syntax
Use short array syntax
2 parents ba209e6 + 472b8a6 commit 0055036

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

Module.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66

77
namespace ZF\ApiProblem;
88

9+
use Zend\Loader\StandardAutoloader;
910
use Zend\Mvc\ResponseSender\SendResponseEvent;
1011
use Zend\Mvc\MvcEvent;
12+
use ZF\ApiProblem\Listener\SendApiProblemResponseListener;
1113

1214
/**
1315
* ZF2 module
@@ -21,11 +23,13 @@ class Module
2123
*/
2224
public function getAutoloaderConfig()
2325
{
24-
return array(
25-
'Zend\Loader\StandardAutoloader' => array('namespaces' => array(
26-
__NAMESPACE__ => __DIR__ . '/src/',
27-
))
28-
);
26+
return [
27+
StandardAutoloader::class => [
28+
'namespaces' => [
29+
__NAMESPACE__ => __DIR__ . '/src/',
30+
]
31+
]
32+
];
2933
}
3034

3135
/**
@@ -43,21 +47,21 @@ public function getConfig()
4347
*
4448
* Attaches a render event.
4549
*
46-
* @param \Zend\Mvc\MvcEvent $e
50+
* @param MvcEvent $e
4751
*/
48-
public function onBootstrap($e)
52+
public function onBootstrap(MvcEvent $e)
4953
{
5054
$app = $e->getTarget();
5155
$serviceManager = $app->getServiceManager();
5256
$eventManager = $app->getEventManager();
5357

5458
$eventManager->attach($serviceManager->get('ZF\ApiProblem\ApiProblemListener'));
55-
$eventManager->attach(MvcEvent::EVENT_RENDER, array($this, 'onRender'), 100);
59+
$eventManager->attach(MvcEvent::EVENT_RENDER, [$this, 'onRender'], 100);
5660

5761
$sendResponseListener = $serviceManager->get('SendResponseListener');
5862
$sendResponseListener->getEventManager()->attach(
5963
SendResponseEvent::EVENT_SEND_RESPONSE,
60-
$serviceManager->get('ZF\ApiProblem\Listener\SendApiProblemResponseListener'),
64+
$serviceManager->get(SendApiProblemResponseListener::class),
6165
-500
6266
);
6367
}
@@ -67,9 +71,9 @@ public function onBootstrap($e)
6771
*
6872
* Attaches a rendering/response strategy to the View.
6973
*
70-
* @param \Zend\Mvc\MvcEvent $e
74+
* @param MvcEvent $e
7175
*/
72-
public function onRender($e)
76+
public function onRender(MvcEvent $e)
7377
{
7478
$app = $e->getTarget();
7579
$services = $app->getServiceManager();

config/module.config.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@
44
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
55
*/
66

7-
return array(
8-
'service_manager' => array(
9-
'aliases' => array(
7+
return [
8+
'service_manager' => [
9+
'aliases' => [
1010
'ZF\ApiProblem\ApiProblemListener' => 'ZF\ApiProblem\Listener\ApiProblemListener',
1111
'ZF\ApiProblem\RenderErrorListener' => 'ZF\ApiProblem\Listener\RenderErrorListener',
1212
'ZF\ApiProblem\ApiProblemRenderer' => 'ZF\ApiProblem\View\ApiProblemRenderer',
1313
'ZF\ApiProblem\ApiProblemStrategy' => 'ZF\ApiProblem\View\ApiProblemStrategy',
14-
),
15-
'factories' => array(
14+
],
15+
'factories' => [
1616
'ZF\ApiProblem\Listener\ApiProblemListener' => 'ZF\ApiProblem\Factory\ApiProblemListenerFactory',
1717
'ZF\ApiProblem\Listener\RenderErrorListener' => 'ZF\ApiProblem\Factory\RenderErrorListenerFactory',
1818
'ZF\ApiProblem\Listener\SendApiProblemResponseListener' => 'ZF\ApiProblem\Factory\SendApiProblemResponseListenerFactory',
1919
'ZF\ApiProblem\View\ApiProblemRenderer' => 'ZF\ApiProblem\Factory\ApiProblemRendererFactory',
2020
'ZF\ApiProblem\View\ApiProblemStrategy' => 'ZF\ApiProblem\Factory\ApiProblemStrategyFactory',
21-
)
22-
),
21+
],
22+
],
2323

24-
'view_manager' => array(
24+
'view_manager' => [
2525
// Enable this in your application configuration in order to get full
2626
// exception stack traces in your API-Problem responses.
2727
'display_exceptions' => false,
28-
),
28+
],
2929

30-
'zf-api-problem' => array(
30+
'zf-api-problem' => [
3131
// Accept types that should allow ApiProblem responses
3232
// 'accept_filters' => $stringOrArray,
3333

3434
// Array of controller service names that should enable the ApiProblem render.error listener
35-
//'render_error_controllers' => array(),
36-
)
37-
);
35+
//'render_error_controllers' => [],
36+
],
37+
];

phpcs.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
</rule>
1717

1818
<!-- Paths to check -->
19+
<file>config</file>
1920
<file>src</file>
2021
<file>test</file>
22+
<file>Module.php</file>
2123
</ruleset>

0 commit comments

Comments
 (0)