@@ -53,7 +53,7 @@ class ContainerBuilder extends Nette\Object
5353 public function addDefinition ($ name , ServiceDefinition $ definition = NULL )
5454 {
5555 if (!is_string ($ name ) || !$ name ) { // builder is not ready for falsy names such as '0'
56- throw new Nette \InvalidArgumentException (" Service name must be a non-empty string, " . gettype ($ name ) . " given. " );
56+ throw new Nette \InvalidArgumentException (sprintf ( ' Service name must be a non-empty string, %s given. ' , gettype ($ name )) );
5757
5858 } elseif (isset ($ this ->definitions [$ name ])) {
5959 throw new Nette \InvalidStateException ("Service ' $ name' has already been added. " );
@@ -295,7 +295,7 @@ public function prepareClassList()
295295 private function resolveClass ($ name , $ recursive = array ())
296296 {
297297 if (isset ($ recursive [$ name ])) {
298- throw new ServiceCreationException ('Circular reference detected for services: ' . implode (', ' , array_keys ($ recursive )) . ' . ' );
298+ throw new ServiceCreationException (sprintf ( 'Circular reference detected for services: %s. ' , implode (', ' , array_keys ($ recursive ))) );
299299 }
300300 $ recursive [$ name ] = TRUE ;
301301
@@ -320,12 +320,12 @@ private function resolveClass($name, $recursive = array())
320320 }
321321 }
322322 if (!is_callable ($ factory )) {
323- throw new ServiceCreationException ("Factory ' " . Nette \Utils \Callback::toString ($ factory ) . " ' is not callable. " );
323+ throw new ServiceCreationException (sprintf ( "Factory '%s' is not callable. " , Nette \Utils \Callback::toString ($ factory )) );
324324 }
325325 try {
326326 $ reflection = Nette \Utils \Callback::toReflection ($ factory );
327327 } catch (\ReflectionException $ e ) {
328- throw new ServiceCreationException ("Missing factory ' " . Nette \Utils \Callback::toString ($ factory ) . " '. " );
328+ throw new ServiceCreationException (sprintf ( "Missing factory '%s'. " , Nette \Utils \Callback::toString ($ factory )) );
329329 }
330330 $ def ->class = preg_replace ('#[|\s].*# ' , '' , $ reflection ->getAnnotation ('return ' ));
331331 if ($ def ->class && $ reflection instanceof \ReflectionMethod) {
@@ -413,7 +413,7 @@ public function generateClasses($className = 'Container', $parentName = 'Nette\D
413413 throw new ServiceCreationException ('Name contains invalid characters. ' );
414414 }
415415 $ containerClass ->addMethod ($ methodName )
416- ->addDocument (" @return " . ($ def ->implement ?: $ def ->class ))
416+ ->addDocument (' @return ' . ($ def ->implement ?: $ def ->class ))
417417 ->setBody ($ name === self ::THIS_CONTAINER ? 'return $this; ' : $ this ->generateService ($ name ))
418418 ->setParameters ($ def ->implement ? array () : $ this ->convertParameters ($ def ->parameters ));
419419 } catch (\Exception $ e ) {
@@ -564,7 +564,7 @@ public function formatStatement(Statement $statement)
564564 return $ this ->formatPhp ("new $ entity " . ($ arguments ? '(?*) ' : '' ), array ($ arguments ));
565565
566566 } elseif (!Nette \Utils \Arrays::isList ($ entity ) || count ($ entity ) !== 2 ) {
567- throw new ServiceCreationException (" Expected class, method or property, " . PhpHelpers::dump ($ entity ) . " given. " );
567+ throw new ServiceCreationException (sprintf ( ' Expected class, method or property, %s given. ' , PhpHelpers::dump ($ entity )) );
568568
569569 } elseif ($ entity [0 ] === '' ) { // globalFunc
570570 return $ this ->formatPhp ("$ entity [1 ](?*) " , array ($ arguments ));
0 commit comments