2012-10-30 20 views
5

Bu yüzden bu sınıf var yakınır:Yöntem beyanı uyumludur ama PHP

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){} 
} 

ve bu SplObjectStorage geçerli:

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

onlar aynıdır görebileceğiniz gibi ama JSObjectSTorage örneğini zaman Ben aşağıdaki hatayı alıyorum:

Ve bu removeAll() ve removeAllExcept() için olur.

Herhangi bir fikiriniz var mı ?!


kullanıyorum.

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 
+2

Hangi PHP sürümünü kullanıyorsunuz? Sadece 5.4.8 ile çalıştı ve kodunuz gayet iyi çalışıyor. – Roberto

+1

Bunun da 'removeAll()' yöntemi ile gerçekleşmediğinden emin misiniz? Eğer öyleyse, parametrelerin neden olabileceğine dair bir ipucu verdiğinden şüphelenirim - belki de PHP sürümünüzle uyumsuzluk olsa da emin değilim. – inhan

+0

@inhan Evet, soruda belirtildiği gibi bu da removeAll() ve removeAllExcept() ile olur. Tür ipucunu kaldırmak sorunu çözmez. – Tivie

cevap