From 8bc2fbb934fc1dff897acfc206aaf10835cbfb68 Mon Sep 17 00:00:00 2001 From: Titouan Galopin Date: Fri, 8 Dec 2017 14:17:14 +0100 Subject: [PATCH] Remove some unused variables and properties --- .../RegisterEventListenersAndSubscribersPass.php | 2 +- src/Symfony/Component/Dotenv/Dotenv.php | 2 +- .../DataTransformer/DateIntervalToStringTransformer.php | 7 ++----- .../RemoveEmptyControllerArgumentLocatorsPass.php | 2 +- src/Symfony/Component/Serializer/Encoder/JsonDecode.php | 3 +-- src/Symfony/Component/Serializer/Encoder/JsonEncode.php | 3 +-- .../Validator/Test/ConstraintValidatorTestCase.php | 3 +-- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php index f918d0d211..e7015fd1e4 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php @@ -112,7 +112,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface } $instance['event'] = array($instance['event']); - if ($lazy = !empty($instance['lazy'])) { + if (!empty($instance['lazy'])) { $this->container->getDefinition($id)->setPublic(true); } } diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index dde92f46af..3ae735c7db 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -112,7 +112,7 @@ final class Dotenv $this->end = strlen($this->data); $this->state = self::STATE_VARNAME; $this->values = array(); - $name = $value = ''; + $name = ''; $this->skipEmptyLines(); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php index dffe146623..4624e585e7 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php @@ -23,20 +23,17 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException; class DateIntervalToStringTransformer implements DataTransformerInterface { private $format; - private $parseSigned; /** * Transforms a \DateInterval instance to a string. * * @see \DateInterval::format() for supported formats * - * @param string $format The date format - * @param bool $parseSigned Whether to parse as a signed interval + * @param string $format The date format */ - public function __construct($format = 'P%yY%mM%dDT%hH%iM%sS', $parseSigned = false) + public function __construct($format = 'P%yY%mM%dDT%hH%iM%sS') { $this->format = $format; - $this->parseSigned = $parseSigned; } /** diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php index 440b0d0025..ab50cec353 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php @@ -50,7 +50,7 @@ class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface $action = substr(strrchr($controller, ':'), 1); $id = substr($controller, 0, -1 - strlen($action)); $controllerDef = $container->getDefinition($id); - foreach ($controllerDef->getMethodCalls() as list($method, $args)) { + foreach ($controllerDef->getMethodCalls() as list($method)) { if (0 === strcasecmp($action, $method)) { $reason = sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id); break; diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php index 213caab9fe..455d1378c3 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php @@ -24,7 +24,6 @@ class JsonDecode implements DecoderInterface private $associative; private $recursionDepth; - private $lastError = JSON_ERROR_NONE; /** * Constructs a new JsonDecode instance. @@ -75,7 +74,7 @@ class JsonDecode implements DecoderInterface $decodedData = json_decode($data, $associative, $recursionDepth, $options); - if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) { + if (JSON_ERROR_NONE !== json_last_error()) { throw new UnexpectedValueException(json_last_error_msg()); } diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php index 620193f206..6ed558f7dc 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php @@ -21,7 +21,6 @@ use Symfony\Component\Serializer\Exception\UnexpectedValueException; class JsonEncode implements EncoderInterface { private $options; - private $lastError = JSON_ERROR_NONE; public function __construct($bitmask = 0) { @@ -39,7 +38,7 @@ class JsonEncode implements EncoderInterface $encodedJson = json_encode($data, $context['json_encode_options']); - if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) { + if (JSON_ERROR_NONE !== json_last_error()) { throw new UnexpectedValueException(json_last_error_msg()); } diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php index c2932f81e8..8e3b2a9f79 100644 --- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php @@ -227,7 +227,6 @@ class ConstraintViolationAssertion private $parameters = array(); private $invalidValue = 'InvalidValue'; private $propertyPath = 'property.path'; - private $translationDomain; private $plural; private $code; private $constraint; @@ -264,7 +263,7 @@ class ConstraintViolationAssertion public function setTranslationDomain($translationDomain) { - $this->translationDomain = $translationDomain; + // no-op for BC return $this; }