così ho questa classe:dichiarazione di metodo è compatibile, ma PHP lamenta
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){}
}
e questa è la SplObjectStorage:
http://php.net/manual/en/class.splobjectstorage.php
Come potete vedere sono identiche, ma quando ho un'istanza di JSObjectSTorage , Ho il seguente errore:
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
E questo succede a removeAll() e removeAllExcept().
Qualche idea ?!
sto usando:
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
Quale versione di PHP stai usando? Ho appena provato con 5.4.8 e il tuo codice funziona bene. – Roberto
Sei sicuro che questo non si verifichi anche con il metodo 'removeAll()'? Se lo fa, allora sospetto che il tipo di suggerimento per i parametri potrebbe causarlo - forse un'incompatibilità con la tua versione di PHP, non è sicuro però. – inhan
@inhan Sì, come ho affermato nella domanda questo accade anche con removeAll() e removeAllExcept(). La rimozione del suggerimento sul tipo non risolve il problema. – Tivie