Merge branch '2.4'

* 2.4:
  [Validator] added missing @Target
  [Validator] fixed @Target config
  added @Target annotations
  [Process] Add missing docblocks, remove variable declarations

Conflicts:
	src/Symfony/Component/Process/Process.php
	src/Symfony/Component/Process/ProcessBuilder.php
This commit is contained in:
Fabien Potencier 2014-04-23 16:08:54 +02:00
commit 61e287e0b6
53 changed files with 121 additions and 8 deletions

View File

@ -17,6 +17,8 @@ use Symfony\Component\Validator\Constraint;
* Constraint for the Unique Entity validator * Constraint for the Unique Entity validator
* *
* @Annotation * @Annotation
* @Target("CLASS")
*
* @author Benjamin Eberlei <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
*/ */
class UniqueEntity extends Constraint class UniqueEntity extends Constraint

View File

@ -57,7 +57,7 @@ class Process
private $outputDisabled = false; private $outputDisabled = false;
private $stdout; private $stdout;
private $stderr; private $stderr;
private $enhanceWindowsCompatibility; private $enhanceWindowsCompatibility = true;
private $enhanceSigchildCompatibility; private $enhanceSigchildCompatibility;
private $process; private $process;
private $status = self::STATUS_READY; private $status = self::STATUS_READY;
@ -149,15 +149,13 @@ class Process
// on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected // on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected
// @see : https://bugs.php.net/bug.php?id=51800 // @see : https://bugs.php.net/bug.php?id=51800
// @see : https://bugs.php.net/bug.php?id=50524 // @see : https://bugs.php.net/bug.php?id=50524
if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || defined('PHP_WINDOWS_VERSION_BUILD'))) { if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || defined('PHP_WINDOWS_VERSION_BUILD'))) {
$this->cwd = getcwd(); $this->cwd = getcwd();
} }
if (null !== $env) { if (null !== $env) {
$this->setEnv($env); $this->setEnv($env);
} else {
$this->env = null;
} }
$this->stdin = $stdin; $this->stdin = $stdin;
$this->setTimeout($timeout); $this->setTimeout($timeout);
$this->useFileHandles = defined('PHP_WINDOWS_VERSION_BUILD'); $this->useFileHandles = defined('PHP_WINDOWS_VERSION_BUILD');
@ -1426,7 +1424,7 @@ class Process
/** /**
* Ensures the process is running or terminated, throws a LogicException if the process has a not started. * Ensures the process is running or terminated, throws a LogicException if the process has a not started.
* *
* @param $functionName The function name that was called. * @param string $functionName The function name that was called.
* *
* @throws LogicException If the process has not run. * @throws LogicException If the process has not run.
*/ */
@ -1440,7 +1438,7 @@ class Process
/** /**
* Ensures the process is terminated, throws a LogicException if the process has a status different than `terminated`. * Ensures the process is terminated, throws a LogicException if the process has a status different than `terminated`.
* *
* @param $functionName The function name that was called. * @param string $functionName The function name that was called.
* *
* @throws LogicException If the process is not yet terminated. * @throws LogicException If the process is not yet terminated.
*/ */

View File

