for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Psi\Component\Description\Benchmarks\Micro;
use Psi\Component\Description\Tests\Functional\Example\FooEnhancer;
use Psi\Component\Description\DescriptionFactory;
use Psi\Component\Description\Schema\Extension\StandardExtension;
use Psi\Component\Description\Tests\Functional\Example\Foo;
use Psi\Component\Description\Subject;
use Psi\Component\Description\Schema\Schema;
use Psi\Component\Description\Schema\Extension\HierarchyExtension;
/**
* @BeforeMethods({"setUp"})
* @Revs(1000)
* @Iterations(10)
*/
class FactoryBench
{
private $factory;
private $validatedFactory;
public function setUp()
$this->factory = new DescriptionFactory([
new FooEnhancer(),
], []);
array()
array
null|object<Psi\Componen...cription\Schema\Schema>
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);
$schema = new Schema([
new StandardExtension(),
new HierarchyExtension(),
]);
$this->validatedFactory = new DescriptionFactory([
], [], $schema);
$schema
object<Psi\Component\Description\Schema\Schema>
}
public function benchFactory()
$foo = new Foo();
$foo->title = 'Hello World';
$this->factory->describe(Subject::createFromObject($foo));
public function benchValidatedFactory()
$this->validatedFactory->describe(Subject::createFromObject($foo));
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: