方法声明兼容,但PHP抱怨

Tiv*_*vie 5 php splobjectstorage

所以我有这门课:

class JSObjectStorage extends \SplObjectStorage
{

    /**Adds a JavaScript object inside the storage, and optionally associate it to some data.*/    
    public function attach($javaScript, $data = null){}

    /**Removes the object from the storage.*/
    public function detach($javaScript){}

    /**Adds all objects-data pairs from a different JavaScriptBundle storage in the current storage.*/
    public function addAll(\SplObjectStorage $storage){}

    /**Removes objects contained in another storage from the current storage.*/
    public function removeAll(\SplObjectStorage $storage){}

    /**Removes all objects except for those contained in another storage from the current storage.*/
    public function removeAllExcept(\SplObjectStorage $storage){}

    /**Alias to JSObjectStorage::attach. */    
    public function offsetSet($javaScript, $data = null){}

    /**Alias to JSObjectStorage::detach*/
    public function offsetUnset($javaScript){}

    /**Returns the data associated with an object in the storage.*/
    public function offsetGet($javaScript){}

    /**This method calculates an identifier for the objects added to JSObjectStorage object.*/
    public function getHash($javaScript){}
}
Run Code Online (Sandbox Code Playgroud)

这是SplObjectStorage:

http://php.net/manual/en/class.splobjectstorage.php

如您所见,它们是相同的,但是当我实例化JSObjectSTorage时,我收到以下错误:

严格的标准:MOWAFW\Core\Type\JavaScript\JSObjectStorage :: addAll()的声明应该与第175行的/ Users/** /JSObjectStorage.php 中的SplObjectStorage :: addAll()的声明兼容

这恰好是removeAll()和removeAllExcept().

有任何想法吗?!


我正在使用:

PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb 20 2012 22:55:53) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
Run Code Online (Sandbox Code Playgroud)

inh*_*han 3

有人发布了一个错误报告,标题为“命名空间接口由于类型提示问题而无法工作”(错误#40653),尽管 PHP 版本存在差异,但它看起来像您的情况(它显示为v. < 5.3.7)。