diff --git a/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php b/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php index 2b53708c1..f699863d2 100644 --- a/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php +++ b/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php @@ -122,7 +122,7 @@ public function setUp() ->method('getUserClassName') ->will($this->returnValue('stdClass')); - $this->factory = $this->getMockForAbstractClass(AbstractBaseFactory::class, array($configuration)); + $this->factory = $this->getMockForAbstractClass(AbstractBaseFactory::class, [$configuration]); $this->factory->expects($this->any())->method('getGenerator')->will($this->returnValue($this->generator)); } diff --git a/tests/ProxyManagerTest/Factory/AccessInterceptorScopeLocalizerFactoryTest.php b/tests/ProxyManagerTest/Factory/AccessInterceptorScopeLocalizerFactoryTest.php index 799a099bd..097c1cd15 100644 --- a/tests/ProxyManagerTest/Factory/AccessInterceptorScopeLocalizerFactoryTest.php +++ b/tests/ProxyManagerTest/Factory/AccessInterceptorScopeLocalizerFactoryTest.php @@ -123,12 +123,12 @@ public function testWillSkipAutoGeneration() $factory = new AccessInterceptorScopeLocalizerFactory($this->config); /* @var $proxy AccessInterceptorValueHolderMock */ - $proxy = $factory->createProxy($instance, array('foo'), array('bar')); + $proxy = $factory->createProxy($instance, ['foo'], ['bar']); $this->assertInstanceOf(AccessInterceptorValueHolderMock::class, $proxy); $this->assertSame($instance, $proxy->instance); - $this->assertSame(array('foo'), $proxy->prefixInterceptors); - $this->assertSame(array('bar'), $proxy->suffixInterceptors); + $this->assertSame(['foo'], $proxy->prefixInterceptors); + $this->assertSame(['bar'], $proxy->suffixInterceptors); } /** @@ -196,11 +196,11 @@ function () use ($proxyClassName) { $factory = new AccessInterceptorScopeLocalizerFactory($this->config); /* @var $proxy AccessInterceptorValueHolderMock */ - $proxy = $factory->createProxy($instance, array('foo'), array('bar')); + $proxy = $factory->createProxy($instance, ['foo'], ['bar']); $this->assertInstanceOf($proxyClassName, $proxy); $this->assertSame($instance, $proxy->instance); - $this->assertSame(array('foo'), $proxy->prefixInterceptors); - $this->assertSame(array('bar'), $proxy->suffixInterceptors); + $this->assertSame(['foo'], $proxy->prefixInterceptors); + $this->assertSame(['bar'], $proxy->suffixInterceptors); } } diff --git a/tests/ProxyManagerTest/Factory/AccessInterceptorValueHolderFactoryTest.php b/tests/ProxyManagerTest/Factory/AccessInterceptorValueHolderFactoryTest.php index 9d2820a31..c9e3f6e14 100644 --- a/tests/ProxyManagerTest/Factory/AccessInterceptorValueHolderFactoryTest.php +++ b/tests/ProxyManagerTest/Factory/AccessInterceptorValueHolderFactoryTest.php @@ -122,12 +122,12 @@ public function testWillSkipAutoGeneration() $factory = new AccessInterceptorValueHolderFactory($this->config); /* @var $proxy AccessInterceptorValueHolderMock */ - $proxy = $factory->createProxy($instance, array('foo'), array('bar')); + $proxy = $factory->createProxy($instance, ['foo'], ['bar']); $this->assertInstanceOf(AccessInterceptorValueHolderMock::class, $proxy); $this->assertSame($instance, $proxy->instance); - $this->assertSame(array('foo'), $proxy->prefixInterceptors); - $this->assertSame(array('bar'), $proxy->suffixInterceptors); + $this->assertSame(['foo'], $proxy->prefixInterceptors); + $this->assertSame(['bar'], $proxy->suffixInterceptors); } /** @@ -195,11 +195,11 @@ function () use ($proxyClassName) { $factory = new AccessInterceptorValueHolderFactory($this->config); /* @var $proxy AccessInterceptorValueHolderMock */ - $proxy = $factory->createProxy($instance, array('foo'), array('bar')); + $proxy = $factory->createProxy($instance, ['foo'], ['bar']); $this->assertInstanceOf($proxyClassName, $proxy); $this->assertSame($instance, $proxy->instance); - $this->assertSame(array('foo'), $proxy->prefixInterceptors); - $this->assertSame(array('bar'), $proxy->suffixInterceptors); + $this->assertSame(['foo'], $proxy->prefixInterceptors); + $this->assertSame(['bar'], $proxy->suffixInterceptors); } } diff --git a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/BaseAdapterTest.php b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/BaseAdapterTest.php index 5787030ca..a85d18593 100644 --- a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/BaseAdapterTest.php +++ b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/BaseAdapterTest.php @@ -43,18 +43,18 @@ public function testBaseAdapter() { $client = $this ->getMockBuilder('Zend\Server\Client') - ->setMethods(array('call')) + ->setMethods(['call']) ->getMock(); $adapter = $this->getMockForAbstractClass( BaseAdapter::class, - array($client) + [$client] ); $client ->expects($this->once()) ->method('call') - ->with('foobarbaz', array('tab' => 'taz')) + ->with('foobarbaz', ['tab' => 'taz']) ->will($this->returnValue('baz')); $adapter @@ -63,7 +63,7 @@ public function testBaseAdapter() ->with('foo', 'bar') ->will($this->returnValue('foobarbaz')); - $this->assertSame('baz', $adapter->call('foo', 'bar', array('tab' => 'taz'))); + $this->assertSame('baz', $adapter->call('foo', 'bar', ['tab' => 'taz'])); } /** @@ -77,18 +77,18 @@ public function testBaseAdapterWithServiceMap() { $client = $this ->getMockBuilder('Zend\Server\Client') - ->setMethods(array('call')) + ->setMethods(['call']) ->getMock(); $adapter = $this->getMockForAbstractClass( BaseAdapter::class, - array($client, array('foobarbaz' => 'mapped')) + [$client, ['foobarbaz' => 'mapped']] ); $client ->expects($this->once()) ->method('call') - ->with('mapped', array('tab' => 'taz')) + ->with('mapped', ['tab' => 'taz']) ->will($this->returnValue('baz')); $adapter @@ -97,6 +97,6 @@ public function testBaseAdapterWithServiceMap() ->with('foo', 'bar') ->will($this->returnValue('foobarbaz')); - $this->assertSame('baz', $adapter->call('foo', 'bar', array('tab' => 'taz'))); + $this->assertSame('baz', $adapter->call('foo', 'bar', ['tab' => 'taz'])); } } diff --git a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/JsonRpcTest.php b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/JsonRpcTest.php index 66e80d796..1c7955c31 100644 --- a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/JsonRpcTest.php +++ b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/JsonRpcTest.php @@ -41,7 +41,7 @@ public function testCanBuildAdapterWithJsonRpcClient() { $client = $this ->getMockBuilder('Zend\Server\Client') - ->setMethods(array('call')) + ->setMethods(['call']) ->getMock(); $adapter = new JsonRpc($client); @@ -49,9 +49,9 @@ public function testCanBuildAdapterWithJsonRpcClient() $client ->expects($this->once()) ->method('call') - ->with('foo.bar', array('tab' => 'taz')) + ->with('foo.bar', ['tab' => 'taz']) ->will($this->returnValue('baz')); - $this->assertSame('baz', $adapter->call('foo', 'bar', array('tab' => 'taz'))); + $this->assertSame('baz', $adapter->call('foo', 'bar', ['tab' => 'taz'])); } } diff --git a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/SoapTest.php b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/SoapTest.php index fe93e0009..37a6744b1 100644 --- a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/SoapTest.php +++ b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/SoapTest.php @@ -41,7 +41,7 @@ public function testCanBuildAdapterWithSoapRpcClient() { $client = $this ->getMockBuilder('Zend\Server\Client') - ->setMethods(array('call')) + ->setMethods(['call']) ->getMock(); $adapter = new Soap($client); @@ -49,9 +49,9 @@ public function testCanBuildAdapterWithSoapRpcClient() $client ->expects($this->once()) ->method('call') - ->with('bar', array('tab' => 'taz')) + ->with('bar', ['tab' => 'taz']) ->will($this->returnValue('baz')); - $this->assertSame('baz', $adapter->call('foo', 'bar', array('tab' => 'taz'))); + $this->assertSame('baz', $adapter->call('foo', 'bar', ['tab' => 'taz'])); } } diff --git a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/XmlRpcTest.php b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/XmlRpcTest.php index d795e40db..a9db7d1ed 100644 --- a/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/XmlRpcTest.php +++ b/tests/ProxyManagerTest/Factory/RemoteObject/Adapter/XmlRpcTest.php @@ -41,7 +41,7 @@ public function testCanBuildAdapterWithXmlRpcClient() { $client = $this ->getMockBuilder('Zend\Server\Client') - ->setMethods(array('call')) + ->setMethods(['call']) ->getMock(); $adapter = new XmlRpc($client); @@ -49,9 +49,9 @@ public function testCanBuildAdapterWithXmlRpcClient() $client ->expects($this->once()) ->method('call') - ->with('foo.bar', array('tab' => 'taz')) + ->with('foo.bar', ['tab' => 'taz']) ->will($this->returnValue('baz')); - $this->assertSame('baz', $adapter->call('foo', 'bar', array('tab' => 'taz'))); + $this->assertSame('baz', $adapter->call('foo', 'bar', ['tab' => 'taz'])); } } diff --git a/tests/ProxyManagerTest/Functional/AccessInterceptorScopeLocalizerFunctionalTest.php b/tests/ProxyManagerTest/Functional/AccessInterceptorScopeLocalizerFunctionalTest.php index 15d46796d..d44d5a49f 100644 --- a/tests/ProxyManagerTest/Functional/AccessInterceptorScopeLocalizerFunctionalTest.php +++ b/tests/ProxyManagerTest/Functional/AccessInterceptorScopeLocalizerFunctionalTest.php @@ -56,9 +56,9 @@ public function testMethodCalls($className, $instance, $method, $params, $expect $proxy = $proxyName::staticProxyConstructor($instance); $this->assertProxySynchronized($instance, $proxy); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); - $listener = $this->getMock('stdClass', array('__invoke')); + $listener = $this->getMock('stdClass', ['__invoke']); $listener ->expects($this->once()) ->method('__invoke') @@ -71,7 +71,7 @@ function ($proxy, $instance, $method, $params, & $returnEarly) use ($listener) { } ); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $random = uniqid(); @@ -84,7 +84,7 @@ function ($proxy, $instance, $method, $params, & $returnEarly) use ($random) { } ); - $this->assertSame($random, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($random, call_user_func_array([$proxy, $method], $params)); $this->assertProxySynchronized($instance, $proxy); } @@ -97,7 +97,7 @@ public function testMethodCallsWithSuffixListener($className, $instance, $method /* @var $proxy \ProxyManager\Proxy\AccessInterceptorInterface */ $proxy = $proxyName::staticProxyConstructor($instance); - $listener = $this->getMock(stdClass::class, array('__invoke')); + $listener = $this->getMock(stdClass::class, ['__invoke']); $listener ->expects($this->once()) ->method('__invoke') @@ -110,7 +110,7 @@ function ($proxy, $instance, $method, $params, $returnValue, & $returnEarly) use } ); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $random = uniqid(); @@ -123,7 +123,7 @@ function ($proxy, $instance, $method, $params, $returnValue, & $returnEarly) use } ); - $this->assertSame($random, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($random, call_user_func_array([$proxy, $method], $params)); $this->assertProxySynchronized($instance, $proxy); } @@ -136,7 +136,7 @@ public function testMethodCallsAfterUnSerialization($className, $instance, $meth /* @var $proxy \ProxyManager\Proxy\AccessInterceptorInterface */ $proxy = unserialize(serialize($proxyName::staticProxyConstructor($instance))); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $this->assertProxySynchronized($instance, $proxy); } @@ -152,7 +152,7 @@ public function testMethodCallsAfterCloning($className, $instance, $method, $par $cloned = clone $proxy; $this->assertProxySynchronized($instance, $proxy); - $this->assertSame($expectedValue, call_user_func_array(array($cloned, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$cloned, $method], $params)); $this->assertProxySynchronized($instance, $proxy); } @@ -222,9 +222,9 @@ public function testCanWriteToArrayKeysInPublicProperty() $this->assertSame('bar', $proxy->arrayProperty['foo']); - $proxy->arrayProperty = array('tab' => 'taz'); + $proxy->arrayProperty = ['tab' => 'taz']; - $this->assertSame(array('tab' => 'taz'), $proxy->arrayProperty); + $this->assertSame(['tab' => 'taz'], $proxy->arrayProperty); $this->assertProxySynchronized($instance, $proxy); } @@ -324,39 +324,39 @@ public function getProxyMethods() { $selfHintParam = new ClassWithSelfHint(); - $data = array( - array( + $data = [ + [ BaseClass::class, new BaseClass(), 'publicMethod', - array(), + [], 'publicMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicTypeHintedMethod', - array('param' => new stdClass()), + ['param' => new stdClass()], 'publicTypeHintedMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicByReferenceMethod', - array(), + [], 'publicByReferenceMethodDefault' - ), - ); + ], + ]; if (PHP_VERSION_ID >= 50401) { // PHP < 5.4.1 misbehaves, throwing strict standards, see https://bugs.php.net/bug.php?id=60573 - $data[] = array( + $data[] = [ ClassWithSelfHint::class, new ClassWithSelfHint(), 'selfHintMethod', - array('parameter' => $selfHintParam), + ['parameter' => $selfHintParam], $selfHintParam - ); + ]; } return $data; @@ -372,14 +372,14 @@ public function getPropertyAccessProxies() $instance1 = new BaseClass(); $proxyName1 = $this->generateProxy(get_class($instance1)); - return array( - array( + return [ + [ $instance1, $proxyName1::staticProxyConstructor($instance1), 'publicProperty', 'publicPropertyDefault', - ), - ); + ], + ]; } /** diff --git a/tests/ProxyManagerTest/Functional/AccessInterceptorValueHolderFunctionalTest.php b/tests/ProxyManagerTest/Functional/AccessInterceptorValueHolderFunctionalTest.php index 349a948a8..dedebf812 100644 --- a/tests/ProxyManagerTest/Functional/AccessInterceptorValueHolderFunctionalTest.php +++ b/tests/ProxyManagerTest/Functional/AccessInterceptorValueHolderFunctionalTest.php @@ -54,9 +54,9 @@ public function testMethodCalls($className, $instance, $method, $params, $expect $proxy = $proxyName::staticProxyConstructor($instance); $this->assertSame($instance, $proxy->getWrappedValueHolderValue()); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); - $listener = $this->getMock(stdClass::class, array('__invoke')); + $listener = $this->getMock(stdClass::class, ['__invoke']); $listener ->expects($this->once()) ->method('__invoke') @@ -69,7 +69,7 @@ function ($proxy, $instance, $method, $params, & $returnEarly) use ($listener) { } ); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $random = uniqid(); @@ -82,7 +82,7 @@ function ($proxy, $instance, $method, $params, & $returnEarly) use ($random) { } ); - $this->assertSame($random, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($random, call_user_func_array([$proxy, $method], $params)); } /** @@ -94,7 +94,7 @@ public function testMethodCallsWithSuffixListener($className, $instance, $method /* @var $proxy \ProxyManager\Proxy\AccessInterceptorInterface|\ProxyManager\Proxy\ValueHolderInterface */ $proxy = $proxyName::staticProxyConstructor($instance); - $listener = $this->getMock(stdClass::class, array('__invoke')); + $listener = $this->getMock(stdClass::class, ['__invoke']); $listener ->expects($this->once()) ->method('__invoke') @@ -107,7 +107,7 @@ function ($proxy, $instance, $method, $params, $returnValue, & $returnEarly) use } ); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $random = uniqid(); @@ -120,7 +120,7 @@ function ($proxy, $instance, $method, $params, $returnValue, & $returnEarly) use } ); - $this->assertSame($random, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($random, call_user_func_array([$proxy, $method], $params)); } /** @@ -132,7 +132,7 @@ public function testMethodCallsAfterUnSerialization($className, $instance, $meth /* @var $proxy \ProxyManager\Proxy\AccessInterceptorInterface|\ProxyManager\Proxy\ValueHolderInterface */ $proxy = unserialize(serialize($proxyName::staticProxyConstructor($instance))); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $this->assertEquals($instance, $proxy->getWrappedValueHolderValue()); } @@ -148,7 +148,7 @@ public function testMethodCallsAfterCloning($className, $instance, $method, $par $cloned = clone $proxy; $this->assertNotSame($proxy->getWrappedValueHolderValue(), $cloned->getWrappedValueHolderValue()); - $this->assertSame($expectedValue, call_user_func_array(array($cloned, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$cloned, $method], $params)); $this->assertEquals($instance, $cloned->getWrappedValueHolderValue()); } @@ -216,9 +216,9 @@ public function testCanWriteToArrayKeysInPublicProperty() $this->assertSame('bar', $proxy->arrayProperty['foo']); - $proxy->arrayProperty = array('tab' => 'taz'); + $proxy->arrayProperty = ['tab' => 'taz']; - $this->assertSame(array('tab' => 'taz'), $proxy->arrayProperty); + $this->assertSame(['tab' => 'taz'], $proxy->arrayProperty); } /** @@ -314,46 +314,46 @@ public function getProxyMethods() { $selfHintParam = new ClassWithSelfHint(); - $data = array( - array( + $data = [ + [ BaseClass::class, new BaseClass(), 'publicMethod', - array(), + [], 'publicMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicTypeHintedMethod', - array('param' => new stdClass()), + ['param' => new stdClass()], 'publicTypeHintedMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicByReferenceMethod', - array(), + [], 'publicByReferenceMethodDefault' - ), - array( + ], + [ BaseInterface::class, new BaseClass(), 'publicMethod', - array(), + [], 'publicMethodDefault' - ), - ); + ], + ]; if (PHP_VERSION_ID >= 50401) { // PHP < 5.4.1 misbehaves, throwing strict standards, see https://bugs.php.net/bug.php?id=60573 - $data[] = array( + $data[] = [ ClassWithSelfHint::class, new ClassWithSelfHint(), 'selfHintMethod', - array('parameter' => $selfHintParam), + ['parameter' => $selfHintParam], $selfHintParam - ); + ]; } return $data; @@ -371,19 +371,19 @@ public function getPropertyAccessProxies() $instance2 = new BaseClass(); $proxyName2 = $this->generateProxy(get_class($instance2)); - return array( - array( + return [ + [ $instance1, $proxyName1::staticProxyConstructor($instance1), 'publicProperty', 'publicPropertyDefault', - ), - array( + ], + [ $instance2, unserialize(serialize($proxyName2::staticProxyConstructor($instance2))), 'publicProperty', 'publicPropertyDefault', - ), - ); + ], + ]; } } diff --git a/tests/ProxyManagerTest/Functional/BaseLazyLoadingPerformanceTest.php b/tests/ProxyManagerTest/Functional/BaseLazyLoadingPerformanceTest.php index d00fa415f..43980ea49 100644 --- a/tests/ProxyManagerTest/Functional/BaseLazyLoadingPerformanceTest.php +++ b/tests/ProxyManagerTest/Functional/BaseLazyLoadingPerformanceTest.php @@ -43,7 +43,7 @@ protected function profileMethodAccess($className, array $instances, array $prox $this->startCapturing(); foreach ($instances as $instance) { - call_user_func_array(array($instance, $methodName), $parameters); + call_user_func_array([$instance, $methodName], $parameters); } $baseProfile = $this->endCapturing( @@ -52,7 +52,7 @@ protected function profileMethodAccess($className, array $instances, array $prox $this->startCapturing(); foreach ($proxies as $proxy) { - call_user_func_array(array($proxy, $methodName), $parameters); + call_user_func_array([$proxy, $methodName], $parameters); } $proxyProfile = $this->endCapturing( diff --git a/tests/ProxyManagerTest/Functional/BasePerformanceTest.php b/tests/ProxyManagerTest/Functional/BasePerformanceTest.php index b9dc803e7..c278f183e 100644 --- a/tests/ProxyManagerTest/Functional/BasePerformanceTest.php +++ b/tests/ProxyManagerTest/Functional/BasePerformanceTest.php @@ -78,10 +78,10 @@ protected function endCapturing($messageTemplate) echo sprintf($messageTemplate, $time, $memory / 1024) . "\n"; - return array( + return [ 'time' => $time, 'memory' => $memory - ); + ]; } /** diff --git a/tests/ProxyManagerTest/Functional/FatalPreventionFunctionalTest.php b/tests/ProxyManagerTest/Functional/FatalPreventionFunctionalTest.php index 4e67b4b60..ecec280f1 100644 --- a/tests/ProxyManagerTest/Functional/FatalPreventionFunctionalTest.php +++ b/tests/ProxyManagerTest/Functional/FatalPreventionFunctionalTest.php @@ -92,7 +92,7 @@ public function testCodeGeneration($generatorClass, $className) var_export($className, true) ); - $result = $runner->runJob($code, array('-n')); + $result = $runner->runJob($code, ['-n']); if (('SUCCESS: ' . $className) !== $result['stdout']) { $this->fail(sprintf( @@ -121,19 +121,19 @@ public function getTestedClasses() function ($generator) use ($that) { return array_map( function ($class) use ($generator) { - return array($generator, $class); + return [$generator, $class]; }, $that->getProxyTestedClasses() ); }, - array( + [ AccessInterceptorScopeLocalizerGenerator::class, AccessInterceptorValueHolderGenerator::class, LazyLoadingGhostGenerator::class, LazyLoadingValueHolderGenerator::class, NullObjectGenerator::class, RemoteObjectGenerator::class, - ) + ] ) ); } @@ -145,11 +145,11 @@ function ($class) use ($generator) { */ public function getProxyTestedClasses() { - $skippedPaths = array( + $skippedPaths = [ realpath(__DIR__ . '/../../src'), realpath(__DIR__ . '/../../vendor'), realpath(__DIR__ . '/../../tests/ProxyManagerTest'), - ); + ]; return array_filter( get_declared_classes(), diff --git a/tests/ProxyManagerTest/Functional/LazyLoadingGhostFunctionalTest.php b/tests/ProxyManagerTest/Functional/LazyLoadingGhostFunctionalTest.php index 325fbd696..d842ed003 100644 --- a/tests/ProxyManagerTest/Functional/LazyLoadingGhostFunctionalTest.php +++ b/tests/ProxyManagerTest/Functional/LazyLoadingGhostFunctionalTest.php @@ -57,7 +57,7 @@ public function testMethodCalls($className, $instance, $method, $params, $expect $proxy = $proxyName::staticProxyConstructor($this->createInitializer($className, $instance)); $this->assertFalse($proxy->isProxyInitialized()); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $this->assertTrue($proxy->isProxyInitialized()); } @@ -74,7 +74,7 @@ public function testMethodCallsAfterUnSerialization($className, $instance, $meth ))); $this->assertTrue($proxy->isProxyInitialized()); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); } /** @@ -89,7 +89,7 @@ public function testMethodCallsAfterCloning($className, $instance, $method, $par $cloned = clone $proxy; $this->assertTrue($cloned->isProxyInitialized()); - $this->assertSame($expectedValue, call_user_func_array(array($cloned, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$cloned, $method], $params)); } /** @@ -166,9 +166,9 @@ public function testCanWriteToArrayKeysInPublicProperty() $this->assertSame('bar', $proxy->arrayProperty['foo']); - $proxy->arrayProperty = array('tab' => 'taz'); + $proxy->arrayProperty = ['tab' => 'taz']; - $this->assertSame(array('tab' => 'taz'), $proxy->arrayProperty); + $this->assertSame(['tab' => 'taz'], $proxy->arrayProperty); } /** @@ -355,7 +355,7 @@ private function generateProxy($parentClassName) private function createInitializer($className, $realInstance, Mock $initializerMatcher = null) { if (null === $initializerMatcher) { - $initializerMatcher = $this->getMock('stdClass', array('__invoke')); + $initializerMatcher = $this->getMock('stdClass', ['__invoke']); $initializerMatcher ->expects($this->once()) @@ -368,7 +368,7 @@ private function createInitializer($className, $realInstance, Mock $initializerM ); } - $initializerMatcher = $initializerMatcher ?: $this->getMock('stdClass', array('__invoke')); + $initializerMatcher = $initializerMatcher ?: $this->getMock('stdClass', ['__invoke']); return function ( GhostObjectInterface $proxy, @@ -400,39 +400,39 @@ public function getProxyMethods() { $selfHintParam = new ClassWithSelfHint(); - $data = array( - array( + $data = [ + [ BaseClass::class, new BaseClass(), 'publicMethod', - array(), + [], 'publicMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicTypeHintedMethod', - array(new \stdClass()), + [new \stdClass()], 'publicTypeHintedMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicByReferenceMethod', - array(), + [], 'publicByReferenceMethodDefault' - ), - ); + ], + ]; if (PHP_VERSION_ID >= 50401) { // PHP < 5.4.1 misbehaves, throwing strict standards, see https://bugs.php.net/bug.php?id=60573 - $data[] = array( + $data[] = [ ClassWithSelfHint::class, new ClassWithSelfHint(), 'selfHintMethod', - array('parameter' => $selfHintParam), + ['parameter' => $selfHintParam], $selfHintParam - ); + ]; } return $data; @@ -450,21 +450,21 @@ public function getPropertyAccessProxies() $instance2 = new BaseClass(); $proxyName2 = $this->generateProxy(get_class($instance2)); - return array( - array( + return [ + [ $instance1, new $proxyName1($this->createInitializer(BaseClass::class, $instance1)), 'publicProperty', 'publicPropertyDefault', - ), - array( + ], + [ $instance2, unserialize( serialize(new $proxyName2($this->createInitializer(BaseClass::class, $instance2))) ), 'publicProperty', 'publicPropertyDefault', - ), - ); + ], + ]; } } diff --git a/tests/ProxyManagerTest/Functional/LazyLoadingGhostPerformanceTest.php b/tests/ProxyManagerTest/Functional/LazyLoadingGhostPerformanceTest.php index 9dc9d28ac..ea5c8395a 100644 --- a/tests/ProxyManagerTest/Functional/LazyLoadingGhostPerformanceTest.php +++ b/tests/ProxyManagerTest/Functional/LazyLoadingGhostPerformanceTest.php @@ -57,9 +57,9 @@ public function testProxyInstantiationPerformance( ) { $proxyName = $this->generateProxy($className); $iterations = 20000; - $instances = array(); + $instances = []; /* @var $proxies \ProxyManager\Proxy\GhostObjectInterface[] */ - $proxies = array(); + $proxies = []; $realInstance = new $className(); $initializer = function ( GhostObjectInterface $proxy, @@ -123,13 +123,13 @@ public function testProxyInstantiationPerformance( */ public function getTestedClasses() { - $testedClasses = array( - array(stdClass::class, array(), array()), - array(BaseClass::class, array('publicMethod' => array()), array('publicProperty')), - ); + $testedClasses = [ + [stdClass::class, [], []], + [BaseClass::class, ['publicMethod' => []], ['publicProperty']], + ]; foreach ($testedClasses as $key => $testedClass) { - $reflectionProperties = array(); + $reflectionProperties = []; $reflectionClass = new ReflectionClass($testedClass[0]); foreach ($reflectionClass->getProperties() as $property) { diff --git a/tests/ProxyManagerTest/Functional/LazyLoadingValueHolderFunctionalTest.php b/tests/ProxyManagerTest/Functional/LazyLoadingValueHolderFunctionalTest.php index 190e97bfe..55efce2f1 100644 --- a/tests/ProxyManagerTest/Functional/LazyLoadingValueHolderFunctionalTest.php +++ b/tests/ProxyManagerTest/Functional/LazyLoadingValueHolderFunctionalTest.php @@ -56,7 +56,7 @@ public function testMethodCalls($className, $instance, $method, $params, $expect $proxy = $proxyName::staticProxyConstructor($this->createInitializer($className, $instance)); $this->assertFalse($proxy->isProxyInitialized()); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $this->assertTrue($proxy->isProxyInitialized()); $this->assertSame($instance, $proxy->getWrappedValueHolderValue()); } @@ -74,7 +74,7 @@ public function testMethodCallsAfterUnSerialization($className, $instance, $meth ))); $this->assertTrue($proxy->isProxyInitialized()); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); $this->assertEquals($instance, $proxy->getWrappedValueHolderValue()); } @@ -91,7 +91,7 @@ public function testMethodCallsAfterCloning($className, $instance, $method, $par $this->assertTrue($cloned->isProxyInitialized()); $this->assertNotSame($proxy->getWrappedValueHolderValue(), $cloned->getWrappedValueHolderValue()); - $this->assertSame($expectedValue, call_user_func_array(array($cloned, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$cloned, $method], $params)); $this->assertEquals($instance, $cloned->getWrappedValueHolderValue()); } @@ -174,9 +174,9 @@ public function testCanWriteToArrayKeysInPublicProperty() $this->assertSame('bar', $proxy->arrayProperty['foo']); - $proxy->arrayProperty = array('tab' => 'taz'); + $proxy->arrayProperty = ['tab' => 'taz']; - $this->assertSame(array('tab' => 'taz'), $proxy->arrayProperty); + $this->assertSame(['tab' => 'taz'], $proxy->arrayProperty); } /** @@ -297,7 +297,7 @@ private function generateProxy($parentClassName) private function createInitializer($className, $realInstance, Mock $initializerMatcher = null) { if (null === $initializerMatcher) { - $initializerMatcher = $this->getMock(stdClass::class, array('__invoke')); + $initializerMatcher = $this->getMock(stdClass::class, ['__invoke']); $initializerMatcher ->expects($this->once()) @@ -311,7 +311,7 @@ private function createInitializer($className, $realInstance, Mock $initializerM ); } - $initializerMatcher = $initializerMatcher ?: $this->getMock(stdClass::class, array('__invoke')); + $initializerMatcher = $initializerMatcher ?: $this->getMock(stdClass::class, ['__invoke']); return function ( & $wrappedObject, @@ -339,46 +339,46 @@ public function getProxyMethods() { $selfHintParam = new ClassWithSelfHint(); - $data = array( - array( + $data = [ + [ BaseClass::class, new BaseClass(), 'publicMethod', - array(), + [], 'publicMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicTypeHintedMethod', - array(new stdClass()), + [new stdClass()], 'publicTypeHintedMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicByReferenceMethod', - array(), + [], 'publicByReferenceMethodDefault' - ), - array( + ], + [ BaseInterface::class, new BaseClass(), 'publicMethod', - array(), + [], 'publicMethodDefault' - ), - ); + ], + ]; if (PHP_VERSION_ID >= 50401) { // PHP < 5.4.1 misbehaves, throwing strict standards, see https://bugs.php.net/bug.php?id=60573 - $data[] = array( + $data[] = [ ClassWithSelfHint::class, new ClassWithSelfHint(), 'selfHintMethod', - array('parameter' => $selfHintParam), + ['parameter' => $selfHintParam], $selfHintParam - ); + ]; } return $data; @@ -396,23 +396,23 @@ public function getPropertyAccessProxies() $instance2 = new BaseClass(); $proxyName2 = $this->generateProxy(get_class($instance2)); - return array( - array( + return [ + [ $instance1, $proxyName1::staticProxyConstructor( $this->createInitializer(BaseClass::class, $instance1) ), 'publicProperty', 'publicPropertyDefault', - ), - array( + ], + [ $instance2, unserialize(serialize($proxyName2::staticProxyConstructor( $this->createInitializer(BaseClass::class, $instance2) ))), 'publicProperty', 'publicPropertyDefault', - ), - ); + ], + ]; } } diff --git a/tests/ProxyManagerTest/Functional/LazyLoadingValueHolderPerformanceTest.php b/tests/ProxyManagerTest/Functional/LazyLoadingValueHolderPerformanceTest.php index 51bea4b62..30cccc9d7 100644 --- a/tests/ProxyManagerTest/Functional/LazyLoadingValueHolderPerformanceTest.php +++ b/tests/ProxyManagerTest/Functional/LazyLoadingValueHolderPerformanceTest.php @@ -52,9 +52,9 @@ public function testProxyInstantiationPerformance($className, array $methods, ar { $proxyName = $this->generateProxy($className); $iterations = 20000; - $instances = array(); + $instances = []; /* @var $proxies \ProxyManager\Proxy\VirtualProxyInterface[] */ - $proxies = array(); + $proxies = []; $initializer = function ( & $valueHolder, VirtualProxyInterface $proxy, @@ -112,10 +112,10 @@ public function testProxyInstantiationPerformance($className, array $methods, ar */ public function getTestedClasses() { - return array( - array(stdClass::class, array(), array()), - array(BaseClass::class, array('publicMethod' => array()), array('publicProperty')), - ); + return [ + [stdClass::class, [], []], + [BaseClass::class, ['publicMethod' => []], ['publicProperty']], + ]; } /** diff --git a/tests/ProxyManagerTest/Functional/MultipleProxyGenerationTest.php b/tests/ProxyManagerTest/Functional/MultipleProxyGenerationTest.php index 38e958c20..0e77ee0f6 100644 --- a/tests/ProxyManagerTest/Functional/MultipleProxyGenerationTest.php +++ b/tests/ProxyManagerTest/Functional/MultipleProxyGenerationTest.php @@ -72,12 +72,12 @@ public function testCanGenerateMultipleDifferentProxiesForSameClass($className) }; $reflectionClass = new ReflectionClass($className); - $generated = array( + $generated = [ $ghostProxyFactory->createProxy($className, $initializer), $virtualProxyFactory->createProxy($className, $initializer), $accessInterceptorFactory->createProxy(new $className()), $accessInterceptorScopeLocalizerFactory->createProxy(new $className()), - ); + ]; foreach ($generated as $key => $proxy) { $this->assertInstanceOf($className, $proxy); @@ -103,23 +103,23 @@ public function testCanGenerateMultipleDifferentProxiesForSameClass($className) */ public function getTestedClasses() { - $data = array( - array(BaseClass::class), - array(ClassWithMagicMethods::class), - array(ClassWithFinalMethods::class), - array(ClassWithFinalMagicMethods::class), - array(ClassWithByRefMagicMethods::class), - array(ClassWithMixedProperties::class), - array(ClassWithPrivateProperties::class), - array(ClassWithProtectedProperties::class), - array(ClassWithPublicProperties::class), - array(EmptyClass::class), - array(HydratedObject::class), - ); + $data = [ + [BaseClass::class], + [ClassWithMagicMethods::class], + [ClassWithFinalMethods::class], + [ClassWithFinalMagicMethods::class], + [ClassWithByRefMagicMethods::class], + [ClassWithMixedProperties::class], + [ClassWithPrivateProperties::class], + [ClassWithProtectedProperties::class], + [ClassWithPublicProperties::class], + [EmptyClass::class], + [HydratedObject::class], + ]; if (PHP_VERSION_ID >= 50401) { // PHP < 5.4.1 misbehaves, throwing strict standards, see https://bugs.php.net/bug.php?id=60573 - $data[] = array(ClassWithSelfHint::class); + $data[] = [ClassWithSelfHint::class]; } return $data; diff --git a/tests/ProxyManagerTest/Functional/NullObjectFunctionalTest.php b/tests/ProxyManagerTest/Functional/NullObjectFunctionalTest.php index ab113bfc8..e5e29404b 100644 --- a/tests/ProxyManagerTest/Functional/NullObjectFunctionalTest.php +++ b/tests/ProxyManagerTest/Functional/NullObjectFunctionalTest.php @@ -49,7 +49,7 @@ public function testMethodCalls($className, $instance, $method, $params, $expect /* @var $proxy \ProxyManager\Proxy\NullObjectInterface */ $proxy = $proxyName::staticProxyConstructor(); - $this->assertSame(null, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame(null, call_user_func_array([$proxy, $method], $params)); } /** @@ -61,7 +61,7 @@ public function testMethodCallsAfterUnSerialization($className, $instance, $meth /* @var $proxy \ProxyManager\Proxy\NullObjectInterface */ $proxy = unserialize(serialize($proxyName::staticProxyConstructor())); - $this->assertSame(null, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame(null, call_user_func_array([$proxy, $method], $params)); } /** @@ -75,7 +75,7 @@ public function testMethodCallsAfterCloning($className, $instance, $method, $par $proxy = $proxyName::staticProxyConstructor(); $cloned = clone $proxy; - $this->assertSame(null, call_user_func_array(array($cloned, $method), $params)); + $this->assertSame(null, call_user_func_array([$cloned, $method], $params)); } /** @@ -149,46 +149,46 @@ public function getProxyMethods() { $selfHintParam = new ClassWithSelfHint(); - $data = array( - array( + $data = [ + [ BaseClass::class, new BaseClass(), 'publicMethod', - array(), + [], 'publicMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicTypeHintedMethod', - array('param' => new \stdClass()), + ['param' => new \stdClass()], 'publicTypeHintedMethodDefault' - ), - array( + ], + [ BaseClass::class, new BaseClass(), 'publicByReferenceMethod', - array(), + [], 'publicByReferenceMethodDefault' - ), - array( + ], + [ BaseInterface::class, new BaseClass(), 'publicMethod', - array(), + [], 'publicMethodDefault' - ), - ); + ], + ]; if (PHP_VERSION_ID >= 50401) { // PHP < 5.4.1 misbehaves, throwing strict standards, see https://bugs.php.net/bug.php?id=60573 - $data[] = array( + $data[] = [ ClassWithSelfHint::class, new ClassWithSelfHint(), 'selfHintMethod', - array('parameter' => $selfHintParam), + ['parameter' => $selfHintParam], $selfHintParam - ); + ]; } return $data; @@ -206,19 +206,19 @@ public function getPropertyAccessProxies() $instance2 = new BaseClass(); $proxyName2 = $this->generateProxy(get_class($instance2)); - return array( - array( + return [ + [ $instance1, $proxyName1::staticProxyConstructor($instance1), 'publicProperty', 'publicPropertyDefault', - ), - array( + ], + [ $instance2, unserialize(serialize($proxyName2::staticProxyConstructor($instance2))), 'publicProperty', 'publicPropertyDefault', - ), - ); + ], + ]; } } diff --git a/tests/ProxyManagerTest/Functional/RemoteObjectFunctionalTest.php b/tests/ProxyManagerTest/Functional/RemoteObjectFunctionalTest.php index 7f6464c30..96e24c8db 100644 --- a/tests/ProxyManagerTest/Functional/RemoteObjectFunctionalTest.php +++ b/tests/ProxyManagerTest/Functional/RemoteObjectFunctionalTest.php @@ -51,7 +51,7 @@ protected function getXmlRpcAdapter($expectedValue, $method, array $params) { $client = $this ->getMockBuilder('Zend\Server\Client') - ->setMethods(array('call')) + ->setMethods(['call']) ->getMock(); $client @@ -62,10 +62,10 @@ protected function getXmlRpcAdapter($expectedValue, $method, array $params) $adapter = new XmlRpcAdapter( $client, - array( + [ 'ProxyManagerTestAsset\RemoteProxy\Foo.foo' => 'ProxyManagerTestAsset\RemoteProxy\FooServiceInterface.foo' - ) + ] ); return $adapter; @@ -82,7 +82,7 @@ protected function getJsonRpcAdapter($expectedValue, $method, array $params) { $client = $this ->getMockBuilder('Zend\Server\Client') - ->setMethods(array('call')) + ->setMethods(['call']) ->getMock(); $client @@ -93,10 +93,10 @@ protected function getJsonRpcAdapter($expectedValue, $method, array $params) $adapter = new JsonRpcAdapter( $client, - array( + [ 'ProxyManagerTestAsset\RemoteProxy\Foo.foo' => 'ProxyManagerTestAsset\RemoteProxy\FooServiceInterface.foo' - ) + ] ); return $adapter; @@ -112,7 +112,7 @@ public function testXmlRpcMethodCalls($instanceOrClassname, $method, $params, $e /* @var $proxy \ProxyManager\Proxy\RemoteObjectInterface */ $proxy = $proxyName::staticProxyConstructor($this->getXmlRpcAdapter($expectedValue, $method, $params)); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); } /** @@ -125,7 +125,7 @@ public function testJsonRpcMethodCalls($instanceOrClassname, $method, $params, $ /* @var $proxy \ProxyManager\Proxy\RemoteObjectInterface */ $proxy = $proxyName::staticProxyConstructor($this->getJsonRpcAdapter($expectedValue, $method, $params)); - $this->assertSame($expectedValue, call_user_func_array(array($proxy, $method), $params)); + $this->assertSame($expectedValue, call_user_func_array([$proxy, $method], $params)); } /** @@ -137,7 +137,7 @@ public function testJsonRpcPropertyReadAccess($instanceOrClassname, $publicPrope /* @var $proxy \ProxyManager\Proxy\RemoteObjectInterface */ $proxy = $proxyName::staticProxyConstructor( - $this->getJsonRpcAdapter($propertyValue, '__get', array($publicProperty)) + $this->getJsonRpcAdapter($propertyValue, '__get', [$publicProperty]) ); /* @var $proxy \ProxyManager\Proxy\NullObjectInterface */ @@ -173,41 +173,41 @@ public function getProxyMethods() { $selfHintParam = new ClassWithSelfHint(); - $data = array( - array( + $data = [ + [ 'ProxyManagerTestAsset\RemoteProxy\FooServiceInterface', 'foo', - array(), + [], 'bar remote' - ), - array( + ], + [ 'ProxyManagerTestAsset\RemoteProxy\Foo', 'foo', - array(), + [], 'bar remote' - ), - array( + ], + [ new Foo(), 'foo', - array(), + [], 'bar remote' - ), - array( + ], + [ 'ProxyManagerTestAsset\RemoteProxy\BazServiceInterface', 'baz', - array('baz'), + ['baz'], 'baz remote' - ), - ); + ], + ]; if (PHP_VERSION_ID >= 50401) { // PHP < 5.4.1 misbehaves, throwing strict standards, see https://bugs.php.net/bug.php?id=60573 - $data[] = array( + $data[] = [ new ClassWithSelfHint(), 'selfHintMethod', - array($selfHintParam), + [$selfHintParam], $selfHintParam - ); + ]; } return $data; @@ -220,12 +220,12 @@ public function getProxyMethods() */ public function getPropertyAccessProxies() { - return array( - array( + return [ + [ 'ProxyManagerTestAsset\RemoteProxy\FooServiceInterface', 'publicProperty', 'publicProperty remote', - ), - ); + ], + ]; } } diff --git a/tests/ProxyManagerTest/Generator/ClassGeneratorTest.php b/tests/ProxyManagerTest/Generator/ClassGeneratorTest.php index 6820a3a91..38bb0ca71 100644 --- a/tests/ProxyManagerTest/Generator/ClassGeneratorTest.php +++ b/tests/ProxyManagerTest/Generator/ClassGeneratorTest.php @@ -39,7 +39,7 @@ class ClassGeneratorTest extends PHPUnit_Framework_TestCase public function testExtendedClassesAreFQCNs() { $desiredFqcn = '\\stdClass'; - $classNameInputs = array(stdClass::class, '\\stdClass\\'); + $classNameInputs = [stdClass::class, '\\stdClass\\']; foreach ($classNameInputs as $className) { $classGenerator = new ClassGenerator(); @@ -54,8 +54,8 @@ public function testExtendedClassesAreFQCNs() */ public function testImplementedInterfacesAreFQCNs() { - $desiredFqcns = array('\\Countable'); - $interfaceNameInputs = array(array(Countable::class), array('\\Countable\\')); + $desiredFqcns = ['\\Countable']; + $interfaceNameInputs = [[Countable::class], ['\\Countable\\']]; foreach ($interfaceNameInputs as $interfaceNames) { $classGenerator = new ClassGenerator(); diff --git a/tests/ProxyManagerTest/Generator/MagicMethodGeneratorTest.php b/tests/ProxyManagerTest/Generator/MagicMethodGeneratorTest.php index 0fbd3ecba..53bb56401 100644 --- a/tests/ProxyManagerTest/Generator/MagicMethodGeneratorTest.php +++ b/tests/ProxyManagerTest/Generator/MagicMethodGeneratorTest.php @@ -40,7 +40,7 @@ class MagicMethodGeneratorTest extends PHPUnit_Framework_TestCase public function testGeneratesCorrectByRefReturnValue() { $reflection = new ReflectionClass(ClassWithByRefMagicMethods::class); - $magicMethod = new MagicMethodGenerator($reflection, '__get', array('name')); + $magicMethod = new MagicMethodGenerator($reflection, '__get', ['name']); $this->assertTrue($magicMethod->returnsReference()); } @@ -51,7 +51,7 @@ public function testGeneratesCorrectByRefReturnValue() public function testGeneratesCorrectByValReturnValue() { $reflection = new ReflectionClass(ClassWithMagicMethods::class); - $magicMethod = new MagicMethodGenerator($reflection, '__get', array('name')); + $magicMethod = new MagicMethodGenerator($reflection, '__get', ['name']); $this->assertFalse($magicMethod->returnsReference()); } diff --git a/tests/ProxyManagerTest/Generator/ParameterGeneratorTest.php b/tests/ProxyManagerTest/Generator/ParameterGeneratorTest.php index 40bc804e1..e20bb12f7 100644 --- a/tests/ProxyManagerTest/Generator/ParameterGeneratorTest.php +++ b/tests/ProxyManagerTest/Generator/ParameterGeneratorTest.php @@ -74,7 +74,7 @@ public function testVisitMethodWithCallable() } $parameter = new ParameterReflection( - array(CallableTypeHintClass::class, 'callableTypeHintMethod'), + [CallableTypeHintClass::class, 'callableTypeHintMethod'], 'parameter' ); @@ -86,10 +86,10 @@ public function testVisitMethodWithCallable() public function testReadsParameterDefaults() { $parameter = ParameterGenerator::fromReflection(new ParameterReflection( - array( + [ ClassWithMethodWithDefaultParameters::class, 'publicMethodWithDefaults' - ), + ], 'parameter' )); @@ -97,7 +97,7 @@ public function testReadsParameterDefaults() $defaultValue = $parameter->getDefaultValue(); $this->assertInstanceOf(ValueGenerator::class, $defaultValue); - $this->assertSame(array('foo'), $defaultValue->getValue()); + $this->assertSame(['foo'], $defaultValue->getValue()); $this->assertStringMatchesFormat('array%a$parameter%a=%aarray(\'foo\')', $parameter->generate()); } @@ -105,7 +105,7 @@ public function testReadsParameterDefaults() public function testReadsParameterTypeHint() { $parameter = ParameterGenerator::fromReflection(new ParameterReflection( - array(BaseClass::class, 'publicTypeHintedMethod'), + [BaseClass::class, 'publicTypeHintedMethod'], 'param' )); @@ -123,7 +123,7 @@ public function testGeneratesParameterPassedByReference() public function testGeneratesDefaultParameterForInternalPhpClasses() { - $parameter = ParameterGenerator::fromReflection(new ParameterReflection(array(Phar::class, 'compress'), 1)); + $parameter = ParameterGenerator::fromReflection(new ParameterReflection([Phar::class, 'compress'], 1)); $this->assertSame('null', strtolower((string) $parameter->getDefaultValue())); } diff --git a/tests/ProxyManagerTest/Generator/Util/UniqueIdentifierGeneratorTest.php b/tests/ProxyManagerTest/Generator/Util/UniqueIdentifierGeneratorTest.php index 5f4e8ec22..c37e1fbb6 100644 --- a/tests/ProxyManagerTest/Generator/Util/UniqueIdentifierGeneratorTest.php +++ b/tests/ProxyManagerTest/Generator/Util/UniqueIdentifierGeneratorTest.php @@ -64,14 +64,14 @@ public function testGeneratesValidIdentifiers($name) */ public function getBaseIdentifierNames() { - return array( - array(''), - array('1'), - array('foo'), - array('Foo'), - array('bar'), - array('Bar'), - array('foo_bar'), - ); + return [ + [''], + ['1'], + ['foo'], + ['Foo'], + ['bar'], + ['Bar'], + ['foo_bar'], + ]; } } diff --git a/tests/ProxyManagerTest/Inflector/ClassNameInflectorTest.php b/tests/ProxyManagerTest/Inflector/ClassNameInflectorTest.php index b95d7f203..f4ee6d35e 100644 --- a/tests/ProxyManagerTest/Inflector/ClassNameInflectorTest.php +++ b/tests/ProxyManagerTest/Inflector/ClassNameInflectorTest.php @@ -61,12 +61,12 @@ public function testGeneratesSameClassNameWithSameParameters() $this->assertSame($inflector->getProxyClassName('Foo\\Bar'), $inflector->getProxyClassName('Foo\\Bar')); $this->assertSame( - $inflector->getProxyClassName('Foo\\Bar', array('baz' => 'tab')), - $inflector->getProxyClassName('Foo\\Bar', array('baz' => 'tab')) + $inflector->getProxyClassName('Foo\\Bar', ['baz' => 'tab']), + $inflector->getProxyClassName('Foo\\Bar', ['baz' => 'tab']) ); $this->assertSame( - $inflector->getProxyClassName('Foo\\Bar', array('tab' => 'baz')), - $inflector->getProxyClassName('Foo\\Bar', array('tab' => 'baz')) + $inflector->getProxyClassName('Foo\\Bar', ['tab' => 'baz']), + $inflector->getProxyClassName('Foo\\Bar', ['tab' => 'baz']) ); } @@ -79,19 +79,19 @@ public function testGeneratesDifferentClassNameWithDifferentParameters() $this->assertNotSame( $inflector->getProxyClassName('Foo\\Bar'), - $inflector->getProxyClassName('Foo\\Bar', array('foo' => 'bar')) + $inflector->getProxyClassName('Foo\\Bar', ['foo' => 'bar']) ); $this->assertNotSame( - $inflector->getProxyClassName('Foo\\Bar', array('baz' => 'tab')), - $inflector->getProxyClassName('Foo\\Bar', array('tab' => 'baz')) + $inflector->getProxyClassName('Foo\\Bar', ['baz' => 'tab']), + $inflector->getProxyClassName('Foo\\Bar', ['tab' => 'baz']) ); $this->assertNotSame( - $inflector->getProxyClassName('Foo\\Bar', array('foo' => 'bar', 'tab' => 'baz')), - $inflector->getProxyClassName('Foo\\Bar', array('foo' => 'bar')) + $inflector->getProxyClassName('Foo\\Bar', ['foo' => 'bar', 'tab' => 'baz']), + $inflector->getProxyClassName('Foo\\Bar', ['foo' => 'bar']) ); $this->assertNotSame( - $inflector->getProxyClassName('Foo\\Bar', array('foo' => 'bar', 'tab' => 'baz')), - $inflector->getProxyClassName('Foo\\Bar', array('tab' => 'baz', 'foo' => 'bar')) + $inflector->getProxyClassName('Foo\\Bar', ['foo' => 'bar', 'tab' => 'baz']), + $inflector->getProxyClassName('Foo\\Bar', ['tab' => 'baz', 'foo' => 'bar']) ); } @@ -103,8 +103,8 @@ public function testGeneratesCorrectClassNameWhenGivenLeadingBackslash() $inflector = new ClassNameInflector('ProxyNS'); $this->assertSame( - $inflector->getProxyClassName('\\Foo\\Bar', array('tab' => 'baz')), - $inflector->getProxyClassName('Foo\\Bar', array('tab' => 'baz')) + $inflector->getProxyClassName('\\Foo\\Bar', ['tab' => 'baz']), + $inflector->getProxyClassName('Foo\\Bar', ['tab' => 'baz']) ); } @@ -134,10 +134,10 @@ public function testClassNameIsValidClassIdentifier($className, array $parameter */ public function getClassNames() { - return array( - array('Foo', 'ProxyNS\\' . ClassNameInflectorInterface::PROXY_MARKER . '\\Foo\\%s'), - array('Foo\\Bar', 'ProxyNS\\' . ClassNameInflectorInterface::PROXY_MARKER . '\\Foo\\Bar\\%s'), - ); + return [ + ['Foo', 'ProxyNS\\' . ClassNameInflectorInterface::PROXY_MARKER . '\\Foo\\%s'], + ['Foo\\Bar', 'ProxyNS\\' . ClassNameInflectorInterface::PROXY_MARKER . '\\Foo\\Bar\\%s'], + ]; } /** @@ -147,15 +147,15 @@ public function getClassNames() */ public function getClassAndParametersCombinations() { - return array( - array('Foo', array()), - array('Foo\\Bar', array()), - array('Foo', array(null)), - array('Foo\\Bar', array(null)), - array('Foo', array('foo' => 'bar')), - array('Foo\\Bar', array('foo' => 'bar')), - array('Foo', array("\0" => "very \0 bad")), - array('Foo\\Bar', array("\0" => "very \0 bad")), - ); + return [ + ['Foo', []], + ['Foo\\Bar', []], + ['Foo', [null]], + ['Foo\\Bar', [null]], + ['Foo', ['foo' => 'bar']], + ['Foo\\Bar', ['foo' => 'bar']], + ['Foo', ["\0" => "very \0 bad"]], + ['Foo\\Bar', ["\0" => "very \0 bad"]], + ]; } } diff --git a/tests/ProxyManagerTest/Inflector/Util/ParameterEncoderTest.php b/tests/ProxyManagerTest/Inflector/Util/ParameterEncoderTest.php index 1acd28e39..50be98917 100644 --- a/tests/ProxyManagerTest/Inflector/Util/ParameterEncoderTest.php +++ b/tests/ProxyManagerTest/Inflector/Util/ParameterEncoderTest.php @@ -52,15 +52,15 @@ public function testGeneratesValidClassName(array $parameters) */ public function getParameters() { - return array( - array(array()), - array(array('foo' => 'bar')), - array(array('bar' => 'baz')), - array(array(null)), - array(array(null, null)), - array(array('bar' => null)), - array(array('bar' => 12345)), - array(array('foo' => 'bar', 'bar' => 'baz')), - ); + return [ + [[]], + [['foo' => 'bar']], + [['bar' => 'baz']], + [[null]], + [[null, null]], + [['bar' => null]], + [['bar' => 12345]], + [['foo' => 'bar', 'bar' => 'baz']], + ]; } } diff --git a/tests/ProxyManagerTest/Inflector/Util/ParameterHasherTest.php b/tests/ProxyManagerTest/Inflector/Util/ParameterHasherTest.php index 22bf68d11..23a0edc02 100644 --- a/tests/ProxyManagerTest/Inflector/Util/ParameterHasherTest.php +++ b/tests/ProxyManagerTest/Inflector/Util/ParameterHasherTest.php @@ -48,15 +48,15 @@ public function testGeneratesValidClassName(array $parameters, $expectedHash) */ public function getParameters() { - return array( - array(array(), '40cd750bba9870f18aada2478b24840a'), - array(array('foo' => 'bar'), '49a3696adf0fbfacc12383a2d7400d51'), - array(array('bar' => 'baz'), '6ed41c8a63c1571554ecaeb998198757'), - array(array(null), '38017a839aaeb8ff1a658fce9af6edd3'), - array(array(null, null), '12051f9a58288e5328ad748881cc4e00'), - array(array('bar' => null), '0dbb112e1c4e6e4126232de2daa2d660'), - array(array('bar' => 12345), 'eb6291ea4973741bf9b6571f49b4ffd2'), - array(array('foo' => 'bar', 'bar' => 'baz'), '4447ff857f244d24c31bd84d7a855eda'), - ); + return [ + [[], '40cd750bba9870f18aada2478b24840a'], + [['foo' => 'bar'], '49a3696adf0fbfacc12383a2d7400d51'], + [['bar' => 'baz'], '6ed41c8a63c1571554ecaeb998198757'], + [[null], '38017a839aaeb8ff1a658fce9af6edd3'], + [[null, null], '12051f9a58288e5328ad748881cc4e00'], + [['bar' => null], '0dbb112e1c4e6e4126232de2daa2d660'], + [['bar' => 12345], 'eb6291ea4973741bf9b6571f49b4ffd2'], + [['foo' => 'bar', 'bar' => 'baz'], '4447ff857f244d24c31bd84d7a855eda'], + ]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/AbstractProxyGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/AbstractProxyGeneratorTest.php index e81cd6b0c..4f64dbe1b 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/AbstractProxyGeneratorTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/AbstractProxyGeneratorTest.php @@ -89,12 +89,12 @@ abstract protected function getExpectedImplementedInterfaces(); */ public function getTestedImplementations() { - return array( - array(BaseClass::class), - array(ClassWithMagicMethods::class), - array(ClassWithByRefMagicMethods::class), - array(ClassWithMixedProperties::class), - array(BaseInterface::class), - ); + return [ + [BaseClass::class], + [ClassWithMagicMethods::class], + [ClassWithByRefMagicMethods::class], + [ClassWithMixedProperties::class], + [BaseInterface::class], + ]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGeneratorTest.php index 6132463ca..fb3be69c1 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGeneratorTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGeneratorTest.php @@ -48,7 +48,7 @@ public function testInterceptorGenerator() $bar->expects($this->any())->method('getName')->will($this->returnValue('bar')); $baz->expects($this->any())->method('getName')->will($this->returnValue('baz')); $method->expects($this->any())->method('getName')->will($this->returnValue('fooMethod')); - $method->expects($this->any())->method('getParameters')->will($this->returnValue(array($bar, $baz))); + $method->expects($this->any())->method('getParameters')->will($this->returnValue([$bar, $baz])); $prefixInterceptors->expects($this->any())->method('getName')->will($this->returnValue('pre')); $suffixInterceptors->expects($this->any())->method('getName')->will($this->returnValue('post')); diff --git a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizerTest.php b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizerTest.php index c038d0c84..b6d3061b9 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizerTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorScopeLocalizerTest.php @@ -68,6 +68,6 @@ protected function getProxyGenerator() */ protected function getExpectedImplementedInterfaces() { - return array(AccessInterceptorInterface::class); + return [AccessInterceptorInterface::class]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGeneratorTest.php index ac7a09d7b..3bd5de81a 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGeneratorTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGeneratorTest.php @@ -49,7 +49,7 @@ public function testInterceptorGenerator() $bar->expects($this->any())->method('getName')->will($this->returnValue('bar')); $baz->expects($this->any())->method('getName')->will($this->returnValue('baz')); $method->expects($this->any())->method('getName')->will($this->returnValue('fooMethod')); - $method->expects($this->any())->method('getParameters')->will($this->returnValue(array($bar, $baz))); + $method->expects($this->any())->method('getParameters')->will($this->returnValue([$bar, $baz])); $valueHolder->expects($this->any())->method('getName')->will($this->returnValue('foo')); $prefixInterceptors->expects($this->any())->method('getName')->will($this->returnValue('pre')); $suffixInterceptors->expects($this->any())->method('getName')->will($this->returnValue('post')); diff --git a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolderTest.php b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolderTest.php index e3965c516..8cbfeedba 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolderTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/AccessInterceptorValueHolderTest.php @@ -46,9 +46,9 @@ protected function getProxyGenerator() */ protected function getExpectedImplementedInterfaces() { - return array( + return [ AccessInterceptorInterface::class, ValueHolderInterface::class, - ); + ]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/Assertion/CanProxyAssertionTest.php b/tests/ProxyManagerTest/ProxyGenerator/Assertion/CanProxyAssertionTest.php index 09cfda3fd..fe34b6603 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/Assertion/CanProxyAssertionTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/Assertion/CanProxyAssertionTest.php @@ -92,25 +92,25 @@ public function testDisallowsConstructor() */ public function validClasses() { - return array( - array('ProxyManagerTestAsset\AccessInterceptorValueHolderMock'), - array('ProxyManagerTestAsset\BaseClass'), - array('ProxyManagerTestAsset\BaseInterface'), - array('ProxyManagerTestAsset\CallableTypeHintClass'), - array('ProxyManagerTestAsset\ClassWithByRefMagicMethods'), - array('ProxyManagerTestAsset\ClassWithFinalMagicMethods'), - array('ProxyManagerTestAsset\ClassWithFinalMethods'), - array('ProxyManagerTestAsset\ClassWithMethodWithDefaultParameters'), - array('ProxyManagerTestAsset\ClassWithMixedProperties'), - array('ProxyManagerTestAsset\ClassWithPrivateProperties'), - array('ProxyManagerTestAsset\ClassWithProtectedProperties'), - array('ProxyManagerTestAsset\ClassWithPublicProperties'), - array('ProxyManagerTestAsset\ClassWithPublicArrayProperty'), - array('ProxyManagerTestAsset\ClassWithSelfHint'), - array('ProxyManagerTestAsset\EmptyClass'), - array('ProxyManagerTestAsset\HydratedObject'), - array('ProxyManagerTestAsset\LazyLoadingMock'), - array('ProxyManagerTestAsset\NullObjectMock'), - ); + return [ + ['ProxyManagerTestAsset\AccessInterceptorValueHolderMock'], + ['ProxyManagerTestAsset\BaseClass'], + ['ProxyManagerTestAsset\BaseInterface'], + ['ProxyManagerTestAsset\CallableTypeHintClass'], + ['ProxyManagerTestAsset\ClassWithByRefMagicMethods'], + ['ProxyManagerTestAsset\ClassWithFinalMagicMethods'], + ['ProxyManagerTestAsset\ClassWithFinalMethods'], + ['ProxyManagerTestAsset\ClassWithMethodWithDefaultParameters'], + ['ProxyManagerTestAsset\ClassWithMixedProperties'], + ['ProxyManagerTestAsset\ClassWithPrivateProperties'], + ['ProxyManagerTestAsset\ClassWithProtectedProperties'], + ['ProxyManagerTestAsset\ClassWithPublicProperties'], + ['ProxyManagerTestAsset\ClassWithPublicArrayProperty'], + ['ProxyManagerTestAsset\ClassWithSelfHint'], + ['ProxyManagerTestAsset\EmptyClass'], + ['ProxyManagerTestAsset\HydratedObject'], + ['ProxyManagerTestAsset\LazyLoadingMock'], + ['ProxyManagerTestAsset\NullObjectMock'], + ]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingGhostGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingGhostGeneratorTest.php index d1832e73e..b8a69bb57 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingGhostGeneratorTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingGhostGeneratorTest.php @@ -45,6 +45,6 @@ protected function getProxyGenerator() */ protected function getExpectedImplementedInterfaces() { - return array(GhostObjectInterface::class); + return [GhostObjectInterface::class]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingValueHolderGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingValueHolderGeneratorTest.php index b7c14a76e..151201795 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingValueHolderGeneratorTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/LazyLoadingValueHolderGeneratorTest.php @@ -45,6 +45,6 @@ protected function getProxyGenerator() */ protected function getExpectedImplementedInterfaces() { - return array(VirtualProxyInterface::class); + return [VirtualProxyInterface::class]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/NullObjectGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/NullObjectGeneratorTest.php index 048b7f592..5f272bfab 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/NullObjectGeneratorTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/NullObjectGeneratorTest.php @@ -80,7 +80,7 @@ public function testGeneratesValidCode($className) foreach ($generatedReflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { if (! ($method->getNumberOfParameters() || $method->isStatic())) { - $this->assertNull(call_user_func(array($proxyGenerated, $method->getName()))); + $this->assertNull(call_user_func([$proxyGenerated, $method->getName()])); } } } @@ -98,9 +98,9 @@ protected function getProxyGenerator() */ protected function getExpectedImplementedInterfaces() { - return array( + return [ NullObjectInterface::class, - ); + ]; } /** @@ -108,12 +108,12 @@ protected function getExpectedImplementedInterfaces() */ public function getTestedImplementations() { - return array( - array(BaseClass::class), - array(ClassWithMagicMethods::class), - array(ClassWithByRefMagicMethods::class), - array(ClassWithMixedProperties::class), - array(BaseInterface::class), - ); + return [ + [BaseClass::class], + [ClassWithMagicMethods::class], + [ClassWithByRefMagicMethods::class], + [ClassWithMixedProperties::class], + [BaseInterface::class], + ]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/PropertyGenerator/PublicPropertiesDefaultsTest.php b/tests/ProxyManagerTest/ProxyGenerator/PropertyGenerator/PublicPropertiesDefaultsTest.php index bbbfe4f67..761b1898d 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/PropertyGenerator/PublicPropertiesDefaultsTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/PropertyGenerator/PublicPropertiesDefaultsTest.php @@ -66,7 +66,7 @@ public function testBaseClass() $this->assertInternalType('array', $publicProperties->getDefaultValue()->getValue()); $this->assertSame( - array('publicProperty' => 'publicPropertyDefault'), + ['publicProperty' => 'publicPropertyDefault'], $publicProperties->getDefaultValue()->getValue() ); $this->assertTrue($publicProperties->isStatic()); diff --git a/tests/ProxyManagerTest/ProxyGenerator/RemoteObjectGeneratorTest.php b/tests/ProxyManagerTest/ProxyGenerator/RemoteObjectGeneratorTest.php index 79d29f44a..06be30c9a 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/RemoteObjectGeneratorTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/RemoteObjectGeneratorTest.php @@ -88,9 +88,9 @@ protected function getProxyGenerator() */ protected function getExpectedImplementedInterfaces() { - return array( + return [ RemoteObjectInterface::class, - ); + ]; } /** @@ -98,12 +98,12 @@ protected function getExpectedImplementedInterfaces() */ public function getTestedImplementations() { - return array( - array(BaseClass::class), - array(ClassWithMagicMethods::class), - array(ClassWithByRefMagicMethods::class), - array(ClassWithMixedProperties::class), - array(BaseInterface::class), - ); + return [ + [BaseClass::class], + [ClassWithMagicMethods::class], + [ClassWithByRefMagicMethods::class], + [ClassWithMixedProperties::class], + [BaseInterface::class], + ]; } } diff --git a/tests/ProxyManagerTest/ProxyGenerator/Util/ProxiedMethodsFilterTest.php b/tests/ProxyManagerTest/ProxyGenerator/Util/ProxiedMethodsFilterTest.php index 4fbbafdbd..00ccbaaa6 100644 --- a/tests/ProxyManagerTest/ProxyGenerator/Util/ProxiedMethodsFilterTest.php +++ b/tests/ProxyManagerTest/ProxyGenerator/Util/ProxiedMethodsFilterTest.php @@ -71,48 +71,48 @@ function (ReflectionMethod $method) { */ public function expectedMethods() { - return array( - array( + return [ + [ new ReflectionClass(BaseClass::class), null, - array( + [ 'publicArrayHintedMethod', 'publicByReferenceMethod', 'publicByReferenceParameterMethod', 'publicMethod', 'publicTypeHintedMethod', - ), - ), - array( + ], + ], + [ new ReflectionClass(EmptyClass::class), null, - array(), - ), - array( + [], + ], + [ new ReflectionClass(LazyLoadingMock::class), null, - array(), - ), - array( + [], + ], + [ new ReflectionClass(LazyLoadingMock::class), - array(), - array(), - ), - array( + [], + [], + ], + [ new ReflectionClass(HydratedObject::class), - array('doFoo'), - array('__get'), - ), - array( + ['doFoo'], + ['__get'], + ], + [ new ReflectionClass(HydratedObject::class), - array('Dofoo'), - array('__get'), - ), - array( + ['Dofoo'], + ['__get'], + ], + [ new ReflectionClass(HydratedObject::class), - array(), - array('doFoo', '__get'), - ), - ); + [], + ['doFoo', '__get'], + ], + ]; } } diff --git a/tests/ProxyManagerTest/Signature/ClassSignatureGeneratorTest.php b/tests/ProxyManagerTest/Signature/ClassSignatureGeneratorTest.php index f34a93dd1..1f84343da 100644 --- a/tests/ProxyManagerTest/Signature/ClassSignatureGeneratorTest.php +++ b/tests/ProxyManagerTest/Signature/ClassSignatureGeneratorTest.php @@ -73,16 +73,16 @@ public function testAddSignature() ->signatureGenerator ->expects($this->any()) ->method('generateSignature') - ->with(array('foo' => 'bar')) + ->with(['foo' => 'bar']) ->will($this->returnValue('valid-signature')); $this ->signatureGenerator ->expects($this->any()) ->method('generateSignatureKey') - ->with(array('foo' => 'bar')) + ->with(['foo' => 'bar']) ->will($this->returnValue('PropertyName')); - $this->classSignatureGenerator->addSignature($classGenerator, array('foo' => 'bar')); + $this->classSignatureGenerator->addSignature($classGenerator, ['foo' => 'bar']); } } diff --git a/tests/ProxyManagerTest/Signature/Exception/InvalidSignatureExceptionTest.php b/tests/ProxyManagerTest/Signature/Exception/InvalidSignatureExceptionTest.php index d587fc071..d7455c5fa 100644 --- a/tests/ProxyManagerTest/Signature/Exception/InvalidSignatureExceptionTest.php +++ b/tests/ProxyManagerTest/Signature/Exception/InvalidSignatureExceptionTest.php @@ -37,7 +37,7 @@ public function testFromInvalidSignature() { $exception = InvalidSignatureException::fromInvalidSignature( new ReflectionClass(__CLASS__), - array('foo' => 'bar', 'baz' => 'tab'), + ['foo' => 'bar', 'baz' => 'tab'], 'blah', 'expected-signature' ); diff --git a/tests/ProxyManagerTest/Signature/Exception/MissingSignatureExceptionTest.php b/tests/ProxyManagerTest/Signature/Exception/MissingSignatureExceptionTest.php index 2d8a0d8bb..4c7de8314 100644 --- a/tests/ProxyManagerTest/Signature/Exception/MissingSignatureExceptionTest.php +++ b/tests/ProxyManagerTest/Signature/Exception/MissingSignatureExceptionTest.php @@ -37,7 +37,7 @@ public function testFromMissingSignature() { $exception = MissingSignatureException::fromMissingSignature( new ReflectionClass(__CLASS__), - array('foo' => 'bar', 'baz' => 'tab'), + ['foo' => 'bar', 'baz' => 'tab'], 'expected-signature' ); diff --git a/tests/ProxyManagerTest/Signature/SignatureCheckerTest.php b/tests/ProxyManagerTest/Signature/SignatureCheckerTest.php index 0fa13f9c6..474885479 100644 --- a/tests/ProxyManagerTest/Signature/SignatureCheckerTest.php +++ b/tests/ProxyManagerTest/Signature/SignatureCheckerTest.php @@ -63,16 +63,16 @@ public function testCheckSignatureWithValidKey() ->signatureGenerator ->expects($this->atLeastOnce()) ->method('generateSignatureKey') - ->with(array('foo' => 'bar')) + ->with(['foo' => 'bar']) ->will($this->returnValue('Example')); $this ->signatureGenerator ->expects($this->atLeastOnce()) ->method('generateSignature') - ->with(array('foo' => 'bar')) + ->with(['foo' => 'bar']) ->will($this->returnValue('valid-signature')); - $this->signatureChecker->checkSignature(new ReflectionClass($this), array('foo' => 'bar')); + $this->signatureChecker->checkSignature(new ReflectionClass($this), ['foo' => 'bar']); } public function testCheckSignatureWithInvalidKey() @@ -81,18 +81,18 @@ public function testCheckSignatureWithInvalidKey() ->signatureGenerator ->expects($this->any()) ->method('generateSignatureKey') - ->with(array('foo' => 'bar')) + ->with(['foo' => 'bar']) ->will($this->returnValue('InvalidKey')); $this ->signatureGenerator ->expects($this->any()) ->method('generateSignature') - ->with(array('foo' => 'bar')) + ->with(['foo' => 'bar']) ->will($this->returnValue('valid-signature')); $this->setExpectedException('ProxyManager\Signature\Exception\MissingSignatureException'); - $this->signatureChecker->checkSignature(new ReflectionClass($this), array('foo' => 'bar')); + $this->signatureChecker->checkSignature(new ReflectionClass($this), ['foo' => 'bar']); } public function testCheckSignatureWithInvalidValue() @@ -101,17 +101,17 @@ public function testCheckSignatureWithInvalidValue() ->signatureGenerator ->expects($this->any()) ->method('generateSignatureKey') - ->with(array('foo' => 'bar')) + ->with(['foo' => 'bar']) ->will($this->returnValue('Example')); $this ->signatureGenerator ->expects($this->any()) ->method('generateSignature') - ->with(array('foo' => 'bar')) + ->with(['foo' => 'bar']) ->will($this->returnValue('invalid-signature')); $this->setExpectedException('ProxyManager\Signature\Exception\InvalidSignatureException'); - $this->signatureChecker->checkSignature(new ReflectionClass($this), array('foo' => 'bar')); + $this->signatureChecker->checkSignature(new ReflectionClass($this), ['foo' => 'bar']); } } diff --git a/tests/ProxyManagerTest/Signature/SignatureGeneratorTest.php b/tests/ProxyManagerTest/Signature/SignatureGeneratorTest.php index 5ad93d68b..dd1d1a8f1 100644 --- a/tests/ProxyManagerTest/Signature/SignatureGeneratorTest.php +++ b/tests/ProxyManagerTest/Signature/SignatureGeneratorTest.php @@ -74,28 +74,28 @@ public function testGenerateSignatureKey(array $parameters, $expected) */ public function signatures() { - return array( - array( - array(), + return [ + [ + [], 'YTowOnt9' - ), - array( - array('foo' => 'bar'), + ], + [ + ['foo' => 'bar'], 'YToxOntzOjM6ImZvbyI7czozOiJiYXIiO30=' - ), - array( - array('foo' => 'bar', 'baz' => 'tab'), + ], + [ + ['foo' => 'bar', 'baz' => 'tab'], 'YToyOntzOjM6ImZvbyI7czozOiJiYXIiO3M6MzoiYmF6IjtzOjM6InRhYiI7fQ==' - ), - array( - array('bar'), + ], + [ + ['bar'], 'YToxOntpOjA7czozOiJiYXIiO30=' - ), - array( - array('bar', 'baz'), + ], + [ + ['bar', 'baz'], 'YToyOntpOjA7czozOiJiYXIiO2k6MTtzOjM6ImJheiI7fQ==' - ), - ); + ], + ]; } /** @@ -105,12 +105,12 @@ public function signatures() */ public function signatureKeys() { - return array( - array(array(), '40cd750bba9870f18aada2478b24840a'), - array(array('foo' => 'bar'), '49a3696adf0fbfacc12383a2d7400d51'), - array(array('foo' => 'bar', 'baz' => 'tab'), '3f3cabbf33bae82b0711205c913a8fa0'), - array(array('bar'), '6fc5f617053f53f56b4734453ec86daa'), - array(array('bar', 'baz'), 'b9f31192ffbb4aa958cd1c5f88540c1e'), - ); + return [ + [[], '40cd750bba9870f18aada2478b24840a'], + [['foo' => 'bar'], '49a3696adf0fbfacc12383a2d7400d51'], + [['foo' => 'bar', 'baz' => 'tab'], '3f3cabbf33bae82b0711205c913a8fa0'], + [['bar'], '6fc5f617053f53f56b4734453ec86daa'], + [['bar', 'baz'], 'b9f31192ffbb4aa958cd1c5f88540c1e'], + ]; } } diff --git a/tests/ProxyManagerTestAsset/ClassWithByRefMagicMethods.php b/tests/ProxyManagerTestAsset/ClassWithByRefMagicMethods.php index 6f0ab5d2e..e04633ed1 100644 --- a/tests/ProxyManagerTestAsset/ClassWithByRefMagicMethods.php +++ b/tests/ProxyManagerTestAsset/ClassWithByRefMagicMethods.php @@ -31,7 +31,7 @@ class ClassWithByRefMagicMethods */ public function & __set($name, $value) { - return array($name => $value); + return [$name => $value]; } /** diff --git a/tests/ProxyManagerTestAsset/ClassWithFinalMagicMethods.php b/tests/ProxyManagerTestAsset/ClassWithFinalMagicMethods.php index d42204b77..270bd32e0 100644 --- a/tests/ProxyManagerTestAsset/ClassWithFinalMagicMethods.php +++ b/tests/ProxyManagerTestAsset/ClassWithFinalMagicMethods.php @@ -38,7 +38,7 @@ final public function __construct() */ final public function __set($name, $value) { - return array($name => $value); + return [$name => $value]; } /** diff --git a/tests/ProxyManagerTestAsset/ClassWithMagicMethods.php b/tests/ProxyManagerTestAsset/ClassWithMagicMethods.php index 2bd26e50a..acc7af320 100644 --- a/tests/ProxyManagerTestAsset/ClassWithMagicMethods.php +++ b/tests/ProxyManagerTestAsset/ClassWithMagicMethods.php @@ -31,7 +31,7 @@ class ClassWithMagicMethods */ public function __set($name, $value) { - return array($name => $value); + return [$name => $value]; } /** diff --git a/tests/ProxyManagerTestAsset/ClassWithMethodWithDefaultParameters.php b/tests/ProxyManagerTestAsset/ClassWithMethodWithDefaultParameters.php index fa6134a3f..8897d37b6 100644 --- a/tests/ProxyManagerTestAsset/ClassWithMethodWithDefaultParameters.php +++ b/tests/ProxyManagerTestAsset/ClassWithMethodWithDefaultParameters.php @@ -31,7 +31,7 @@ class ClassWithMethodWithDefaultParameters * * @return string */ - public function publicMethodWithDefaults(array $parameter = array('foo')) + public function publicMethodWithDefaults(array $parameter = ['foo']) { return 'defaultValue'; } diff --git a/tests/ProxyManagerTestAsset/ClassWithPublicArrayProperty.php b/tests/ProxyManagerTestAsset/ClassWithPublicArrayProperty.php index af68ceb3e..a20f994b0 100644 --- a/tests/ProxyManagerTestAsset/ClassWithPublicArrayProperty.php +++ b/tests/ProxyManagerTestAsset/ClassWithPublicArrayProperty.php @@ -27,5 +27,5 @@ */ class ClassWithPublicArrayProperty { - public $arrayProperty = array(); + public $arrayProperty = []; }