for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tests\Wikibase\DataModel\Serializers;
use Serializers\Serializer;
use Wikibase\DataModel\Reference;
use Wikibase\DataModel\ReferenceList;
use Wikibase\DataModel\Serializers\ReferenceListSerializer;
use Wikibase\DataModel\Snak\PropertyNoValueSnak;
/**
* @covers Wikibase\DataModel\Serializers\ReferenceListSerializer
*
* @license GPL-2.0-or-later
* @author Thomas Pellissier Tanon
*/
class ReferenceListSerializerTest extends DispatchableSerializerTest {
protected function buildSerializer() {
$referenceSerializerFake = $this->getMockBuilder( Serializer::class )->getMock();
$referenceSerializerFake->expects( $this->any() )
->method( 'serialize' )
->will( $this->returnValue( [
'hash' => 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
'snaks' => []
] ) );
return new ReferenceListSerializer( $referenceSerializerFake );
$referenceSerializerFake
object<PHPUnit\Framework\MockObject\MockObject>
object<Serializers\Serializer>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
}
public function serializableProvider() {
return [
[
new ReferenceList()
],
new ReferenceList( [
new Reference()
] )
];
public function nonSerializableProvider() {
5
[]
public function serializationProvider() {
[],
]
new Reference( [ new PropertyNoValueSnak( 1 ) ] ),
new Reference( [ new PropertyNoValueSnak( 1 ) ] )
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: