Vì vậy, tôi có lớp học này:khai Phương pháp tương thích nhưng PHP phàn nàn
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){}
}
và đây là SplObjectStorage:
http://php.net/manual/en/class.splobjectstorage.php
Như bạn có thể thấy chúng giống nhau nhưng khi tôi nhanh chóng JSObjectSTorage , Tôi nhận được lỗi sau:
Strict standards: Declaration of MOWAFW\Core\Type\JavaScript\JSObjectStorage::addAll() should be compatible with that of SplObjectStorage::addAll() in /Users/**/JSObjectStorage.php on line 175
Và điều này xảy ra với removeAll() và removeAllExcept().
Bất kỳ ý tưởng nào ?!
Tôi đang sử dụng:
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
Bạn đang sử dụng phiên bản PHP nào? Chỉ cần thử với 5.4.8 và mã của bạn hoạt động tốt. – Roberto
Bạn có chắc chắn điều này không xảy ra với phương thức 'removeAll()' không? Nếu có, sau đó tôi sẽ nghi ngờ loại gợi ý cho các thông số có thể gây ra nó - có thể là một không tương thích với phiên bản PHP của bạn, không chắc chắn mặc dù. – inhan
@inhan Có, như tôi đã nêu trong câu hỏi, điều này cũng xảy ra với removeAll() và removeAllExcept(). Loại bỏ gợi ý loại không khắc phục được sự cố. – Tivie