This should help fix the following issues that various repos
are getting from Phan as of late:
> Call with 5 arg(s) to \BagOStuff::makeKey() which only takes 2 arg(s)
> defined at ../../includes/libs/objectcache/BagOStuff.php:456
> <source="PhanParamTooMany"/>
Bug: T228563
Depends-On: I5cfba063821101325a5a7359e6b8ad71a0fb1b2f
Depends-On: Ifa5b96735376f2fbe3680799f960616ba8d357ff
Change-Id: Ic9df7f3ad7f356c7cbdfe1edfbe35821b931dda6
12 files changed:
*
* @since 1.27
* @param string $class Key class
*
* @since 1.27
* @param string $class Key class
- * @param string|null $component [optional] Key component (starting with a key collection name)
- * @return string Colon-delimited list of $keyspace followed by escaped components of $args
+ * @param string ...$components Key components (starting with a key collection name)
+ * @return string Colon-delimited list of $keyspace followed by escaped components
- abstract public function makeGlobalKey( $class, $component = null );
+ abstract public function makeGlobalKey( $class, ...$components );
/**
* Make a cache key, scoped to this instance's keyspace.
*
* @since 1.27
* @param string $class Key class
/**
* Make a cache key, scoped to this instance's keyspace.
*
* @since 1.27
* @param string $class Key class
- * @param string|null $component [optional] Key component (starting with a key collection name)
- * @return string Colon-delimited list of $keyspace followed by escaped components of $args
+ * @param string ...$components Key components (starting with a key collection name)
+ * @return string Colon-delimited list of $keyspace followed by escaped components
- abstract public function makeKey( $class, $component = null );
+ abstract public function makeKey( $class, ...$components );
/**
* @param int $flag ATTR_* class constant
/**
* @param int $flag ATTR_* class constant
}
public function makeKeyInternal( $keyspace, $args ) {
}
public function makeKeyInternal( $keyspace, $args ) {
- return $this->backend->makeKeyInternal( ...func_get_args() );
+ return $this->backend->makeKeyInternal( $keyspace, $args );
- public function makeKey( $class, $component = null ) {
- return $this->backend->makeKey( ...func_get_args() );
+ public function makeKey( $class, ...$components ) {
+ return $this->backend->makeKey( $class, ...$components );
- public function makeGlobalKey( $class, $component = null ) {
- return $this->backend->makeGlobalKey( ...func_get_args() );
+ public function makeGlobalKey( $class, ...$components ) {
+ return $this->backend->makeGlobalKey( $class, ...$components );
}
public function getLastError() {
}
public function getLastError() {
* Make a global cache key.
*
* @param string $class Key class
* Make a global cache key.
*
* @param string $class Key class
- * @param string|null $component [optional] Key component (starting with a key collection name)
- * @return string Colon-delimited list of $keyspace followed by escaped components of $args
+ * @param string ...$components Key components (starting with a key collection name)
+ * @return string Colon-delimited list of $keyspace followed by escaped components
- public function makeGlobalKey( $class, $component = null );
+ public function makeGlobalKey( $class, ...$components );
/**
* Make a cache key, scoped to this instance's keyspace.
*
* @param string $class Key class
/**
* Make a cache key, scoped to this instance's keyspace.
*
* @param string $class Key class
- * @param string|null $component [optional] Key component (starting with a key collection name)
- * @return string Colon-delimited list of $keyspace followed by escaped components of $args
+ * @param string ...$components Key components (starting with a key collection name)
+ * @return string Colon-delimited list of $keyspace followed by escaped components
- public function makeKey( $class, $component = null );
+ public function makeKey( $class, ...$components );
* Make a global cache key.
*
* @param string $class Key class
* Make a global cache key.
*
* @param string $class Key class
- * @param string|null $component [optional] Key component (starting with a key collection name)
- * @return string Colon-delimited list of $keyspace followed by escaped components of $args
+ * @param string ...$components Key components (starting with a key collection name)
+ * @return string Colon-delimited list of $keyspace followed by escaped components
- public function makeGlobalKey( $class, $component = null ) {
+ public function makeGlobalKey( $class, ...$components ) {
return $this->makeKeyInternal( 'global', func_get_args() );
}
return $this->makeKeyInternal( 'global', func_get_args() );
}
* Make a cache key, scoped to this instance's keyspace.
*
* @param string $class Key class
* Make a cache key, scoped to this instance's keyspace.
*
* @param string $class Key class
- * @param string|null $component [optional] Key component (starting with a key collection name)
- * @return string Colon-delimited list of $keyspace followed by escaped components of $args
+ * @param string ...$components Key components (starting with a key collection name)
+ * @return string Colon-delimited list of $keyspace followed by escaped components
- public function makeKey( $class, $component = null ) {
+ public function makeKey( $class, ...$components ) {
return $this->makeKeyInternal( $this->keyspace, func_get_args() );
}
return $this->makeKeyInternal( $this->keyspace, func_get_args() );
}
}
public function makeKeyInternal( $keyspace, $args ) {
}
public function makeKeyInternal( $keyspace, $args ) {
- return $this->caches[0]->makeKeyInternal( ...func_get_args() );
+ return $this->caches[0]->makeKeyInternal( $keyspace, $args );
- public function makeKey( $class, $component = null ) {
+ public function makeKey( $class, ...$components ) {
return $this->caches[0]->makeKey( ...func_get_args() );
}
return $this->caches[0]->makeKey( ...func_get_args() );
}
- public function makeGlobalKey( $class, $component = null ) {
+ public function makeGlobalKey( $class, ...$components ) {
return $this->caches[0]->makeGlobalKey( ...func_get_args() );
}
return $this->caches[0]->makeGlobalKey( ...func_get_args() );
}
return $this->writeStore->makeKeyInternal( ...func_get_args() );
}
return $this->writeStore->makeKeyInternal( ...func_get_args() );
}
- public function makeKey( $class, $component = null ) {
+ public function makeKey( $class, ...$components ) {
return $this->writeStore->makeKey( ...func_get_args() );
}
return $this->writeStore->makeKey( ...func_get_args() );
}
- public function makeGlobalKey( $class, $component = null ) {
+ public function makeGlobalKey( $class, ...$components ) {
return $this->writeStore->makeGlobalKey( ...func_get_args() );
}
return $this->writeStore->makeGlobalKey( ...func_get_args() );
}
/**
* @see BagOStuff::makeKey()
* @param string $class Key class
/**
* @see BagOStuff::makeKey()
* @param string $class Key class
- * @param string|null $component [optional] Key component (starting with a key collection name)
- * @return string Colon-delimited list of $keyspace followed by escaped components of $args
+ * @param string ...$components Key components (starting with a key collection name)
+ * @return string Colon-delimited list of $keyspace followed by escaped components
- public function makeKey( $class, $component = null ) {
+ public function makeKey( $class, ...$components ) {
return $this->cache->makeKey( ...func_get_args() );
}
/**
* @see BagOStuff::makeGlobalKey()
* @param string $class Key class
return $this->cache->makeKey( ...func_get_args() );
}
/**
* @see BagOStuff::makeGlobalKey()
* @param string $class Key class
- * @param string|null $component [optional] Key component (starting with a key collection name)
- * @return string Colon-delimited list of $keyspace followed by escaped components of $args
+ * @param string ...$components Key components (starting with a key collection name)
+ * @return string Colon-delimited list of $keyspace followed by escaped components
- public function makeGlobalKey( $class, $component = null ) {
+ public function makeGlobalKey( $class, ...$components ) {
return $this->cache->makeGlobalKey( ...func_get_args() );
}
return $this->cache->makeGlobalKey( ...func_get_args() );
}
* @covers CachedBagOStuff::makeKey
*/
public function testMakeKey() {
* @covers CachedBagOStuff::makeKey
*/
public function testMakeKey() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ // This works fine on HHVM (and verified by integration tests), but due to
+ // a bug in HHVM's Reflection, PHPUnit 4 fails to create a mock (T228563)
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeKey' ] )
->getMock();
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeKey' ] )
->getMock();
* @covers CachedBagOStuff::makeGlobalKey
*/
public function testMakeGlobalKey() {
* @covers CachedBagOStuff::makeGlobalKey
*/
public function testMakeGlobalKey() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeGlobalKey' ] )
->getMock();
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeGlobalKey' ] )
->getMock();
* @covers MultiWriteBagOStuff::makeKey
*/
public function testMakeKey() {
* @covers MultiWriteBagOStuff::makeKey
*/
public function testMakeKey() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$cache1 = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeKey' ] )->getMock();
$cache1->expects( $this->once() )->method( 'makeKey' )
$cache1 = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeKey' ] )->getMock();
$cache1->expects( $this->once() )->method( 'makeKey' )
* @covers MultiWriteBagOStuff::makeGlobalKey
*/
public function testMakeGlobalKey() {
* @covers MultiWriteBagOStuff::makeGlobalKey
*/
public function testMakeGlobalKey() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$cache1 = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeGlobalKey' ] )->getMock();
$cache1->expects( $this->once() )->method( 'makeGlobalKey' )
$cache1 = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeGlobalKey' ] )->getMock();
$cache1->expects( $this->once() )->method( 'makeGlobalKey' )
* @covers WANObjectCache::makeKey
*/
public function testMakeKey() {
* @covers WANObjectCache::makeKey
*/
public function testMakeKey() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeKey' ] )->getMock();
$backend->expects( $this->once() )->method( 'makeKey' )
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeKey' ] )->getMock();
$backend->expects( $this->once() )->method( 'makeKey' )
* @covers WANObjectCache::makeGlobalKey
*/
public function testMakeGlobalKey() {
* @covers WANObjectCache::makeGlobalKey
*/
public function testMakeGlobalKey() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeGlobalKey' ] )->getMock();
$backend->expects( $this->once() )->method( 'makeGlobalKey' )
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeGlobalKey' ] )->getMock();
$backend->expects( $this->once() )->method( 'makeGlobalKey' )
* @return PHPUnit_Framework_MockObject_MockObject|HashBagOStuff
*/
private function getMockCache() {
* @return PHPUnit_Framework_MockObject_MockObject|HashBagOStuff
*/
private function getMockCache() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$mock = $this->getMockBuilder( HashBagOStuff::class )
->disableOriginalConstructor()
->setMethods( [ 'get', 'set', 'delete', 'makeKey' ] )
$mock = $this->getMockBuilder( HashBagOStuff::class )
->disableOriginalConstructor()
->setMethods( [ 'get', 'set', 'delete', 'makeKey' ] )
protected function setUp() {
parent::setUp();
protected function setUp() {
parent::setUp();
+
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$cache = $this->getMockBuilder( RedisBagOStuff::class )
->disableOriginalConstructor()
->getMock();
$cache = $this->getMockBuilder( RedisBagOStuff::class )
->disableOriginalConstructor()
->getMock();