diff --git a/src/Symfony/Components/Console/Application.php b/src/Symfony/Components/Console/Application.php index e26319be75..e9e4a469ea 100644 --- a/src/Symfony/Components/Console/Application.php +++ b/src/Symfony/Components/Console/Application.php @@ -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) { diff --git a/src/Symfony/Components/Console/Command/Command.php b/src/Symfony/Components/Console/Command/Command.php index bbde5f94e0..6813f31791 100644 --- a/src/Symfony/Components/Console/Command/Command.php +++ b/src/Symfony/Components/Console/Command/Command.php @@ -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) { diff --git a/src/Symfony/Components/Console/Helper/DialogHelper.php b/src/Symfony/Components/Console/Helper/DialogHelper.php index a19c3d949a..154143a1a6 100644 --- a/src/Symfony/Components/Console/Helper/DialogHelper.php +++ b/src/Symfony/Components/Console/Helper/DialogHelper.php @@ -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) { diff --git a/src/Symfony/Components/Console/Input/ArgvInput.php b/src/Symfony/Components/Console/Input/ArgvInput.php index a140219bfd..ec3820c387 100644 --- a/src/Symfony/Components/Console/Input/ArgvInput.php +++ b/src/Symfony/Components/Console/Input/ArgvInput.php @@ -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) { diff --git a/src/Symfony/Components/Console/Input/ArrayInput.php b/src/Symfony/Components/Console/Input/ArrayInput.php index 3ae6154d30..4f4e624b10 100644 --- a/src/Symfony/Components/Console/Input/ArrayInput.php +++ b/src/Symfony/Components/Console/Input/ArrayInput.php @@ -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) { diff --git a/src/Symfony/Components/Console/Input/Input.php b/src/Symfony/Components/Console/Input/Input.php index 9e9e5f4826..9b5423bc70 100644 --- a/src/Symfony/Components/Console/Input/Input.php +++ b/src/Symfony/Components/Console/Input/Input.php @@ -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) { diff --git a/src/Symfony/Components/Console/Input/InputArgument.php b/src/Symfony/Components/Console/Input/InputArgument.php index 9b5925b4bf..43bbacf9cd 100644 --- a/src/Symfony/Components/Console/Input/InputArgument.php +++ b/src/Symfony/Components/Console/Input/InputArgument.php @@ -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) { diff --git a/src/Symfony/Components/Console/Input/InputDefinition.php b/src/Symfony/Components/Console/Input/InputDefinition.php index 2977e7fd6d..1903d04fed 100644 --- a/src/Symfony/Components/Console/Input/InputDefinition.php +++ b/src/Symfony/Components/Console/Input/InputDefinition.php @@ -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) { diff --git a/src/Symfony/Components/Console/Input/InputOption.php b/src/Symfony/Components/Console/Input/InputOption.php index 46a47d0d57..2937c5810a 100644 --- a/src/Symfony/Components/Console/Input/InputOption.php +++ b/src/Symfony/Components/Console/Input/InputOption.php @@ -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) { diff --git a/src/Symfony/Components/Console/Input/StringInput.php b/src/Symfony/Components/Console/Input/StringInput.php index c66f7b9dc4..c250c687a9 100644 --- a/src/Symfony/Components/Console/Input/StringInput.php +++ b/src/Symfony/Components/Console/Input/StringInput.php @@ -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); diff --git a/src/Symfony/Components/Console/Output/Output.php b/src/Symfony/Components/Console/Output/Output.php index 7bfa8bf012..ef251393bb 100644 --- a/src/Symfony/Components/Console/Output/Output.php +++ b/src/Symfony/Components/Console/Output/Output.php @@ -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('##i', array($this, 'replaceEndStyle'), $message); } + /** + * @throws \InvalidArgumentException When style is unknown + */ protected function replaceStartStyle($match) { if (!$this->decorated) diff --git a/src/Symfony/Components/Console/Output/StreamOutput.php b/src/Symfony/Components/Console/Output/StreamOutput.php index fdb74debed..3023012d7a 100644 --- a/src/Symfony/Components/Console/Output/StreamOutput.php +++ b/src/Symfony/Components/Console/Output/StreamOutput.php @@ -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) { diff --git a/src/Symfony/Components/Console/Shell.php b/src/Symfony/Components/Console/Shell.php index f91965c0bd..6e4a08ac88 100644 --- a/src/Symfony/Components/Console/Shell.php +++ b/src/Symfony/Components/Console/Shell.php @@ -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) { diff --git a/src/Symfony/Components/CssSelector/Node/AttribNode.php b/src/Symfony/Components/CssSelector/Node/AttribNode.php index 74a2862b5d..fe7300045c 100644 --- a/src/Symfony/Components/CssSelector/Node/AttribNode.php +++ b/src/Symfony/Components/CssSelector/Node/AttribNode.php @@ -53,6 +53,9 @@ class AttribNode implements NodeInterface } } + /** + * @throws SyntaxError When unknown operator is found + */ public function toXpath() { $path = $this->selector->toXpath(); diff --git a/src/Symfony/Components/CssSelector/Node/CombinedSelectorNode.php b/src/Symfony/Components/CssSelector/Node/CombinedSelectorNode.php index 099a1d9acc..eec316e366 100644 --- a/src/Symfony/Components/CssSelector/Node/CombinedSelectorNode.php +++ b/src/Symfony/Components/CssSelector/Node/CombinedSelectorNode.php @@ -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])) diff --git a/src/Symfony/Components/CssSelector/Node/FunctionNode.php b/src/Symfony/Components/CssSelector/Node/FunctionNode.php index c7c18ae926..a18b4872de 100644 --- a/src/Symfony/Components/CssSelector/Node/FunctionNode.php +++ b/src/Symfony/Components/CssSelector/Node/FunctionNode.php @@ -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(); diff --git a/src/Symfony/Components/CssSelector/Node/PseudoNode.php b/src/Symfony/Components/CssSelector/Node/PseudoNode.php index 8723d37348..99867657b3 100644 --- a/src/Symfony/Components/CssSelector/Node/PseudoNode.php +++ b/src/Symfony/Components/CssSelector/Node/PseudoNode.php @@ -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() == '*') diff --git a/src/Symfony/Components/CssSelector/Parser.php b/src/Symfony/Components/CssSelector/Parser.php index 5f00e7f714..6812005c5f 100644 --- a/src/Symfony/Components/CssSelector/Parser.php +++ b/src/Symfony/Components/CssSelector/Parser.php @@ -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(); diff --git a/src/Symfony/Components/CssSelector/Tokenizer.php b/src/Symfony/Components/CssSelector/Tokenizer.php index 5f657b6cc6..c83b41cfbd 100644 --- a/src/Symfony/Components/CssSelector/Tokenizer.php +++ b/src/Symfony/Components/CssSelector/Tokenizer.php @@ -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; diff --git a/src/Symfony/Components/DependencyInjection/Builder.php b/src/Symfony/Components/DependencyInjection/Builder.php index 65ee52894f..5eddaeea0e 100644 --- a/src/Symfony/Components/DependencyInjection/Builder.php +++ b/src/Symfony/Components/DependencyInjection/Builder.php @@ -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) { diff --git a/src/Symfony/Components/DependencyInjection/Container.php b/src/Symfony/Components/DependencyInjection/Container.php index c6a011a218..d864f2d831 100644 --- a/src/Symfony/Components/DependencyInjection/Container.php +++ b/src/Symfony/Components/DependencyInjection/Container.php @@ -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) { diff --git a/src/Symfony/Components/DependencyInjection/Dumper/Dumper.php b/src/Symfony/Components/DependencyInjection/Dumper/Dumper.php index 4e75f00cf4..d32af85397 100644 --- a/src/Symfony/Components/DependencyInjection/Dumper/Dumper.php +++ b/src/Symfony/Components/DependencyInjection/Dumper/Dumper.php @@ -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()) { diff --git a/src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php index a91e0b6908..74db69c7c9 100644 --- a/src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php @@ -227,6 +227,9 @@ EOF; return $args; } + /** + * @throws \RuntimeException When trying to dump object or ressource + */ static public function phpToXml($value) { switch (true) diff --git a/src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php index 7836586496..1a5a9191f6 100644 --- a/src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php @@ -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)) diff --git a/src/Symfony/Components/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Components/DependencyInjection/Loader/FileLoader.php index bd65728b0a..25e52f8e44 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Components/DependencyInjection/Loader/FileLoader.php @@ -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); diff --git a/src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php b/src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php index 6df27729fb..35878fd0a4 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php +++ b/src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php @@ -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) { diff --git a/src/Symfony/Components/DependencyInjection/Loader/LoaderExtension.php b/src/Symfony/Components/DependencyInjection/Loader/LoaderExtension.php index 23f7e02985..2edc2c0994 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/LoaderExtension.php +++ b/src/Symfony/Components/DependencyInjection/Loader/LoaderExtension.php @@ -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) { diff --git a/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php index 35b5d4a043..5bb3feee9b 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php @@ -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) diff --git a/src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php index 1926ce7e3d..c1d893850d 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php @@ -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) diff --git a/src/Symfony/Components/EventDispatcher/Event.php b/src/Symfony/Components/EventDispatcher/Event.php index 21c79d1fd5..f9d5070223 100644 --- a/src/Symfony/Components/EventDispatcher/Event.php +++ b/src/Symfony/Components/EventDispatcher/Event.php @@ -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) { diff --git a/src/Symfony/Components/OutputEscaper/ArrayDecorator.php b/src/Symfony/Components/OutputEscaper/ArrayDecorator.php index c0752f4ffd..e024a6bd87 100644 --- a/src/Symfony/Components/OutputEscaper/ArrayDecorator.php +++ b/src/Symfony/Components/OutputEscaper/ArrayDecorator.php @@ -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) { diff --git a/src/Symfony/Components/OutputEscaper/IteratorDecorator.php b/src/Symfony/Components/OutputEscaper/IteratorDecorator.php index cd70dd8bbf..ee02214257 100644 --- a/src/Symfony/Components/OutputEscaper/IteratorDecorator.php +++ b/src/Symfony/Components/OutputEscaper/IteratorDecorator.php @@ -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) { diff --git a/src/Symfony/Components/RequestHandler/RequestHandler.php b/src/Symfony/Components/RequestHandler/RequestHandler.php index 1346c3a30d..434af5bb24 100644 --- a/src/Symfony/Components/RequestHandler/RequestHandler.php +++ b/src/Symfony/Components/RequestHandler/RequestHandler.php @@ -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) { diff --git a/src/Symfony/Components/RequestHandler/Response.php b/src/Symfony/Components/RequestHandler/Response.php index 89437d78b5..ff6b9ef594 100644 --- a/src/Symfony/Components/RequestHandler/Response.php +++ b/src/Symfony/Components/RequestHandler/Response.php @@ -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) { diff --git a/src/Symfony/Components/Routing/Generator/Dumper/GeneratorDumper.php b/src/Symfony/Components/Routing/Generator/Dumper/GeneratorDumper.php index 89f263365c..e6d5d65f79 100644 --- a/src/Symfony/Components/Routing/Generator/Dumper/GeneratorDumper.php +++ b/src/Symfony/Components/Routing/Generator/Dumper/GeneratorDumper.php @@ -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()) { diff --git a/src/Symfony/Components/Routing/Generator/UrlGenerator.php b/src/Symfony/Components/Routing/Generator/UrlGenerator.php index aeb691b37f..75e154d726 100644 --- a/src/Symfony/Components/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Components/Routing/Generator/UrlGenerator.php @@ -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); diff --git a/src/Symfony/Components/Routing/Loader/FileLoader.php b/src/Symfony/Components/Routing/Loader/FileLoader.php index a8bda96e4f..074754e359 100644 --- a/src/Symfony/Components/Routing/Loader/FileLoader.php +++ b/src/Symfony/Components/Routing/Loader/FileLoader.php @@ -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); diff --git a/src/Symfony/Components/Routing/Loader/XmlFileLoader.php b/src/Symfony/Components/Routing/Loader/XmlFileLoader.php index dddba62632..17247f7b07 100644 --- a/src/Symfony/Components/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Components/Routing/Loader/XmlFileLoader.php @@ -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); diff --git a/src/Symfony/Components/Routing/Loader/YamlFileLoader.php b/src/Symfony/Components/Routing/Loader/YamlFileLoader.php index a1f10de067..4b8ce307de 100644 --- a/src/Symfony/Components/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Components/Routing/Loader/YamlFileLoader.php @@ -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'])) diff --git a/src/Symfony/Components/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/src/Symfony/Components/Routing/Matcher/Dumper/ApacheMatcherDumper.php index edbb7b5732..ef0cc9bf1c 100644 --- a/src/Symfony/Components/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ b/src/Symfony/Components/Routing/Matcher/Dumper/ApacheMatcherDumper.php @@ -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()) { diff --git a/src/Symfony/Components/Routing/Matcher/Dumper/MatcherDumper.php b/src/Symfony/Components/Routing/Matcher/Dumper/MatcherDumper.php index 41e6eef0b1..12e72ac0f5 100644 --- a/src/Symfony/Components/Routing/Matcher/Dumper/MatcherDumper.php +++ b/src/Symfony/Components/Routing/Matcher/Dumper/MatcherDumper.php @@ -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()) { diff --git a/src/Symfony/Components/Routing/RouteCollection.php b/src/Symfony/Components/Routing/RouteCollection.php index ea9c49be46..99a9f8c031 100644 --- a/src/Symfony/Components/Routing/RouteCollection.php +++ b/src/Symfony/Components/Routing/RouteCollection.php @@ -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) { diff --git a/src/Symfony/Components/Routing/RouteCompiler.php b/src/Symfony/Components/Routing/RouteCompiler.php index fc01978f59..f89296bf0d 100644 --- a/src/Symfony/Components/Routing/RouteCompiler.php +++ b/src/Symfony/Components/Routing/RouteCompiler.php @@ -127,6 +127,8 @@ class RouteCompiler implements RouteCompilerInterface /** * Tokenizes the route. + * + * @throws \InvalidArgumentException When route can't be parsed */ protected function tokenize() { diff --git a/src/Symfony/Components/Routing/Router.php b/src/Symfony/Components/Routing/Router.php index 48795b14df..8b760d9e57 100644 --- a/src/Symfony/Components/Routing/Router.php +++ b/src/Symfony/Components/Routing/Router.php @@ -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)); diff --git a/src/Symfony/Components/Yaml/Inline.php b/src/Symfony/Components/Yaml/Inline.php index b94f7a15ea..cd07d9c6b6 100644 --- a/src/Symfony/Components/Yaml/Inline.php +++ b/src/Symfony/Components/Yaml/Inline.php @@ -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) { diff --git a/src/Symfony/Components/Yaml/Parser.php b/src/Symfony/Components/Yaml/Parser.php index b47a0dd0b8..a20896bcbe 100644 --- a/src/Symfony/Components/Yaml/Parser.php +++ b/src/Symfony/Components/Yaml/Parser.php @@ -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) { diff --git a/src/Symfony/Components/Yaml/Yaml.php b/src/Symfony/Components/Yaml/Yaml.php index ff8671d5fe..7c744a578e 100644 --- a/src/Symfony/Components/Yaml/Yaml.php +++ b/src/Symfony/Components/Yaml/Yaml.php @@ -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) { diff --git a/src/Symfony/Foundation/ClassCollectionLoader.php b/src/Symfony/Foundation/ClassCollectionLoader.php index 43ab918926..d97bf6787e 100644 --- a/src/Symfony/Foundation/ClassCollectionLoader.php +++ b/src/Symfony/Foundation/ClassCollectionLoader.php @@ -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'; diff --git a/src/Symfony/Foundation/Debug/ErrorHandler.php b/src/Symfony/Foundation/Debug/ErrorHandler.php index cc67b0cf8c..4dda26cdd2 100644 --- a/src/Symfony/Foundation/Debug/ErrorHandler.php +++ b/src/Symfony/Foundation/Debug/ErrorHandler.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) diff --git a/src/Symfony/Foundation/Kernel.php b/src/Symfony/Foundation/Kernel.php index 666fd137dc..25ae066317 100644 --- a/src/Symfony/Foundation/Kernel.php +++ b/src/Symfony/Foundation/Kernel.php @@ -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() { diff --git a/src/Symfony/Framework/DoctrineBundle/Command/BuildDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/BuildDoctrineCommand.php index 47ba1b1d59..530fb406ce 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/BuildDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/BuildDoctrineCommand.php @@ -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) { diff --git a/src/Symfony/Framework/DoctrineBundle/Command/DatabaseToolDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/DatabaseToolDoctrineCommand.php index df9b5d7fef..ed440f8522 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/DatabaseToolDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/DatabaseToolDoctrineCommand.php @@ -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) { diff --git a/src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php index 537758422a..d551bbd279 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php @@ -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) { diff --git a/src/Symfony/Framework/DoctrineBundle/Command/InitEntityDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/InitEntityDoctrineCommand.php index cc8d3583bd..b30d8a8b40 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/InitEntityDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/InitEntityDoctrineCommand.php @@ -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) { diff --git a/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php b/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php index f22563e5a9..12ae1247ee 100644 --- a/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php +++ b/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php @@ -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')) diff --git a/src/Symfony/Framework/WebBundle/Command/AssetsInstallCommand.php b/src/Symfony/Framework/WebBundle/Command/AssetsInstallCommand.php index 915a463ce5..fa3b9ad12a 100644 --- a/src/Symfony/Framework/WebBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Framework/WebBundle/Command/AssetsInstallCommand.php @@ -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) { diff --git a/src/Symfony/Framework/WebBundle/Command/InitBundleCommand.php b/src/Symfony/Framework/WebBundle/Command/InitBundleCommand.php index 1a78024fce..7fe622bbef 100644 --- a/src/Symfony/Framework/WebBundle/Command/InitBundleCommand.php +++ b/src/Symfony/Framework/WebBundle/Command/InitBundleCommand.php @@ -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) { diff --git a/src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php b/src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php index 1108fa3ec4..952f4c61ef 100644 --- a/src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php @@ -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))); diff --git a/src/Symfony/Framework/WebBundle/Controller/ExceptionController.php b/src/Symfony/Framework/WebBundle/Controller/ExceptionController.php index 9f78bc481d..a8ecc0bd24 100644 --- a/src/Symfony/Framework/WebBundle/Controller/ExceptionController.php +++ b/src/Symfony/Framework/WebBundle/Controller/ExceptionController.php @@ -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'; diff --git a/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php b/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php index edaf3224f6..9984af5a0f 100644 --- a/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php +++ b/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php @@ -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(); diff --git a/src/Symfony/Framework/WebBundle/Session/PdoSession.php b/src/Symfony/Framework/WebBundle/Session/PdoSession.php index ea776298bc..218c332aba 100644 --- a/src/Symfony/Framework/WebBundle/Session/PdoSession.php +++ b/src/Symfony/Framework/WebBundle/Session/PdoSession.php @@ -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 DatabaseException 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 DatabaseException 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 DatabaseException 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 DatabaseException 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 DatabaseException If the session data cannot be written + * @throws \RuntimeException If the session data cannot be written */ public function sessionWrite($id, $data) { diff --git a/src/Symfony/Framework/WebBundle/Session/SessionInterface.php b/src/Symfony/Framework/WebBundle/Session/SessionInterface.php index cbf91228ea..fb2661d158 100644 --- a/src/Symfony/Framework/WebBundle/Session/SessionInterface.php +++ b/src/Symfony/Framework/WebBundle/Session/SessionInterface.php @@ -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); } diff --git a/src/Symfony/Framework/WebBundle/Templating/Engine.php b/src/Symfony/Framework/WebBundle/Templating/Engine.php index e4f6126df8..2c42ad7158 100644 --- a/src/Symfony/Framework/WebBundle/Templating/Engine.php +++ b/src/Symfony/Framework/WebBundle/Templating/Engine.php @@ -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])) diff --git a/src/Symfony/Framework/WebBundle/Util/Filesystem.php b/src/Symfony/Framework/WebBundle/Util/Filesystem.php index 9962ae0e7e..63b06f4b17 100644 --- a/src/Symfony/Framework/WebBundle/Util/Filesystem.php +++ b/src/Symfony/Framework/WebBundle/Util/Filesystem.php @@ -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()) { diff --git a/src/Symfony/Framework/WebBundle/Util/Finder.php b/src/Symfony/Framework/WebBundle/Util/Finder.php index c8cf0eb446..c163ccc2ea 100644 --- a/src/Symfony/Framework/WebBundle/Util/Finder.php +++ b/src/Symfony/Framework/WebBundle/Util/Finder.php @@ -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() { diff --git a/src/Symfony/Framework/WebBundle/Util/NumberCompare.php b/src/Symfony/Framework/WebBundle/Util/NumberCompare.php index f1d1f01dbe..5e7a7e6ef9 100644 --- a/src/Symfony/Framework/WebBundle/Util/NumberCompare.php +++ b/src/Symfony/Framework/WebBundle/Util/NumberCompare.php @@ -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))