@ -31,11 +31,23 @@ class ProcessBuilder
private $prefix = array(); private $prefix = array();
private $outputDisabled = false; private $outputDisabled = false;
/**
* Constructor
*
* @param string[] $arguments An array of arguments
*/
public function __construct(array $arguments = array()) public function __construct(array $arguments = array())
{ {
$this->arguments = $arguments; $this->arguments = $arguments;
} }
/**
* Creates a process builder instance.
*
* @param string[] $arguments An array of arguments
*
* @return ProcessBuilder
*/
public static function create(array $arguments = array()) public static function create(array $arguments = array())
{ {
return new static($arguments); return new static($arguments);
@ -72,7 +84,12 @@ class ProcessBuilder
} }
/** /**
* @param array $arguments * Sets the arguments of the process.
*
* Arguments must not be escaped.
* Previous arguments are removed.
*
* @param string[] $arguments
* *
* @return ProcessBuilder * @return ProcessBuilder
*/ */
@ -83,6 +100,13 @@ class ProcessBuilder
return $this; return $this;
} }
/**
* Sets the working directory.
*
* @param null|string $cwd The working directory
*
* @return ProcessBuilder
*/
public function setWorkingDirectory($cwd) public function setWorkingDirectory($cwd)
{ {
$this->cwd = $cwd; $this->cwd = $cwd;
@ -90,6 +114,13 @@ class ProcessBuilder
return $this; return $this;
} }
/**
* Sets whether environment variables will be inherited or not.
*
* @param bool $inheritEnv
*
* @return ProcessBuilder
*/
public function inheritEnvironmentVariables($inheritEnv = true) public function inheritEnvironmentVariables($inheritEnv = true)
{ {
$this->inheritEnv = $inheritEnv; $this->inheritEnv = $inheritEnv;
@ -97,6 +128,17 @@ class ProcessBuilder
return $this; return $this;
} }
/**
* Sets an environment variable
*
* Setting a variable overrides its previous value. Use `null` to unset a
* defined environment variable.
*
* @param string $name The variable name
* @param null|string $value The variable value
*
* @return ProcessBuilder
*/
public function setEnv($name, $value) public function setEnv($name, $value)
{ {
$this->env[$name] = $value; $this->env[$name] = $value;
@ -111,6 +153,13 @@ class ProcessBuilder
return $this; return $this;
} }
/**
* Sets the input of the process.
*
* @param string $stdin The input as a string
*
* @return ProcessBuilder
*/
public function setInput($stdin) public function setInput($stdin)
{ {
$this->stdin = $stdin; $this->stdin = $stdin;
@ -148,6 +197,14 @@ class ProcessBuilder
return $this; return $this;
} }
/**
* Adds a proc_open option.
*
* @param string $name The option name
* @param string $value The option value
*
* @return ProcessBuilder
*/
public function setOption($name, $value) public function setOption($name, $value)
{ {
$this->options[$name] = $value; $this->options[$name] = $value;
@ -179,6 +236,13 @@ class ProcessBuilder
return $this; return $this;
} }
/**
* Creates a Process instance and returns it.
*
* @return Process
*
* @throws LogicException In case no arguments have been provided
*/
public function getProcess() public function getProcess()
{ {
if (0 === count($this->prefix) && 0 === count($this->arguments)) { if (0 === count($this->prefix) && 0 === count($this->arguments)) {

View File

@ -15,6 +15,7 @@ namespace Symfony\Component\Routing\Annotation;
* Annotation class for @Route(). * Annotation class for @Route().
* *
* @Annotation * @Annotation
* @Target({"CLASS", "METHOD"})
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/ */
class UserPassword extends Constraint class UserPassword extends Constraint
{ {

View File

@ -16,6 +16,7 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -17,6 +17,7 @@ use Symfony\Component\Validator\Constraint;
* Metadata for the CardSchemeValidator. * Metadata for the CardSchemeValidator.
* *
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/ */
class CardScheme extends Constraint class CardScheme extends Constraint
{ {

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -16,6 +16,7 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraints\Optional as BaseOptional;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraints\Required as BaseRequired;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -16,6 +16,7 @@ use Symfony\Component\Validator\Exception\MissingOptionsException;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Miha Vrhovnik <miha.vrhovnik@pagein.si> * @author Miha Vrhovnik <miha.vrhovnik@pagein.si>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>
*/ */

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>
*/ */

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>
*/ */

View File

@ -50,6 +50,7 @@ use Symfony\Component\Validator\Exception\OutOfBoundsException;
* $validator->validate($address, null, "Address") * $validator->validate($address, null, "Address")
* *
* @Annotation * @Annotation
* @Target("CLASS")
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,8 +15,8 @@ namespace Symfony\Component\Validator\Constraints;
* Annotation to define a group sequence provider * Annotation to define a group sequence provider
* *
* @Annotation * @Annotation
* @Target("CLASS")
*/ */
class GroupSequenceProvider class GroupSequenceProvider
{ {
} }

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/ */
class Iban extends Constraint class Iban extends Constraint
{ {

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>
*/ */

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @api * @api
*/ */

View File

@ -18,6 +18,7 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
* Validates that a value is a valid IP address * Validates that a value is a valid IP address
* *
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* @author Joseph Bielawski <stloyd@gmail.com> * @author Joseph Bielawski <stloyd@gmail.com>

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author The Whole Life To Learn <thewholelifetolearn@gmail.com> * @author The Whole Life To Learn <thewholelifetolearn@gmail.com>
* @author Manuel Reinhard <manu@sprain.ch> * @author Manuel Reinhard <manu@sprain.ch>

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Antonio J. García Lagar <aj@garcialagar.es> * @author Antonio J. García Lagar <aj@garcialagar.es>
*/ */

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -16,6 +16,7 @@ use Symfony\Component\Validator\Exception\MissingOptionsException;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>
*/ */

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>
*/ */

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -17,6 +17,7 @@ use Symfony\Component\Validator\Constraint;
* Metadata for the LuhnValidator. * Metadata for the LuhnValidator.
* *
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/ */
class Luhn extends Constraint class Luhn extends Constraint
{ {

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>
*/ */

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>
*/ */

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */

View File

@ -16,6 +16,7 @@ use Symfony\Component\Validator\Exception\MissingOptionsException;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Constraints;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraint;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *

View File

@ -16,6 +16,7 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
/** /**
* @Annotation * @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *