for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SESP\PropertyAnnotators;
use SMW\DIProperty;
use SMW\DIWikiPage;
use SMW\SemanticData;
use SMWDataItem as DataItem;
use SESP\PropertyAnnotator;
use SESP\AppFactory;
/**
* @private
* @ingroup SESP
*
* @license GNU GPL v2+
* @since 2.0
* @author mwjames
*/
class LocalPropertyAnnotator implements PropertyAnnotator {
* @var AppFactory
private $appFactory;
* @param AppFactory $appFactory
public function __construct( AppFactory $appFactory ) {
$this->appFactory = $appFactory;
}
* {@inheritDoc}
public function isAnnotatorFor( DIProperty $property ) {
return true;
public function addAnnotation( DIProperty $property, SemanticData $semanticData ) {
$time = microtime( true );
$localDefs = $this->appFactory->getOption( 'sespgLocalDefinitions', [] );
array()
array
boolean
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);
foreach ( $localDefs as $key => $definition ) {
$this->callOnLocalDef( $definition, $property, $semanticData );
$this->appFactory->getLogger()->info(
__METHOD__ . ' (procTime in sec: '. round( ( microtime( true ) - $time ), 5 ) . ')'
);
private function callOnLocalDef( $definition, $property, $semanticData ) {
if ( !isset( $definition['id'] ) || $definition['id'] !== $property->getKey() ) {
return;
$dataItem = null;
if ( isset( $definition['callback'] ) && is_callable( $definition['callback'] ) ) {
$dataItem = call_user_func_array( $definition['callback'], [ $this->appFactory, $property, $semanticData ] );
if ( $dataItem instanceof DataItem ) {
$semanticData->addPropertyObjectValue( $property, $dataItem );
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: