fixed @throws phpdoc tag
This commit is contained in:
parent
dd7817ae62
commit
12690a8e92
@ -99,6 +99,8 @@ class Application
|
||||
* @param OutputInterface $output An Output instance
|
||||
*
|
||||
* @return integer 0 if everything went fine, or an error code
|
||||
*
|
||||
* @throws \Exception When doRun returns Exception
|
||||
*/
|
||||
public function run(InputInterface $input = null, OutputInterface $output = null)
|
||||
{
|
||||
@ -396,6 +398,8 @@ class Application
|
||||
* @param string $name The command name or alias
|
||||
*
|
||||
* @return Command A Command object
|
||||
*
|
||||
* @throws \InvalidArgumentException When command name given does not exist
|
||||
*/
|
||||
public function getCommand($name)
|
||||
{
|
||||
@ -456,6 +460,8 @@ class Application
|
||||
* Finds a registered namespace by a name or an abbreviation.
|
||||
*
|
||||
* @return string A registered namespace
|
||||
*
|
||||
* @throws \InvalidArgumentException When namespace is incorrect or ambiguous
|
||||
*/
|
||||
public function findNamespace($namespace)
|
||||
{
|
||||
@ -483,6 +489,8 @@ class Application
|
||||
* @param string $name A command name or a command alias
|
||||
*
|
||||
* @return Command A Command instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When command name is incorrect or ambiguous
|
||||
*/
|
||||
public function findCommand($name)
|
||||
{
|
||||
|
@ -43,6 +43,8 @@ class Command
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name The name of the command
|
||||
*
|
||||
* @throws \LogicException When the command name is empty
|
||||
*/
|
||||
public function __construct($name = null)
|
||||
{
|
||||
@ -88,6 +90,8 @@ class Command
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return integer 0 if everything went fine, or an error code
|
||||
*
|
||||
* @throws \LogicException When this abstrass class is not implemented
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
@ -273,6 +277,8 @@ class Command
|
||||
* @param string $name The command name
|
||||
*
|
||||
* @return Command The current instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When command name given is empty
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
|
@ -82,6 +82,8 @@ class DialogHelper extends Helper
|
||||
* @param integer $attempts Max number of times to ask before giving up (false by default, which means infinite)
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception When any of the validator returns an error
|
||||
*/
|
||||
public function askAndValidate(OutputInterface $output, $question, \Closure $validator, $attempts = false)
|
||||
{
|
||||
|
@ -118,6 +118,8 @@ class ArgvInput extends Input
|
||||
* Parses a short option set.
|
||||
*
|
||||
* @param string $token The current token
|
||||
*
|
||||
* @throws \RuntimeException When option given doesn't exist
|
||||
*/
|
||||
protected function parseShortOptionSet($name)
|
||||
{
|
||||
@ -166,6 +168,8 @@ class ArgvInput extends Input
|
||||
* Parses an argument.
|
||||
*
|
||||
* @param string $token The current token
|
||||
*
|
||||
* @throws \RuntimeException When too many arguments are given
|
||||
*/
|
||||
protected function parseArgument($token)
|
||||
{
|
||||
@ -182,6 +186,8 @@ class ArgvInput extends Input
|
||||
*
|
||||
* @param string $shortcut The short option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws \RuntimeException When option given doesn't exist
|
||||
*/
|
||||
protected function addShortOption($shortcut, $value)
|
||||
{
|
||||
@ -198,6 +204,8 @@ class ArgvInput extends Input
|
||||
*
|
||||
* @param string $name The long option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws \RuntimeException When option given doesn't exist
|
||||
*/
|
||||
protected function addLongOption($name, $value)
|
||||
{
|
||||
|
@ -117,6 +117,8 @@ class ArrayInput extends Input
|
||||
*
|
||||
* @param string $shortcut The short option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws \RuntimeException When option given doesn't exist
|
||||
*/
|
||||
protected function addShortOption($shortcut, $value)
|
||||
{
|
||||
@ -133,6 +135,8 @@ class ArrayInput extends Input
|
||||
*
|
||||
* @param string $name The long option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws \RuntimeException When option given doesn't exist
|
||||
*/
|
||||
protected function addLongOption($name, $value)
|
||||
{
|
||||
@ -161,6 +165,8 @@ class ArrayInput extends Input
|
||||
*
|
||||
* @param string $name The argument name
|
||||
* @param mixed $value The value for the argument
|
||||
*
|
||||
* @throws \RuntimeException When option given doesn't exist
|
||||
*/
|
||||
protected function addArgument($name, $value)
|
||||
{
|
||||
|
@ -68,6 +68,9 @@ abstract class Input implements InputInterface
|
||||
*/
|
||||
abstract protected function parse();
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException When not enough arguments are given
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
if (count($this->arguments) < $this->definition->getArgumentRequiredCount())
|
||||
@ -102,6 +105,8 @@ abstract class Input implements InputInterface
|
||||
* @param string $name The argument name
|
||||
*
|
||||
* @return mixed The argument value
|
||||
*
|
||||
* @throws \InvalidArgumentException When argument given doesn't exist
|
||||
*/
|
||||
public function getArgument($name)
|
||||
{
|
||||
@ -118,6 +123,8 @@ abstract class Input implements InputInterface
|
||||
*
|
||||
* @param string $name The argument name
|
||||
* @param string $value The argument value
|
||||
*
|
||||
* @throws \InvalidArgumentException When argument given doesn't exist
|
||||
*/
|
||||
public function setArgument($name, $value)
|
||||
{
|
||||
@ -157,6 +164,8 @@ abstract class Input implements InputInterface
|
||||
* @param string $name The option name
|
||||
*
|
||||
* @return mixed The option value
|
||||
*
|
||||
* @throws \InvalidArgumentException When option given doesn't exist
|
||||
*/
|
||||
public function getOption($name)
|
||||
{
|
||||
@ -173,6 +182,8 @@ abstract class Input implements InputInterface
|
||||
*
|
||||
* @param string $name The option name
|
||||
* @param string $value The option value
|
||||
*
|
||||
* @throws \InvalidArgumentException When option given doesn't exist
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
|
@ -36,6 +36,8 @@ class InputArgument
|
||||
* @param integer $mode The argument mode: self::REQUIRED or self::OPTIONAL
|
||||
* @param string $description A description text
|
||||
* @param mixed $default The default value (for self::OPTIONAL mode only)
|
||||
*
|
||||
* @throws \InvalidArgumentException When argument mode is not valid
|
||||
*/
|
||||
public function __construct($name, $mode = null, $description = '', $default = null)
|
||||
{
|
||||
@ -89,6 +91,8 @@ class InputArgument
|
||||
* Sets the default value.
|
||||
*
|
||||
* @param mixed $default The default value
|
||||
*
|
||||
* @throws \LogicException When incorrect default value is given
|
||||
*/
|
||||
public function setDefault($default = null)
|
||||
{
|
||||
|
@ -97,6 +97,8 @@ class InputDefinition
|
||||
* Add an InputArgument object.
|
||||
*
|
||||
* @param InputArgument $argument An InputArgument object
|
||||
*
|
||||
* @throws \LogicException When incorrect argument is given
|
||||
*/
|
||||
public function addArgument(InputArgument $argument)
|
||||
{
|
||||
@ -138,6 +140,8 @@ class InputDefinition
|
||||
* @param string|integer $name The InputArgument name or position
|
||||
*
|
||||
* @return InputArgument An InputArgument object
|
||||
*
|
||||
* @throws \InvalidArgumentException When argument given doesn't exist
|
||||
*/
|
||||
public function getArgument($name)
|
||||
{
|
||||
@ -240,6 +244,8 @@ class InputDefinition
|
||||
* Add an InputOption object.
|
||||
*
|
||||
* @param InputOption $option An InputOption object
|
||||
*
|
||||
* @throws \LogicException When option given already exist
|
||||
*/
|
||||
public function addOption(InputOption $option)
|
||||
{
|
||||
@ -342,6 +348,8 @@ class InputDefinition
|
||||
* @param string $shortcut The shortcut
|
||||
*
|
||||
* @return string The InputOption name
|
||||
*
|
||||
* @throws \InvalidArgumentException When option given does not exist
|
||||
*/
|
||||
protected function shortcutToName($shortcut)
|
||||
{
|
||||
|
@ -39,6 +39,8 @@ class InputOption
|
||||
* @param integer $mode The option mode: self::PARAMETER_REQUIRED, self::PARAMETER_NONE or self::PARAMETER_OPTIONAL
|
||||
* @param string $description A description text
|
||||
* @param mixed $default The default value (must be null for self::PARAMETER_REQUIRED or self::PARAMETER_NONE)
|
||||
*
|
||||
* @throws \InvalidArgumentException If option mode is invalid or incompatible
|
||||
*/
|
||||
public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
|
||||
{
|
||||
|
@ -40,6 +40,9 @@ class StringInput extends ArgvInput
|
||||
$this->tokens = $this->tokenize($input);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When unable to parse input (should never happen)
|
||||
*/
|
||||
protected function tokenize($input)
|
||||
{
|
||||
$input = preg_replace('/(\r\n|\r|\n|\t)/', ' ', $input);
|
||||
|
@ -127,6 +127,8 @@ abstract class Output implements OutputInterface
|
||||
* @param string|array $messages The message as an array of lines of a single string
|
||||
* @param Boolean $newline Whether to add a newline or not
|
||||
* @param integer $type The type of output
|
||||
*
|
||||
* @throws \InvalidArgumentException When unknown output type is given
|
||||
*/
|
||||
public function write($messages, $newline = false, $type = 0)
|
||||
{
|
||||
@ -182,6 +184,9 @@ abstract class Output implements OutputInterface
|
||||
return preg_replace_callback('#</([a-z][a-z0-9\-_]+)>#i', array($this, 'replaceEndStyle'), $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When style is unknown
|
||||
*/
|
||||
protected function replaceStartStyle($match)
|
||||
{
|
||||
if (!$this->decorated)
|
||||
|
@ -36,6 +36,8 @@ class StreamOutput extends Output
|
||||
* @param mixed $stream A stream resource
|
||||
* @param integer $verbosity The verbosity level (self::VERBOSITY_QUIET, self::VERBOSITY_NORMAL, self::VERBOSITY_VERBOSE)
|
||||
* @param Boolean $decorated Whether to decorate messages or not (null for auto-guessing)
|
||||
*
|
||||
* @throws \InvalidArgumentException When first argument is not a real stream
|
||||
*/
|
||||
public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null)
|
||||
{
|
||||
@ -69,6 +71,8 @@ class StreamOutput extends Output
|
||||
*
|
||||
* @param string $message A message to write to the output
|
||||
* @param Boolean $newline Whether to add a newline or not
|
||||
*
|
||||
* @throws \RuntimeException When unable to write output (should never happen)
|
||||
*/
|
||||
public function doWrite($message, $newline)
|
||||
{
|
||||
|
@ -38,6 +38,8 @@ class Shell
|
||||
* a \RuntimeException exception is thrown.
|
||||
*
|
||||
* @param Application $application An application instance
|
||||
*
|
||||
* @throws \RuntimeException When Readline extension is not enabled
|
||||
*/
|
||||
public function __construct(Application $application)
|
||||
{
|
||||
|
@ -53,6 +53,9 @@ class AttribNode implements NodeInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When unknown operator is found
|
||||
*/
|
||||
public function toXpath()
|
||||
{
|
||||
$path = $this->selector->toXpath();
|
||||
|
@ -50,6 +50,9 @@ class CombinedSelectorNode implements NodeInterface
|
||||
return sprintf('%s[%s %s %s]', __CLASS__, $this->selector, $comb, $this->subselector);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When unknown combinator is found
|
||||
*/
|
||||
public function toXpath()
|
||||
{
|
||||
if (!isset(self::$_method_mapping[$this->combinator]))
|
||||
|
@ -46,6 +46,9 @@ class FunctionNode implements NodeInterface
|
||||
return sprintf('%s[%s%s%s(%s)]', __CLASS__, $this->selector, $this->type, $this->name, $this->expr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When unsupported or unknown pseudo-class is found
|
||||
*/
|
||||
public function toXpath()
|
||||
{
|
||||
$sel_path = $this->selector->toXpath();
|
||||
|
@ -35,6 +35,9 @@ class PseudoNode implements NodeInterface
|
||||
protected $type;
|
||||
protected $ident;
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When incorrect PseudoNode type is given
|
||||
*/
|
||||
public function __construct($element, $type, $ident)
|
||||
{
|
||||
$this->element = $element;
|
||||
@ -53,6 +56,9 @@ class PseudoNode implements NodeInterface
|
||||
return sprintf('%s[%s%s%s]', __CLASS__, $this->element, $this->type, $this->ident);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When unsupported or unknown pseudo-class is found
|
||||
*/
|
||||
public function toXpath()
|
||||
{
|
||||
$el_xpath = $this->element->toXpath();
|
||||
@ -78,6 +84,9 @@ class PseudoNode implements NodeInterface
|
||||
return $xpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError If this element is the root element
|
||||
*/
|
||||
protected function xpath_root($xpath)
|
||||
{
|
||||
// if this element is the root element
|
||||
@ -114,6 +123,9 @@ class PseudoNode implements NodeInterface
|
||||
return $xpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError Because *:last-of-type is not implemented
|
||||
*/
|
||||
protected function xpath_last_of_type($xpath)
|
||||
{
|
||||
if ($xpath->getElement() == '*')
|
||||
@ -135,6 +147,9 @@ class PseudoNode implements NodeInterface
|
||||
return $xpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError Because *:only-of-type is not implemented
|
||||
*/
|
||||
protected function xpath_only_of_type($xpath)
|
||||
{
|
||||
if ($xpath->getElement() == '*')
|
||||
|
@ -26,6 +26,9 @@ namespace Symfony\Components\CssSelector;
|
||||
*/
|
||||
class Parser
|
||||
{
|
||||
/**
|
||||
* @throws SyntaxError When got None for xpath expression
|
||||
*/
|
||||
static public function cssToXpath($cssExpr, $prefix = 'descendant-or-self::')
|
||||
{
|
||||
if (is_string($cssExpr))
|
||||
@ -66,6 +69,9 @@ class Parser
|
||||
return (string) $expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception When tokenizer throws it while parsing
|
||||
*/
|
||||
public function parse($string)
|
||||
{
|
||||
$tokenizer = new Tokenizer();
|
||||
@ -108,6 +114,9 @@ class Parser
|
||||
return new Node\OrNode($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When expected selector but got something else
|
||||
*/
|
||||
protected function parseSelector($stream)
|
||||
{
|
||||
$result = $this->parseSimpleSelector($stream);
|
||||
@ -141,6 +150,9 @@ class Parser
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When expected symbol but got something else
|
||||
*/
|
||||
protected function parseSimpleSelector($stream)
|
||||
{
|
||||
$peek = $stream->peek();
|
||||
@ -269,6 +281,9 @@ class Parser
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When encountered unexpected selector
|
||||
*/
|
||||
protected function parseAttrib($selector, $stream)
|
||||
{
|
||||
$attrib = $stream->next();
|
||||
|
@ -108,6 +108,9 @@ class Tokenizer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When expected closing is not found
|
||||
*/
|
||||
protected function tokenizeEscapedString($s, $pos)
|
||||
{
|
||||
$quote = $s[$pos];
|
||||
@ -139,6 +142,9 @@ class Tokenizer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When invalid escape sequence is found
|
||||
*/
|
||||
protected function unescapeStringLiteral($literal)
|
||||
{
|
||||
return preg_replace_callback('#(\\\\(?:[A-Fa-f0-9]{1,6}(?:\r\n|\s)?|[^A-Fa-f0-9]))#', function ($matches) use ($literal)
|
||||
@ -158,6 +164,9 @@ class Tokenizer
|
||||
}, $literal);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError When Unexpected symbol is found
|
||||
*/
|
||||
protected function tokenizeSymbol($s, $pos)
|
||||
{
|
||||
$start = $pos;
|
||||
|
@ -335,6 +335,8 @@ class Builder extends Container implements AnnotatedContainerInterface
|
||||
* @param string $id The service identifier
|
||||
*
|
||||
* @return object The service described by the service definition
|
||||
*
|
||||
* @throws \InvalidArgumentException When configure callable is not callable
|
||||
*/
|
||||
protected function createService(Definition $definition, $id)
|
||||
{
|
||||
|
@ -317,6 +317,8 @@ class Container implements ContainerInterface, \ArrayAccess
|
||||
* Removes a service by identifier.
|
||||
*
|
||||
* @param string The service identifier
|
||||
*
|
||||
* @throws LogicException When trying to unset a service
|
||||
*/
|
||||
public function __unset($id)
|
||||
{
|
||||
@ -330,6 +332,8 @@ class Container implements ContainerInterface, \ArrayAccess
|
||||
* @param array $arguments The method arguments
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \RuntimeException When calling to an undefined method
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
|
@ -40,6 +40,8 @@ abstract class Dumper implements DumperInterface
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string The representation of the service container
|
||||
*
|
||||
* @throws \LogicException When this abstrass class is not implemented
|
||||
*/
|
||||
public function dump(array $options = array())
|
||||
{
|
||||
|
@ -227,6 +227,9 @@ EOF;
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException When trying to dump object or ressource
|
||||
*/
|
||||
static public function phpToXml($value)
|
||||
{
|
||||
switch (true)
|
||||
|
@ -143,6 +143,9 @@ class YamlDumper extends Dumper
|
||||
return Yaml::dump(array('parameters' => $this->prepareParameters($this->container->getParameters())), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException When trying to dump object or ressource
|
||||
*/
|
||||
protected function dumpValue($value)
|
||||
{
|
||||
if (is_array($value))
|
||||
|
@ -37,6 +37,9 @@ abstract class FileLoader extends Loader
|
||||
$this->paths = $paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When provided file does not exist
|
||||
*/
|
||||
protected function findFile($file)
|
||||
{
|
||||
$path = $this->getAbsolutePath($file);
|
||||
|
@ -29,6 +29,8 @@ class IniFileLoader extends FileLoader
|
||||
* @param string $file An INI file path
|
||||
*
|
||||
* @return BuilderConfiguration A BuilderConfiguration instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When ini file is not valid
|
||||
*/
|
||||
public function load($file)
|
||||
{
|
||||
|
@ -40,6 +40,8 @@ abstract class LoaderExtension implements LoaderExtensionInterface
|
||||
* @param array An array of configuration values
|
||||
*
|
||||
* @return BuilderConfiguration A BuilderConfiguration instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When provided tag is not defined in this extension
|
||||
*/
|
||||
public function load($tag, array $config)
|
||||
{
|
||||
|
@ -197,6 +197,9 @@ class XmlFileLoader extends FileLoader
|
||||
$configuration->setDefinition($id, $definition);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When loading of XML file returns error
|
||||
*/
|
||||
protected function parseFile($file)
|
||||
{
|
||||
$dom = new \DOMDocument();
|
||||
@ -249,6 +252,10 @@ class XmlFileLoader extends FileLoader
|
||||
$this->validateExtensions($dom, $file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException When extension references a non-existent XSD file
|
||||
* @throws \InvalidArgumentException When xml doesn't validate its xsd schema
|
||||
*/
|
||||
protected function validateSchema($dom, $file)
|
||||
{
|
||||
$schemaLocations = array('http://www.symfony-project.org/schema/dic/services' => str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd'));
|
||||
@ -299,6 +306,9 @@ EOF
|
||||
libxml_use_internal_errors(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When non valid tag are found or no extension are found
|
||||
*/
|
||||
protected function validateExtensions($dom, $file)
|
||||
{
|
||||
foreach ($dom->documentElement->childNodes as $node)
|
||||
|
@ -196,6 +196,9 @@ class YamlFileLoader extends FileLoader
|
||||
return $this->validate(Yaml::load($file), $file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When service file is not valid
|
||||
*/
|
||||
protected function validate($content, $file)
|
||||
{
|
||||
if (null === $content)
|
||||
|
@ -127,6 +127,8 @@ class Event implements \ArrayAccess
|
||||
* @param string $name The parameter name
|
||||
*
|
||||
* @return mixed The parameter value
|
||||
*
|
||||
* @throws \InvalidArgumentException When parameter doesn't exists for this event
|
||||
*/
|
||||
public function getParameter($name)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ class ArrayDecorator extends GetterDecorator implements \Iterator, \ArrayAccess,
|
||||
* @param string $offset (ignored)
|
||||
* @param string $value (ignored)
|
||||
*
|
||||
* @throws \LogicException
|
||||
* @throws \LogicException When trying to set values
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
@ -136,7 +136,7 @@ class ArrayDecorator extends GetterDecorator implements \Iterator, \ArrayAccess,
|
||||
*
|
||||
* @param string $offset (ignored)
|
||||
*
|
||||
* @throws LogicException
|
||||
* @throws \LogicException When trying to unset values
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ class IteratorDecorator extends ObjectDecorator implements \Iterator, \Countable
|
||||
* @param string $offset (ignored)
|
||||
* @param string $value (ignored)
|
||||
*
|
||||
* @throws \LogicException
|
||||
* @throws \LogicException When trying to set values
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
@ -147,7 +147,7 @@ class IteratorDecorator extends ObjectDecorator implements \Iterator, \Countable
|
||||
*
|
||||
* @param string $offset (ignored)
|
||||
*
|
||||
* @throws \LogicException
|
||||
* @throws \LogicException When trying to unset values
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
|
@ -46,6 +46,8 @@ class RequestHandler
|
||||
* @param Boolean $main Whether this is the main request or not
|
||||
*
|
||||
* @return ResponseInterface $response A Response instance
|
||||
*
|
||||
* @throws \Exception When Exception couldn't be catch by event processing
|
||||
*/
|
||||
public function handle(RequestInterface $request, $main = true)
|
||||
{
|
||||
@ -78,7 +80,8 @@ class RequestHandler
|
||||
*
|
||||
* @return ResponseInterface $response A Response instance
|
||||
*
|
||||
* @throws \LogicException if one of the listener does not behave as expected
|
||||
* @throws \LogicException If one of the listener does not behave as expected
|
||||
* @throws NotFoundHttpException When controller cannot be found
|
||||
*/
|
||||
public function handleRaw(RequestInterface $request, $main = true)
|
||||
{
|
||||
|
@ -144,6 +144,8 @@ class Response implements ResponseInterface
|
||||
* @param string $domain Domain name
|
||||
* @param bool $secure If secure
|
||||
* @param bool $httpOnly If uses only HTTP
|
||||
*
|
||||
* @throws \InvalidArgumentException When cookie expire parameter is not valid
|
||||
*/
|
||||
public function setCookie($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false)
|
||||
{
|
||||
@ -192,6 +194,7 @@ class Response implements ResponseInterface
|
||||
* @param string $code HTTP status code
|
||||
* @param string $text HTTP status text
|
||||
*
|
||||
* @throws \InvalidArgumentException When the HTTP status code is not valid
|
||||
*/
|
||||
public function setStatusCode($code, $text = null)
|
||||
{
|
||||
|
@ -41,6 +41,8 @@ abstract class GeneratorDumper implements GeneratorDumperInterface
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string The representation of the routing
|
||||
*
|
||||
* @throws \LogicException When this abstrass class is not implemented
|
||||
*/
|
||||
public function dump(array $options = array())
|
||||
{
|
||||
|
@ -51,6 +51,8 @@ class UrlGenerator implements UrlGeneratorInterface
|
||||
* @param Boolean $absolute Whether to generate an absolute URL
|
||||
*
|
||||
* @return string The generated URL
|
||||
*
|
||||
* @throws \InvalidArgumentException When route doesn't exist
|
||||
*/
|
||||
public function generate($name, array $parameters, $absolute = false)
|
||||
{
|
||||
@ -67,6 +69,9 @@ class UrlGenerator implements UrlGeneratorInterface
|
||||
return $this->doGenerate($this->cache[$name]->getVariables(), $route->getDefaults(), $route->getRequirements(), $this->cache[$name]->getTokens(), $parameters, $name, $absolute);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When route has some missing mandatory parameters
|
||||
*/
|
||||
protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $absolute)
|
||||
{
|
||||
$defaults = array_merge($this->defaults, $defaults);
|
||||
|
@ -37,6 +37,9 @@ abstract class FileLoader implements LoaderInterface
|
||||
$this->paths = $paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When file is not found
|
||||
*/
|
||||
protected function findFile($file)
|
||||
{
|
||||
$path = $this->getAbsolutePath($file);
|
||||
|
@ -30,6 +30,8 @@ class XmlFileLoader extends FileLoader
|
||||
* @param string $file A XML file path
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When a tag can't be parsed
|
||||
*/
|
||||
public function load($file)
|
||||
{
|
||||
@ -123,6 +125,9 @@ class XmlFileLoader extends FileLoader
|
||||
$collection->addCollection($loader->load($importedFile), (string) $node->getAttribute('prefix'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When loading of XML file returns error
|
||||
*/
|
||||
protected function loadFile($path)
|
||||
{
|
||||
$dom = new \DOMDocument();
|
||||
@ -139,6 +144,9 @@ class XmlFileLoader extends FileLoader
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When xml doesn't validate its xsd schema
|
||||
*/
|
||||
protected function validate($dom, $file)
|
||||
{
|
||||
libxml_use_internal_errors(true);
|
||||
|
@ -31,6 +31,8 @@ class YamlFileLoader extends FileLoader
|
||||
* @param string $file A Yaml file path
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When route can't be parsed
|
||||
*/
|
||||
public function load($file)
|
||||
{
|
||||
@ -60,6 +62,9 @@ class YamlFileLoader extends FileLoader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When coonfig pattern is not defined for the given route
|
||||
*/
|
||||
protected function parseRoute(RouteCollection $collection, $name, $config, $file)
|
||||
{
|
||||
$defaults = isset($config['defaults']) ? $config['defaults'] : array();
|
||||
@ -76,6 +81,9 @@ class YamlFileLoader extends FileLoader
|
||||
$collection->addRoute($name, $route);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When import resource is not defined
|
||||
*/
|
||||
protected function parseImport(RouteCollection $collection, $name, $import, $file)
|
||||
{
|
||||
if (!isset($import['resource']))
|
||||
|
@ -32,6 +32,8 @@ class ApacheMatcherDumper extends MatcherDumper
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string A PHP class representing the matcher class
|
||||
*
|
||||
* @throws \RuntimeException When a route has more than 9 variables
|
||||
*/
|
||||
public function dump(array $options = array())
|
||||
{
|
||||
|
@ -41,6 +41,8 @@ abstract class MatcherDumper implements MatcherDumperInterface
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string The representation of the routing
|
||||
*
|
||||
* @throws \LogicException When this abstrass class is not implemented
|
||||
*/
|
||||
public function dump(array $options = array())
|
||||
{
|
||||
|
@ -37,6 +37,8 @@ class RouteCollection
|
||||
*
|
||||
* @param string $name The route name
|
||||
* @param Route $route A Route instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When route name contains non valid characters
|
||||
*/
|
||||
public function addRoute($name, Route $route)
|
||||
{
|
||||
|
@ -127,6 +127,8 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
|
||||
/**
|
||||
* Tokenizes the route.
|
||||
*
|
||||
* @throws \InvalidArgumentException When route can't be parsed
|
||||
*/
|
||||
protected function tokenize()
|
||||
{
|
||||
|
@ -41,6 +41,8 @@ class Router implements RouterInterface
|
||||
* @param array $options An array of options
|
||||
* @param array $context The context
|
||||
* @param array $defaults The default values
|
||||
*
|
||||
* @throws \InvalidArgumentException When unsupported option is provided
|
||||
*/
|
||||
public function __construct($loader, array $options = array(), array $context = array(), array $defaults = array())
|
||||
{
|
||||
@ -249,6 +251,9 @@ class Router implements RouterInterface
|
||||
return $this->options['cache_dir'].'/'.$class.'.'.$extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException When cache file can't be wrote
|
||||
*/
|
||||
protected function writeCacheFile($file, $content)
|
||||
{
|
||||
$tmpFile = tempnam(dirname($file), basename($file));
|
||||
|
@ -69,6 +69,8 @@ class Inline
|
||||
* @param mixed $value The PHP variable to convert
|
||||
*
|
||||
* @return string The YAML string representing the PHP array
|
||||
*
|
||||
* @throws Exception When trying to dump PHP ressource
|
||||
*/
|
||||
static public function dump($value)
|
||||
{
|
||||
@ -157,6 +159,8 @@ class Inline
|
||||
* @param boolean $evaluate
|
||||
*
|
||||
* @return string A YAML string
|
||||
*
|
||||
* @throws ParserException When malformed inline YAML string is parsed
|
||||
*/
|
||||
static public function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true)
|
||||
{
|
||||
@ -202,6 +206,8 @@ class Inline
|
||||
* @param integer $i
|
||||
*
|
||||
* @return string A YAML string
|
||||
*
|
||||
* @throws ParserException When malformed inline YAML string is parsed
|
||||
*/
|
||||
static protected function parseQuotedScalar($scalar, &$i)
|
||||
{
|
||||
@ -235,6 +241,8 @@ class Inline
|
||||
* @param integer $i
|
||||
*
|
||||
* @return string A YAML string
|
||||
*
|
||||
* @throws ParserException When malformed inline YAML string is parsed
|
||||
*/
|
||||
static protected function parseSequence($sequence, &$i = 0)
|
||||
{
|
||||
@ -295,6 +303,8 @@ class Inline
|
||||
* @param integer $i
|
||||
*
|
||||
* @return string A YAML string
|
||||
*
|
||||
* @throws ParserException When malformed inline YAML string is parsed
|
||||
*/
|
||||
static protected function parseMapping($mapping, &$i = 0)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ class Parser
|
||||
*
|
||||
* @return mixed A PHP value
|
||||
*
|
||||
* @throws \InvalidArgumentException If the YAML is not valid
|
||||
* @throws ParserException If the YAML is not valid
|
||||
*/
|
||||
public function parse($value)
|
||||
{
|
||||
@ -298,6 +298,8 @@ class Parser
|
||||
* @param integer $indentation The indent level at which the block is to be read, or null for default
|
||||
*
|
||||
* @return string A YAML string
|
||||
*
|
||||
* @throws ParserException When indentation problem are detected
|
||||
*/
|
||||
protected function getNextEmbedBlock($indentation = null)
|
||||
{
|
||||
@ -386,6 +388,8 @@ class Parser
|
||||
* @param string $value A YAML value
|
||||
*
|
||||
* @return mixed A PHP value
|
||||
*
|
||||
* @throws ParserException When reference doesn't not exist
|
||||
*/
|
||||
protected function parseValue($value)
|
||||
{
|
||||
|
@ -25,6 +25,8 @@ class Yaml
|
||||
* Sets the YAML specification version to use.
|
||||
*
|
||||
* @param string $version The YAML specification version
|
||||
*
|
||||
* @throws \InvalidArgumentException When version of YAML specs is not supported
|
||||
*/
|
||||
static public function setSpecVersion($version)
|
||||
{
|
||||
|
@ -19,6 +19,9 @@ namespace Symfony\Foundation;
|
||||
*/
|
||||
class ClassCollectionLoader
|
||||
{
|
||||
/**
|
||||
* @throws \InvalidArgumentException When class can't be loaded
|
||||
*/
|
||||
static public function load($classes, $cacheDir, $name, $autoReload)
|
||||
{
|
||||
$cache = $cacheDir.'/'.$name.'.php';
|
||||
|
@ -46,6 +46,9 @@ class ErrorHandler
|
||||
set_error_handler(array($this, 'handle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \ErrorException When error_reporting returns error
|
||||
*/
|
||||
public function handle($level, $message, $file, $line, $context)
|
||||
{
|
||||
if (0 === $this->level)
|
||||
|
@ -98,6 +98,8 @@ abstract class Kernel implements \Serializable
|
||||
* the DI container.
|
||||
*
|
||||
* @return Kernel The current Kernel instance
|
||||
*
|
||||
* @throws \LogicException When the Kernel is already booted
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
|
@ -81,6 +81,8 @@ The above will re-build everything and load all bundle data fixtures.
|
||||
|
||||
/**
|
||||
* @see Command
|
||||
*
|
||||
* @throws \InvalidArgumentException When neither of any build options is included
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -48,6 +48,8 @@ class DatabaseToolDoctrineCommand extends DoctrineCommand
|
||||
|
||||
/**
|
||||
* @see Command
|
||||
*
|
||||
* @throws \InvalidArgumentException When neither of --drop or --create is specified
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -44,6 +44,8 @@ class ImportMappingDoctrineCommand extends DoctrineCommand
|
||||
|
||||
/**
|
||||
* @see Command
|
||||
*
|
||||
* @throws \InvalidArgumentException When the bundle doesn't end with Bundle (Example: "Bundle\MySampleBundle")
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -58,6 +58,8 @@ Now you have a new entity and your database has been updated.
|
||||
|
||||
/**
|
||||
* @see Command
|
||||
*
|
||||
* @throws \InvalidArgumentException When the bundle doesn't end with Bundle (Example: "Bundle\MySampleBundle")
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -82,6 +82,9 @@ class ProfilerStorage
|
||||
$this->close($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException When neither of SQLite or PDO_SQLite extension is enabled
|
||||
*/
|
||||
protected function initDb($readOnly = true)
|
||||
{
|
||||
if (class_exists('\SQLite3'))
|
||||
|
@ -42,6 +42,8 @@ class AssetsInstallCommand extends Command
|
||||
|
||||
/**
|
||||
* @see Command
|
||||
*
|
||||
* @throws \InvalidArgumentException When the target directory does not exist
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -43,6 +43,9 @@ class InitBundleCommand extends Command
|
||||
|
||||
/**
|
||||
* @see Command
|
||||
*
|
||||
* @throws \InvalidArgumentException When namespace doesn't end with Bundle
|
||||
* @throws \RuntimeException When bundle can't be executed
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -104,6 +104,9 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When route does not exist
|
||||
*/
|
||||
protected function outputRoute(OutputInterface $output, $routes, $name)
|
||||
{
|
||||
$output->writeln($this->getHelper('formatter')->formatSection('router', sprintf('Route "%s"', $name)));
|
||||
|
@ -25,6 +25,9 @@ use Symfony\Components\RequestHandler\Exception\HttpException;
|
||||
*/
|
||||
class ExceptionController extends Controller
|
||||
{
|
||||
/**
|
||||
* @throws \InvalidArgumentException When the exception template does not exist
|
||||
*/
|
||||
public function exceptionAction(\Exception $exception, Request $originalRequest, array $logs)
|
||||
{
|
||||
$template = $this->container->getParameter('kernel.debug') ? 'exception' : 'error';
|
||||
|
@ -74,6 +74,9 @@ class ControllerLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException|\LogicException If controller can't be found
|
||||
*/
|
||||
public function findController($bundle, $controller, $action)
|
||||
{
|
||||
$class = null;
|
||||
@ -130,6 +133,9 @@ class ControllerLoader
|
||||
return array($controller, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException When value for argument given is not provided
|
||||
*/
|
||||
public function getMethodArguments(\ReflectionFunctionAbstract $r, array $parameters, $controller)
|
||||
{
|
||||
$arguments = array();
|
||||
|
@ -21,6 +21,9 @@ class PdoSession extends NativeSession
|
||||
{
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When "db_table" option is not provided
|
||||
*/
|
||||
public function __construct(\PDO $db, $options = null)
|
||||
{
|
||||
$this->db = $db;
|
||||
@ -60,8 +63,6 @@ class PdoSession extends NativeSession
|
||||
* @param string $name (ignored)
|
||||
*
|
||||
* @return boolean true, if the session was opened, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If a connection with the database does not exist or cannot be created
|
||||
*/
|
||||
public function sessionOpen($path = null, $name = null)
|
||||
{
|
||||
@ -84,9 +85,9 @@ class PdoSession extends NativeSession
|
||||
*
|
||||
* @param string $id A session ID
|
||||
*
|
||||
* @return bool true, if the session was destroyed, otherwise an exception is thrown
|
||||
* @return bool true, if the session was destroyed, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If the session cannot be destroyed
|
||||
* @throws \RuntimeException If the session cannot be destroyed
|
||||
*/
|
||||
public function sessionDestroy($id)
|
||||
{
|
||||
@ -118,7 +119,7 @@ class PdoSession extends NativeSession
|
||||
*
|
||||
* @return bool true, if old sessions have been cleaned, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If any old sessions cannot be cleaned
|
||||
* @throws \RuntimeException If any old sessions cannot be cleaned
|
||||
*/
|
||||
public function sessionGC($lifetime)
|
||||
{
|
||||
@ -148,7 +149,7 @@ class PdoSession extends NativeSession
|
||||
*
|
||||
* @return string The session data if the session was read or created, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If the session cannot be read
|
||||
* @throws \RuntimeException If the session cannot be read
|
||||
*/
|
||||
public function sessionRead($id)
|
||||
{
|
||||
@ -202,7 +203,7 @@ class PdoSession extends NativeSession
|
||||
*
|
||||
* @return bool true, if the session was written, otherwise an exception is thrown
|
||||
*
|
||||
* @throws <b>DatabaseException</b> If the session data cannot be written
|
||||
* @throws \RuntimeException If the session data cannot be written
|
||||
*/
|
||||
public function sessionWrite($id, $data)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ interface SessionInterface
|
||||
*
|
||||
* @return mixed Data associated with the key
|
||||
*
|
||||
* @throws RuntimeException If an error occurs while reading data from this storage
|
||||
* @throws \RuntimeException If an error occurs while reading data from this storage
|
||||
*/
|
||||
public function read($key);
|
||||
|
||||
@ -41,7 +41,7 @@ interface SessionInterface
|
||||
*
|
||||
* @return mixed Data associated with the key
|
||||
*
|
||||
* @throws RuntimeException If an error occurs while removing data from this storage
|
||||
* @throws \RuntimeException If an error occurs while removing data from this storage
|
||||
*/
|
||||
public function remove($key);
|
||||
|
||||
@ -53,7 +53,7 @@ interface SessionInterface
|
||||
* @param string $key A unique key identifying your data
|
||||
* @param mixed $data Data associated with your key
|
||||
*
|
||||
* @throws RuntimeException If an error occurs while writing to this storage
|
||||
* @throws \RuntimeException If an error occurs while writing to this storage
|
||||
*/
|
||||
public function write($key, $data);
|
||||
|
||||
@ -64,7 +64,7 @@ interface SessionInterface
|
||||
*
|
||||
* @return boolean True if session regenerated, false if error
|
||||
*
|
||||
* @throws RuntimeException If an error occurs while regenerating this storage
|
||||
* @throws \RuntimeException If an error occurs while regenerating this storage
|
||||
*/
|
||||
public function regenerate($destroy = false);
|
||||
}
|
||||
|
@ -77,6 +77,9 @@ class Engine extends BaseEngine
|
||||
return isset($this->helpers[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When the helper is not defined
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
if (!isset($this->helpers[$name]))
|
||||
|
@ -166,6 +166,8 @@ class Filesystem
|
||||
*
|
||||
* @param string $origin The origin filename
|
||||
* @param string $target The new filename
|
||||
*
|
||||
* @throws \RuntimeException When target file already exists
|
||||
*/
|
||||
public function rename($origin, $target)
|
||||
{
|
||||
@ -220,6 +222,8 @@ class Filesystem
|
||||
* @param string $targetDir The target directory
|
||||
* @param Finder $finder An Finder instance
|
||||
* @param array $options An array of options (see copy())
|
||||
*
|
||||
* @throws \RuntimeException When file type is unknown
|
||||
*/
|
||||
public function mirror($originDir, $targetDir, $finder = null, $options = array())
|
||||
{
|
||||
|
@ -286,6 +286,8 @@ class Finder
|
||||
*
|
||||
* @param mixed function or method to call
|
||||
* @return Finder Current object
|
||||
*
|
||||
* @throws \InvalidArgumentException If function or method does not exist
|
||||
*/
|
||||
public function exec()
|
||||
{
|
||||
|
@ -43,7 +43,9 @@ class NumberCompare
|
||||
{
|
||||
$this->test = $test;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException If the test is not understood
|
||||
*/
|
||||
public function test($number)
|
||||
{
|
||||
if (!preg_match('{^([<>]=?)?(.*?)([kmg]i?)?$}i', $this->test, $matches))
|
||||
|
Reference in New Issue
Block a user