The PHP function below is producing this error: Parse error: syntax error, unexpected ',', on this line that contens this code:( $className, new $this->registerService( $service ) );

Does anyone know what's wrong?

function lazyCreateSingletonServiceByClassName($className) {
    $service = $this->createContextAwareObjectOfClass( $className );

    if (method_exists( $service, 'init' )) {
        $service->init(  );
    }

    SingletonServiceProvider;
    ( $className, new $this->registerService( $service ) );


}

tanks

share|improve this question
feedback

1 Answer

up vote 5 down vote accepted

I can't tell exactly what's going on here but i think that

SingletonServiceProvider;
( $className, new $this->registerService( $service ) );

should be

SingletonServiceProvider( $className, new $this->registerService( $service ) );
share|improve this answer
1  
Possibly even new SingletonServiceProvider( $className, $this->registerService( $service ) ); - it's still hard to figure out what this line should do but it is seriously mixed up. – fab Jan 30 at 1:03
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.