@@ -36,7 +36,7 @@ class ConcreteToken extends AbstractToken
3636{
3737 private $ credentials = 'credentials_value ' ;
3838
39- public function __construct ($ user , array $ roles = array () )
39+ public function __construct ($ user , array $ roles = [] )
4040 {
4141 parent ::__construct ($ roles );
4242
@@ -45,7 +45,7 @@ public function __construct($user, array $roles = array())
4545
4646 public function serialize ()
4747 {
48- return serialize (array ( $ this ->credentials , parent ::serialize ()) );
48+ return serialize ([ $ this ->credentials , parent ::serialize ()] );
4949 }
5050
5151 public function unserialize ($ serialized )
@@ -63,7 +63,7 @@ class AbstractTokenTest extends TestCase
6363{
6464 public function testGetUsername ()
6565 {
66- $ token = $ this ->getToken (array ( 'ROLE_FOO ' ) );
66+ $ token = $ this ->getToken ([ 'ROLE_FOO ' ] );
6767 $ token ->setUser ('fabien ' );
6868 $ this ->assertEquals ('fabien ' , $ token ->getUsername ());
6969
@@ -78,7 +78,7 @@ public function testGetUsername()
7878
7979 public function testEraseCredentials ()
8080 {
81- $ token = $ this ->getToken (array ( 'ROLE_FOO ' ) );
81+ $ token = $ this ->getToken ([ 'ROLE_FOO ' ] );
8282
8383 $ user = $ this ->getMockBuilder ('Symfony\Component\Security\Core\User\UserInterface ' )->getMock ();
8484 $ user ->expects ($ this ->once ())->method ('eraseCredentials ' );
@@ -89,8 +89,8 @@ public function testEraseCredentials()
8989
9090 public function testSerialize ()
9191 {
92- $ token = $ this ->getToken (array ( 'ROLE_FOO ' , new Role ('ROLE_BAR ' )) );
93- $ token ->setAttributes (array ( 'foo ' => 'bar ' ) );
92+ $ token = $ this ->getToken ([ 'ROLE_FOO ' , new Role ('ROLE_BAR ' )] );
93+ $ token ->setAttributes ([ 'foo ' => 'bar ' ] );
9494
9595 $ uToken = unserialize (serialize ($ token ));
9696
@@ -100,7 +100,7 @@ public function testSerialize()
100100
101101 public function testSerializeWithRoleObjects ()
102102 {
103- $ user = new User ('name ' , 'password ' , array ( new Role ('ROLE_FOO ' ), new Role ('ROLE_BAR ' )) );
103+ $ user = new User ('name ' , 'password ' , [ new Role ('ROLE_FOO ' ), new Role ('ROLE_BAR ' )] );
104104 $ token = new ConcreteToken ($ user , $ user ->getRoles ());
105105
106106 $ serialized = serialize ($ token );
@@ -114,9 +114,9 @@ public function testSerializeWithRoleObjects()
114114 public function testSerializeParent ()
115115 {
116116 $ user = new TestUser ('fabien ' );
117- $ token = new ConcreteToken ($ user , array ( 'ROLE_FOO ' ) );
117+ $ token = new ConcreteToken ($ user , [ 'ROLE_FOO ' ] );
118118
119- $ parentToken = new ConcreteToken ($ user , array ( new SwitchUserRole ('ROLE_PREVIOUS ' , $ token )) );
119+ $ parentToken = new ConcreteToken ($ user , [ new SwitchUserRole ('ROLE_PREVIOUS ' , $ token )] );
120120 $ uToken = unserialize (serialize ($ parentToken ));
121121
122122 $ this ->assertEquals (
@@ -127,14 +127,14 @@ public function testSerializeParent()
127127
128128 public function testConstructor ()
129129 {
130- $ token = $ this ->getToken (array ( 'ROLE_FOO ' ) );
131- $ this ->assertEquals (array ( new Role ('ROLE_FOO ' )) , $ token ->getRoles ());
130+ $ token = $ this ->getToken ([ 'ROLE_FOO ' ] );
131+ $ this ->assertEquals ([ new Role ('ROLE_FOO ' )] , $ token ->getRoles ());
132132
133- $ token = $ this ->getToken (array ( new Role ('ROLE_FOO ' )) );
134- $ this ->assertEquals (array ( new Role ('ROLE_FOO ' )) , $ token ->getRoles ());
133+ $ token = $ this ->getToken ([ new Role ('ROLE_FOO ' )] );
134+ $ this ->assertEquals ([ new Role ('ROLE_FOO ' )] , $ token ->getRoles ());
135135
136- $ token = $ this ->getToken (array ( new Role ('ROLE_FOO ' ), 'ROLE_BAR ' ) );
137- $ this ->assertEquals (array ( new Role ('ROLE_FOO ' ), new Role ('ROLE_BAR ' )) , $ token ->getRoles ());
136+ $ token = $ this ->getToken ([ new Role ('ROLE_FOO ' ), 'ROLE_BAR ' ] );
137+ $ this ->assertEquals ([ new Role ('ROLE_FOO ' ), new Role ('ROLE_BAR ' )] , $ token ->getRoles ());
138138 }
139139
140140 public function testAuthenticatedFlag ()
@@ -151,7 +151,7 @@ public function testAuthenticatedFlag()
151151
152152 public function testAttributes ()
153153 {
154- $ attributes = array ( 'foo ' => 'bar ' ) ;
154+ $ attributes = [ 'foo ' => 'bar ' ] ;
155155 $ token = $ this ->getToken ();
156156 $ token ->setAttributes ($ attributes );
157157
@@ -185,11 +185,11 @@ public function getUsers()
185185 {
186186 $ user = $ this ->getMockBuilder ('Symfony\Component\Security\Core\User\UserInterface ' )->getMock ();
187187
188- return array (
189- array ( $ user) ,
190- array ( new TestUser ('foo ' )) ,
191- array ( 'foo ' ) ,
192- ) ;
188+ return [
189+ [ $ user] ,
190+ [ new TestUser ('foo ' )] ,
191+ [ 'foo ' ] ,
192+ ] ;
193193 }
194194
195195 /**
@@ -212,16 +212,16 @@ public function getUserChanges()
212212 {
213213 $ user = $ this ->getMockBuilder ('Symfony\Component\Security\Core\User\UserInterface ' )->getMock ();
214214
215- return array (
216- array ( 'foo ' , 'bar ' ) ,
217- array ( 'foo ' , new TestUser ('bar ' )) ,
218- array ( 'foo ' , $ user) ,
219- array ( $ user , 'foo ' ) ,
220- array ( $ user , new TestUser ('foo ' )) ,
221- array ( new TestUser ('foo ' ), new TestUser ('bar ' )) ,
222- array ( new TestUser ('foo ' ), 'bar ' ) ,
223- array ( new TestUser ('foo ' ), $ user) ,
224- ) ;
215+ return [
216+ [ 'foo ' , 'bar ' ] ,
217+ [ 'foo ' , new TestUser ('bar ' )] ,
218+ [ 'foo ' , $ user] ,
219+ [ $ user , 'foo ' ] ,
220+ [ $ user , new TestUser ('foo ' )] ,
221+ [ new TestUser ('foo ' ), new TestUser ('bar ' )] ,
222+ [ new TestUser ('foo ' ), 'bar ' ] ,
223+ [ new TestUser ('foo ' ), $ user] ,
224+ ] ;
225225 }
226226
227227 /**
@@ -247,22 +247,22 @@ public function getUserChangesAdvancedUser()
247247 $ user = $ this ->getMockBuilder ('Symfony\Component\Security\Core\User\UserInterface ' )->getMock ();
248248 $ advancedUser = $ this ->getMockBuilder ('Symfony\Component\Security\Core\User\AdvancedUserInterface ' )->getMock ();
249249
250- return array (
251- array ( 'foo ' , 'bar ' ) ,
252- array ( 'foo ' , new TestUser ('bar ' )) ,
253- array ( 'foo ' , $ user) ,
254- array ( 'foo ' , $ advancedUser) ,
255- array ( $ user , 'foo ' ) ,
256- array ( $ advancedUser , 'foo ' ) ,
257- array ( $ user , new TestUser ('foo ' )) ,
258- array ( $ advancedUser , new TestUser ('foo ' )) ,
259- array ( new TestUser ('foo ' ), new TestUser ('bar ' )) ,
260- array ( new TestUser ('foo ' ), 'bar ' ) ,
261- array ( new TestUser ('foo ' ), $ user) ,
262- array ( new TestUser ('foo ' ), $ advancedUser) ,
263- array ( $ user , $ advancedUser) ,
264- array ( $ advancedUser , $ user) ,
265- ) ;
250+ return [
251+ [ 'foo ' , 'bar ' ] ,
252+ [ 'foo ' , new TestUser ('bar ' )] ,
253+ [ 'foo ' , $ user] ,
254+ [ 'foo ' , $ advancedUser] ,
255+ [ $ user , 'foo ' ] ,
256+ [ $ advancedUser , 'foo ' ] ,
257+ [ $ user , new TestUser ('foo ' )] ,
258+ [ $ advancedUser , new TestUser ('foo ' )] ,
259+ [ new TestUser ('foo ' ), new TestUser ('bar ' )] ,
260+ [ new TestUser ('foo ' ), 'bar ' ] ,
261+ [ new TestUser ('foo ' ), $ user] ,
262+ [ new TestUser ('foo ' ), $ advancedUser] ,
263+ [ $ user , $ advancedUser] ,
264+ [ $ advancedUser , $ user] ,
265+ ] ;
266266 }
267267
268268 /**
@@ -281,8 +281,8 @@ public function testSetUserDoesNotSetAuthenticatedToFalseWhenUserDoesNotChange($
281281 $ this ->assertTrue ($ token ->isAuthenticated ());
282282 }
283283
284- protected function getToken (array $ roles = array () )
284+ protected function getToken (array $ roles = [] )
285285 {
286- return $ this ->getMockForAbstractClass ('Symfony\Component\Security\Core\Authentication\Token\AbstractToken ' , array ( $ roles) );
286+ return $ this ->getMockForAbstractClass ('Symfony\Component\Security\Core\Authentication\Token\AbstractToken ' , [ $ roles] );
287287 }
288288}
0 commit comments