unify constructor initialization style throughout symfony

This commit is contained in:
Tobias Schultze 2013-11-10 18:06:47 +01:00
parent b9b7c8ac8e
commit 111ac18232
71 changed files with 214 additions and 397 deletions

View File

@ -24,12 +24,11 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
{
protected $registry;
private $cache;
private $cache = array();
public function __construct(ManagerRegistry $registry)
{
$this->registry = $registry;
$this->cache = array();
}
/**
@ -90,7 +89,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
return null;
}
/* @var ClassMetadataInfo $classMetadata */
/** @var ClassMetadataInfo $classMetadata */
$classMetadata = $classMetadatas[0];
// Check whether the field exists and is nullable or not

View File

@ -29,12 +29,12 @@ class Scope
/**
* @var array
*/
private $data;
private $data = array();
/**
* @var boolean
*/
private $left;
private $left = false;
/**
* @param Scope $parent
@ -42,8 +42,6 @@ class Scope
public function __construct(Scope $parent = null)
{
$this->parent = $parent;
$this->left = false;
$this->data = array();
}
/**

View File

@ -25,7 +25,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
class TemplateNameParser implements TemplateNameParserInterface
{
protected $kernel;
protected $cache;
protected $cache = array();
/**
* Constructor.
@ -35,7 +35,6 @@ class TemplateNameParser implements TemplateNameParserInterface
public function __construct(KernelInterface $kernel)
{
$this->kernel = $kernel;
$this->cache = array();
}
/**

View File

@ -24,7 +24,10 @@ use Symfony\Component\Config\ConfigCache;
class Translator extends BaseTranslator
{
protected $container;
protected $options;
protected $options = array(
'cache_dir' => null,
'debug' => false,
);
protected $loaderIds;
/**
@ -47,11 +50,6 @@ class Translator extends BaseTranslator
$this->container = $container;
$this->loaderIds = $loaderIds;
$this->options = array(
'cache_dir' => null,
'debug' => false,
);
// check option names
if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
throw new \InvalidArgumentException(sprintf('The Translator does not support the following options: \'%s\'.', implode('\', \'', $diff)));

View File

@ -14,7 +14,6 @@ namespace Symfony\Bundle\SecurityBundle\DependencyInjection;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
@ -23,7 +22,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\ExpressionLanguage\Expression;
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
/**

View File

@ -26,7 +26,7 @@ use Symfony\Component\Templating\Helper\Helper;
class LogoutUrlHelper extends Helper
{
private $container;
private $listeners;
private $listeners = array();
private $router;
/**
@ -39,7 +39,6 @@ class LogoutUrlHelper extends Helper
{
$this->container = $container;
$this->router = $router;
$this->listeners = array();
}
/**

View File

@ -32,19 +32,19 @@ abstract class Client
{
protected $history;
protected $cookieJar;
protected $server;
protected $server = array();
protected $internalRequest;
protected $request;
protected $internalResponse;
protected $response;
protected $crawler;
protected $insulated;
protected $insulated = false;
protected $redirect;
protected $followRedirects;
protected $followRedirects = true;
private $maxRedirects;
private $redirectCount;
private $isMainRequest;
private $maxRedirects = -1;
private $redirectCount = 0;
private $isMainRequest = true;
/**
* Constructor.
@ -58,13 +58,8 @@ abstract class Client
public function __construct(array $server = array(), History $history = null, CookieJar $cookieJar = null)
{
$this->setServerParameters($server);
$this->history = null === $history ? new History() : $history;
$this->cookieJar = null === $cookieJar ? new CookieJar() : $cookieJar;
$this->insulated = false;
$this->followRedirects = true;
$this->maxRedirects = -1;
$this->redirectCount = 0;
$this->isMainRequest = true;
$this->history = $history ?: new History();
$this->cookieJar = $cookieJar ?: new CookieJar();
}
/**

View File

@ -21,14 +21,6 @@ class History
protected $stack = array();
protected $position = -1;
/**
* Constructor.
*/
public function __construct()
{
$this->clear();
}
/**
* Clears the history.
*/

View File

@ -22,34 +22,14 @@ use Symfony\Component\Config\Definition\Exception\UnsetKeyException;
*/
class ArrayNode extends BaseNode implements PrototypeNodeInterface
{
protected $xmlRemappings;
protected $children;
protected $allowFalse;
protected $allowNewKeys;
protected $addIfNotSet;
protected $performDeepMerging;
protected $ignoreExtraKeys;
protected $normalizeKeys;
/**
* Constructor.
*
* @param string $name The Node's name
* @param NodeInterface $parent The node parent
*/
public function __construct($name, NodeInterface $parent = null)
{
parent::__construct($name, $parent);
$this->children = array();
$this->xmlRemappings = array();
$this->removeKeyAttribute = true;
$this->allowFalse = false;
$this->addIfNotSet = false;
$this->allowNewKeys = true;
$this->performDeepMerging = true;
$this->normalizeKeys = true;
}
protected $xmlRemappings = array();
protected $children = array();
protected $allowFalse = false;
protected $allowNewKeys = true;
protected $addIfNotSet = false;
protected $performDeepMerging = true;
protected $ignoreExtraKeys = false;
protected $normalizeKeys = true;
public function setNormalizeKeys($normalizeKeys)
{

View File

@ -24,11 +24,11 @@ abstract class BaseNode implements NodeInterface
{
protected $name;
protected $parent;
protected $normalizationClosures;
protected $finalValidationClosures;
protected $allowOverwrite;
protected $required;
protected $equivalentValues;
protected $normalizationClosures = array();
protected $finalValidationClosures = array();
protected $allowOverwrite = true;
protected $required = false;
protected $equivalentValues = array();
protected $attributes = array();
/**
@ -47,11 +47,6 @@ abstract class BaseNode implements NodeInterface
$this->name = $name;
$this->parent = $parent;
$this->normalizationClosures = array();
$this->finalValidationClosures = array();
$this->allowOverwrite = true;
$this->required = false;
$this->equivalentValues = array();
}
public function setAttribute($key, $value)

View File

@ -22,18 +22,18 @@ use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException;
*/
class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinitionInterface
{
protected $performDeepMerging;
protected $ignoreExtraKeys;
protected $children;
protected $performDeepMerging = true;
protected $ignoreExtraKeys = false;
protected $children = array();
protected $prototype;
protected $atLeastOne;
protected $allowNewKeys;
protected $atLeastOne = false;
protected $allowNewKeys = true;
protected $key;
protected $removeKeyItem;
protected $addDefaults;
protected $addDefaultChildren;
protected $addDefaults = false;
protected $addDefaultChildren = false;
protected $nodeBuilder;
protected $normalizeKeys;
protected $normalizeKeys = true;
/**
* {@inheritDoc}
@ -42,16 +42,8 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
{
parent::__construct($name, $parent);
$this->children = array();
$this->addDefaults = false;
$this->addDefaultChildren = false;
$this->allowNewKeys = true;
$this->atLeastOne = false;
$this->allowEmptyValue = true;
$this->performDeepMerging = true;
$this->nullEquivalent = array();
$this->trueEquivalent = array();
$this->normalizeKeys = true;
}
/**

View File

@ -19,8 +19,8 @@ namespace Symfony\Component\Config\Definition\Builder;
class MergeBuilder
{
protected $node;
public $allowFalse;
public $allowOverwrite;
public $allowFalse = false;
public $allowOverwrite = true;
/**
* Constructor
@ -30,8 +30,6 @@ class MergeBuilder
public function __construct(NodeDefinition $node)
{
$this->node = $node;
$this->allowFalse = false;
$this->allowOverwrite = true;
}
/**

View File

@ -25,15 +25,16 @@ abstract class NodeDefinition implements NodeParentInterface
protected $normalization;
protected $validation;
protected $defaultValue;
protected $default;
protected $required;
protected $default = false;
protected $required = false;
protected $merge;
protected $allowEmptyValue;
protected $allowEmptyValue = true;
protected $nullEquivalent;
protected $trueEquivalent;
protected $falseEquivalent;
protected $trueEquivalent = true;
protected $falseEquivalent = false;
/**
* @var NodeParentInterface|NodeInterface
* @var NodeParentInterface|null
*/
protected $parent;
protected $attributes = array();
@ -41,17 +42,13 @@ abstract class NodeDefinition implements NodeParentInterface
/**
* Constructor
*
* @param string $name The name of the node
* @param NodeParentInterface $parent The parent
* @param string $name The name of the node
* @param NodeParentInterface|null $parent The parent
*/
public function __construct($name, NodeParentInterface $parent = null)
{
$this->parent = $parent;
$this->name = $name;
$this->default = false;
$this->required = false;
$this->trueEquivalent = true;
$this->falseEquivalent = false;
}
/**
@ -110,7 +107,7 @@ abstract class NodeDefinition implements NodeParentInterface
/**
* Returns the parent node.
*
* @return NodeParentInterface The builder of the parent node
* @return NodeParentInterface|null The builder of the parent node
*/
public function end()
{

View File

@ -19,8 +19,8 @@ namespace Symfony\Component\Config\Definition\Builder;
class NormalizationBuilder
{
protected $node;
public $before;
public $remappings;
public $before = array();
public $remappings = array();
/**
* Constructor
@ -30,9 +30,6 @@ class NormalizationBuilder
public function __construct(NodeDefinition $node)
{
$this->node = $node;
$this->keys = false;
$this->remappings = array();
$this->before = array();
}
/**

View File

@ -19,7 +19,7 @@ namespace Symfony\Component\Config\Definition\Builder;
class ValidationBuilder
{
protected $node;
public $rules;
public $rules = array();
/**
* Constructor
@ -29,8 +29,6 @@ class ValidationBuilder
public function __construct(NodeDefinition $node)
{
$this->node = $node;
$this->rules = array();
}
/**

View File

@ -49,10 +49,7 @@ class VariableNodeDefinition extends NodeDefinition
$node->setDefaultValue($this->defaultValue);
}
if (false === $this->allowEmptyValue) {
$node->setAllowEmptyValue($this->allowEmptyValue);
}
$node->setAllowEmptyValue($this->allowEmptyValue);
$node->addEquivalentValue(null, $this->nullEquivalent);
$node->addEquivalentValue(true, $this->trueEquivalent);
$node->addEquivalentValue(false, $this->falseEquivalent);

View File

@ -25,25 +25,11 @@ class PrototypedArrayNode extends ArrayNode
{
protected $prototype;
protected $keyAttribute;
protected $removeKeyAttribute;
protected $minNumberOfElements;
protected $defaultValue;
protected $removeKeyAttribute = false;
protected $minNumberOfElements = 0;
protected $defaultValue = array();
protected $defaultChildren;
/**
* Constructor.
*
* @param string $name The Node's name
* @param NodeInterface $parent The node parent
*/
public function __construct($name, NodeInterface $parent = null)
{
parent::__construct($name, $parent);
$this->minNumberOfElements = 0;
$this->defaultValue = array();
}
/**
* Sets the minimum number of elements that a prototype based node must
* contain. By default this is zero, meaning no elements.

View File

@ -24,7 +24,7 @@ class LoaderResolver implements LoaderResolverInterface
/**
* @var LoaderInterface[] An array of LoaderInterface objects
*/
private $loaders;
private $loaders = array();
/**
* Constructor.
@ -33,7 +33,6 @@ class LoaderResolver implements LoaderResolverInterface
*/
public function __construct(array $loaders = array())
{
$this->loaders = array();
foreach ($loaders as $loader) {
$this->addLoader($loader);
}

View File

@ -20,7 +20,7 @@ use Symfony\Component\Console\Command\Command;
*/
class HelperSet implements \IteratorAggregate
{
private $helpers;
private $helpers = array();
private $command;
/**
@ -30,7 +30,6 @@ class HelperSet implements \IteratorAggregate
*/
public function __construct(array $helpers = array())
{
$this->helpers = array();
foreach ($helpers as $alias => $helper) {
$this->set($helper, is_int($alias) ? null : $alias);
}

View File

@ -24,9 +24,12 @@ namespace Symfony\Component\Console\Input;
*/
abstract class Input implements InputInterface
{
/**
* @var InputDefinition
*/
protected $definition;
protected $options;
protected $arguments;
protected $options = array();
protected $arguments = array();
protected $interactive = true;
/**
@ -37,8 +40,6 @@ abstract class Input implements InputInterface
public function __construct(InputDefinition $definition = null)
{
if (null === $definition) {
$this->arguments = array();
$this->options = array();
$this->definition = new InputDefinition();
} else {
$this->bind($definition);

View File

@ -32,7 +32,7 @@ class Shell
private $history;
private $output;
private $hasReadline;
private $processIsolation;
private $processIsolation = false;
/**
* Constructor.
@ -48,7 +48,6 @@ class Shell
$this->application = $application;
$this->history = getenv('HOME').'/.history_'.$application->getName();
$this->output = new ConsoleOutput();
$this->processIsolation = false;
}
/**

View File

@ -34,7 +34,7 @@ class Reader
/**
* @var int
*/
private $position;
private $position = 0;
/**
* @param string $source
@ -43,7 +43,6 @@ class Reader
{
$this->source = $source;
$this->length = strlen($source);
$this->position = 0;
}
/**

View File

@ -24,7 +24,7 @@ use Symfony\Component\DependencyInjection\Compiler\PassConfig;
class Compiler
{
private $passConfig;
private $log;
private $log = array();
private $loggingFormatter;
private $serviceReferenceGraph;
@ -36,7 +36,6 @@ class Compiler
$this->passConfig = new PassConfig();
$this->serviceReferenceGraph = new ServiceReferenceGraph();
$this->loggingFormatter = new LoggingFormatter();
$this->log = array();
}
/**

View File

@ -31,9 +31,9 @@ class PassConfig
const TYPE_REMOVE = 'removing';
private $mergePass;
private $afterRemovingPasses;
private $beforeOptimizationPasses;
private $beforeRemovingPasses;
private $afterRemovingPasses = array();
private $beforeOptimizationPasses = array();
private $beforeRemovingPasses = array();
private $optimizationPasses;
private $removingPasses;
@ -44,10 +44,6 @@ class PassConfig
{
$this->mergePass = new MergeExtensionConfigurationPass();
$this->afterRemovingPasses = array();
$this->beforeOptimizationPasses = array();
$this->beforeRemovingPasses = array();
$this->optimizationPasses = array(
new ResolveDefinitionTemplatesPass(),
new ResolveParameterPlaceHoldersPass(),

View File

@ -26,15 +26,7 @@ class ServiceReferenceGraph
/**
* @var ServiceReferenceGraphNode[]
*/
private $nodes;
/**
* Constructor.
*/
public function __construct()
{
$this->nodes = array();
}
private $nodes = array();
/**
* Checks if the graph has a specific node.

View File

@ -24,8 +24,8 @@ use Symfony\Component\DependencyInjection\Alias;
class ServiceReferenceGraphNode
{
private $id;
private $inEdges;
private $outEdges;
private $inEdges = array();
private $outEdges = array();
private $value;
/**
@ -38,8 +38,6 @@ class ServiceReferenceGraphNode
{
$this->id = $id;
$this->value = $value;
$this->inEdges = array();
$this->outEdges = array();
}
/**

View File

@ -67,13 +67,13 @@ class Container implements IntrospectableContainerInterface
*/
protected $parameterBag;
protected $services;
protected $methodMap;
protected $aliases;
protected $scopes;
protected $scopeChildren;
protected $scopedServices;
protected $scopeStacks;
protected $services = array();
protected $methodMap = array();
protected $aliases = array();
protected $scopes = array();
protected $scopeChildren = array();
protected $scopedServices = array();
protected $scopeStacks = array();
protected $loading = array();
/**
@ -85,14 +85,7 @@ class Container implements IntrospectableContainerInterface
*/
public function __construct(ParameterBagInterface $parameterBag = null)
{
$this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag;
$this->services = array();
$this->aliases = array();
$this->scopes = array();
$this->scopeChildren = array();
$this->scopedServices = array();
$this->scopeStacks = array();
$this->parameterBag = $parameterBag ?: new ParameterBag();
$this->set('service_container', $this);
}

View File

@ -28,24 +28,24 @@ class Definition
private $factoryClass;
private $factoryMethod;
private $factoryService;
private $scope;
private $properties;
private $calls;
private $scope = ContainerInterface::SCOPE_CONTAINER;
private $properties = array();
private $calls = array();
private $configurator;
private $tags;
private $public;
private $synthetic;
private $abstract;
private $synchronized;
private $lazy;
private $tags = array();
private $public = true;
private $synthetic = false;
private $abstract = false;
private $synchronized = false;
private $lazy = false;
protected $arguments;
/**
* Constructor.
*
* @param string $class The service class
* @param array $arguments An array of arguments to pass to the service constructor
* @param string|null $class The service class
* @param array $arguments An array of arguments to pass to the service constructor
*
* @api
*/
@ -53,15 +53,6 @@ class Definition
{
$this->class = $class;
$this->arguments = $arguments;
$this->calls = array();
$this->scope = ContainerInterface::SCOPE_CONTAINER;
$this->tags = array();
$this->public = true;
$this->synthetic = false;
$this->synchronized = false;
$this->lazy = false;
$this->abstract = false;
$this->properties = array();
}
/**
@ -84,7 +75,7 @@ class Definition
/**
* Gets the factory class.
*
* @return string The factory class name
* @return string|null The factory class name
*
* @api
*/
@ -112,7 +103,7 @@ class Definition
/**
* Gets the factory method.
*
* @return string The factory method name
* @return string|null The factory method name
*
* @api
*/
@ -140,7 +131,7 @@ class Definition
/**
* Gets the factory service id.
*
* @return string The factory service id
* @return string|null The factory service id
*
* @api
*/
@ -168,7 +159,7 @@ class Definition
/**
* Gets the service class.
*
* @return string The service class
* @return string|null The service class
*
* @api
*/
@ -508,7 +499,7 @@ class Definition
/**
* Gets the file to require before creating the service.
*
* @return string The full pathname to include
* @return string|null The full pathname to include
*
* @api
*/
@ -704,7 +695,7 @@ class Definition
/**
* Gets the configurator to call after the service is fully initialized.
*
* @return callable The PHP callable to call
* @return callable|null The PHP callable to call
*
* @api
*/

View File

@ -24,7 +24,7 @@ use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
class DefinitionDecorator extends Definition
{
private $parent;
private $changes;
private $changes = array();
/**
* Constructor.
@ -38,7 +38,6 @@ class DefinitionDecorator extends Definition
parent::__construct();
$this->parent = $parent;
$this->changes = array();
}
/**

View File

@ -24,8 +24,8 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException;
*/
class ParameterBag implements ParameterBagInterface
{
protected $parameters;
protected $resolved;
protected $parameters = array();
protected $resolved = false;
/**
* Constructor.
@ -36,9 +36,7 @@ class ParameterBag implements ParameterBagInterface
*/
public function __construct(array $parameters = array())
{
$this->parameters = array();
$this->add($parameters);
$this->resolved = false;
}
/**

View File

@ -29,12 +29,11 @@ class ExpressionLanguage
private $parser;
private $compiler;
protected $functions;
protected $functions = array();
public function __construct(ParserCacheInterface $cache = null)
{
$this->cache = $cache ?: new ArrayParserCache();
$this->functions = array();
$this->registerFunctions();
}

View File

@ -16,9 +16,9 @@ use Symfony\Component\ExpressionLanguage\Compiler;
class BinaryNode extends Node
{
private static $operators = array(
'~' => '.',
'and' => '&&',
'or' => '||',
'~' => '.',
'and' => '&&',
'or' => '||',
);
private static $functions = array(
@ -30,8 +30,10 @@ class BinaryNode extends Node
public function __construct($operator, Node $left, Node $right)
{
$this->nodes = array('left' => $left, 'right' => $right);
$this->attributes = array('operator' => $operator);
parent::__construct(
array('left' => $left, 'right' => $right),
array('operator' => $operator)
);
}
public function compile(Compiler $compiler)

View File

@ -17,7 +17,9 @@ class ConditionalNode extends Node
{
public function __construct(Node $expr1, Node $expr2, Node $expr3)
{
$this->nodes = array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3);
parent::__construct(
array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3)
);
}
public function compile(Compiler $compiler)

View File

@ -17,7 +17,10 @@ class ConstantNode extends Node
{
public function __construct($value)
{
$this->attributes = array('value' => $value);
parent::__construct(
array(),
array('value' => $value)
);
}
public function compile(Compiler $compiler)

View File

@ -17,8 +17,10 @@ class FunctionNode extends Node
{
public function __construct($name, Node $arguments)
{
$this->nodes = array('arguments' => $arguments);
$this->attributes = array('name' => $name);
parent::__construct(
array('arguments' => $arguments),
array('name' => $name)
);
}
public function compile(Compiler $compiler)

View File

@ -21,8 +21,10 @@ class GetAttrNode extends Node
public function __construct(Node $node, Node $attribute, ArrayNode $arguments, $type)
{
$this->nodes = array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments);
$this->attributes = array('type' => $type);
parent::__construct(
array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments),
array('type' => $type)
);
}
public function compile(Compiler $compiler)

View File

@ -17,7 +17,10 @@ class NameNode extends Node
{
public function __construct($name)
{
$this->attributes = array('name' => $name);
parent::__construct(
array(),
array('name' => $name)
);
}
public function compile(Compiler $compiler)

View File

@ -24,8 +24,10 @@ class UnaryNode extends Node
public function __construct($operator, Node $node)
{
$this->nodes = array('node' => $node);
$this->attributes = array('operator' => $operator);
parent::__construct(
array('node' => $node),
array('operator' => $operator)
);
}
public function compile(Compiler $compiler)

View File

@ -21,7 +21,7 @@ class TokenStream
public $current;
private $tokens;
private $position;
private $position = 0;
/**
* Constructor.
@ -31,7 +31,6 @@ class TokenStream
public function __construct(array $tokens)
{
$this->tokens = $tokens;
$this->position = 0;
$this->current = $tokens[0];
}

View File

@ -18,7 +18,7 @@ namespace Symfony\Component\Finder\Iterator;
*/
class ExcludeDirectoryFilterIterator extends FilterIterator
{
private $patterns;
private $patterns = array();
/**
* Constructor.
@ -28,7 +28,6 @@ class ExcludeDirectoryFilterIterator extends FilterIterator
*/
public function __construct(\Iterator $iterator, array $directories)
{
$this->patterns = array();
foreach ($directories as $directory) {
$this->patterns[] = '#(^|/)'.preg_quote($directory, '#').'(/|$)#';
}

View File

@ -20,8 +20,8 @@ use Symfony\Component\Finder\Expression\Expression;
*/
abstract class MultiplePcreFilterIterator extends FilterIterator
{
protected $matchRegexps;
protected $noMatchRegexps;
protected $matchRegexps = array();
protected $noMatchRegexps = array();
/**
* Constructor.
@ -32,12 +32,10 @@ abstract class MultiplePcreFilterIterator extends FilterIterator
*/
public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
{
$this->matchRegexps = array();
foreach ($matchPatterns as $pattern) {
$this->matchRegexps[] = $this->toRegex($pattern);
}
$this->noMatchRegexps = array();
foreach ($noMatchPatterns as $pattern) {
$this->noMatchRegexps[] = $this->toRegex($pattern);
}

View File

@ -24,12 +24,12 @@ class Command
/**
* @var array
*/
private $bits;
private $bits = array();
/**
* @var array
*/
private $labels;
private $labels = array();
/**
* @var \Closure|null
@ -44,8 +44,6 @@ class Command
public function __construct(Command $parent = null)
{
$this->parent = $parent;
$this->bits = array();
$this->labels = array();
}
/**

View File

@ -13,11 +13,10 @@ namespace Symfony\Component\Finder\Tests\Iterator;
class Iterator implements \Iterator
{
protected $values;
protected $values = array();
public function __construct(array $values = array())
{
$this->values = array();
foreach ($values as $value) {
$this->attach(new \SplFileInfo($value));
}

View File

@ -20,8 +20,8 @@ namespace Symfony\Component\HttpFoundation;
*/
class HeaderBag implements \IteratorAggregate, \Countable
{
protected $headers;
protected $cacheControl;
protected $headers = array();
protected $cacheControl = array();
/**
* Constructor.
@ -32,8 +32,6 @@ class HeaderBag implements \IteratorAggregate, \Countable
*/
public function __construct(array $headers = array())
{
$this->cacheControl = array();
$this->headers = array();
foreach ($headers as $key => $values) {
$this->set($key, $values);
}

View File

@ -25,7 +25,7 @@ class AutoExpireFlashBag implements FlashBagInterface
*
* @var array
*/
private $flashes = array();
private $flashes = array('display' => array(), 'new' => array());
/**
* The storage key for flashes in the session
@ -42,7 +42,6 @@ class AutoExpireFlashBag implements FlashBagInterface
public function __construct($storageKey = '_sf2_flashes')
{
$this->storageKey = $storageKey;
$this->flashes = array('display' => array(), 'new' => array());
}
/**

View File

@ -39,7 +39,7 @@ class MetadataBag implements SessionBagInterface
/**
* @var array
*/
protected $meta = array();
protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0);
/**
* Unix timestamp.
@ -63,7 +63,6 @@ class MetadataBag implements SessionBagInterface
{
$this->storageKey = $storageKey;
$this->updateThreshold = $updateThreshold;
$this->meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0);
}
/**

View File

@ -18,13 +18,14 @@ namespace Symfony\Component\HttpKernel\CacheWarmer;
*/
class CacheWarmerAggregate implements CacheWarmerInterface
{
protected $warmers;
protected $optionalsEnabled;
protected $warmers = array();
protected $optionalsEnabled = false;
public function __construct(array $warmers = array())
{
$this->setWarmers($warmers);
$this->optionalsEnabled = false;
foreach ($warmers as $warmer) {
$this->add($warmer);
}
}
public function enableOptionalWarmers()

View File

@ -43,10 +43,9 @@ class Client extends BaseClient
*/
public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null)
{
$this->kernel = $kernel;
parent::__construct($server, $history, $cookieJar);
$this->kernel = $kernel;
$this->followRedirects = false;
}

View File

@ -30,11 +30,11 @@ use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface;
class TraceableEventDispatcher implements EventDispatcherInterface, TraceableEventDispatcherInterface
{
private $logger;
private $called;
private $called = array();
private $stopwatch;
private $dispatcher;
private $wrappedListeners;
private $firstCalledEvent;
private $wrappedListeners = array();
private $firstCalledEvent = array();
private $id;
/**
@ -49,9 +49,6 @@ class TraceableEventDispatcher implements EventDispatcherInterface, TraceableEve
$this->dispatcher = $dispatcher;
$this->stopwatch = $stopwatch;
$this->logger = $logger;
$this->called = array();
$this->wrappedListeners = array();
$this->firstCalledEvent = array();
}
/**

View File

@ -33,7 +33,7 @@ class ProfilerListener implements EventSubscriberInterface
protected $onlyException;
protected $onlyMasterRequests;
protected $exception;
protected $requests;
protected $requests = array();
protected $profiles;
protected $requestStack;
protected $parents;
@ -54,7 +54,6 @@ class ProfilerListener implements EventSubscriberInterface
$this->onlyMasterRequests = (Boolean) $onlyMasterRequests;
$this->profiles = new \SplObjectStorage();
$this->parents = new \SplObjectStorage();
$this->requests = array();
$this->requestStack = $requestStack;
}

View File

@ -35,7 +35,7 @@ use Symfony\Component\HttpKernel\Controller\ControllerReference;
class FragmentHandler
{
private $debug;
private $renderers;
private $renderers = array();
private $request;
private $requestStack;
@ -51,7 +51,6 @@ class FragmentHandler
public function __construct(array $renderers = array(), $debug = false, RequestStack $requestStack = null)
{
$this->requestStack = $requestStack;
$this->renderers = array();
foreach ($renderers as $renderer) {
$this->addRenderer($renderer);
}

View File

@ -35,7 +35,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
private $request;
private $esi;
private $esiCacheStrategy;
private $traces;
private $options = array();
private $traces = array();
/**
* Constructor.
@ -81,6 +82,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
{
$this->store = $store;
$this->kernel = $kernel;
$this->esi = $esi;
// needed in case there is a fatal error because the backend is too slow to respond
register_shutdown_function(array($this->store, 'cleanup'));
@ -94,8 +96,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
'stale_while_revalidate' => 2,
'stale_if_error' => 60,
), $options);
$this->esi = $esi;
$this->traces = array();
}
/**

View File

@ -48,14 +48,14 @@ abstract class Kernel implements KernelInterface, TerminableInterface
/**
* @var BundleInterface[]
*/
protected $bundles;
protected $bundles = array();
protected $bundleMap;
protected $container;
protected $rootDir;
protected $environment;
protected $debug;
protected $booted;
protected $booted = false;
protected $name;
protected $startTime;
protected $loadClassCache;
@ -79,10 +79,8 @@ abstract class Kernel implements KernelInterface, TerminableInterface
{
$this->environment = $environment;
$this->debug = (Boolean) $debug;
$this->booted = false;
$this->rootDir = $this->getRootDir();
$this->name = $this->getName();
$this->bundles = array();
if ($this->debug) {
$this->startTime = microtime(true);

View File

@ -23,9 +23,9 @@ class TestHttpKernel extends HttpKernel implements ControllerResolverInterface
protected $body;
protected $status;
protected $headers;
protected $called;
protected $called = false;
protected $customizer;
protected $catch;
protected $catch = false;
protected $backendRequest;
public function __construct($body, $status, $headers, \Closure $customizer = null)
@ -34,8 +34,6 @@ class TestHttpKernel extends HttpKernel implements ControllerResolverInterface
$this->status = $status;
$this->headers = $headers;
$this->customizer = $customizer;
$this->called = false;
$this->catch = false;
parent::__construct(new EventDispatcher(), $this);
}

View File

@ -20,20 +20,14 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface
{
protected $bodies;
protected $statuses;
protected $headers;
protected $catch;
protected $call;
protected $bodies = array();
protected $statuses = array();
protected $headers = array();
protected $call = false;
protected $backendRequest;
public function __construct($responses)
{
$this->bodies = array();
$this->statuses = array();
$this->headers = array();
$this->call = false;
foreach ($responses as $response) {
$this->bodies[] = $response['body'];
$this->statuses[] = $response['status'];

View File

@ -18,14 +18,8 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock;
*/
class MemcacheMock
{
private $connected;
private $storage;
public function __construct()
{
$this->connected = false;
$this->storage = array();
}
private $connected = false;
private $storage = array();
/**
* Open memcached server connection

View File

@ -18,14 +18,8 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock;
*/
class MemcachedMock
{
private $connected;
private $storage;
public function __construct()
{
$this->connected = false;
$this->storage = array();
}
private $connected = false;
private $storage = array();
/**
* Set a Memcached option

View File

@ -18,15 +18,8 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock;
*/
class RedisMock
{
private $connected;
private $storage;
public function __construct()
{
$this->connected = false;
$this->storage = array();
}
private $connected = false;
private $storage = array();
/**
* Add a server to connection pool

View File

@ -23,21 +23,16 @@ class ProcessBuilder
{
private $arguments;
private $cwd;
private $env;
private $env = array();
private $stdin;
private $timeout;
private $options;
private $inheritEnv;
private $timeout = 60;
private $options = array();
private $inheritEnv = true;
private $prefix = array();
public function __construct(array $arguments = array())
{
$this->arguments = $arguments;
$this->timeout = 60;
$this->options = array();
$this->env = array();
$this->inheritEnv = true;
}
public static function create(array $arguments = array())

View File

@ -22,12 +22,12 @@ class Route
{
private $path;
private $name;
private $requirements;
private $options;
private $defaults;
private $requirements = array();
private $options = array();
private $defaults = array();
private $host;
private $methods;
private $schemes;
private $methods = array();
private $schemes = array();
private $condition;
/**
@ -39,12 +39,6 @@ class Route
*/
public function __construct(array $data)
{
$this->requirements = array();
$this->options = array();
$this->defaults = array();
$this->methods = array();
$this->schemes = array();
if (isset($data['value'])) {
$data['path'] = $data['value'];
unset($data['value']);

View File

@ -40,8 +40,8 @@ class AclProvider implements AclProviderInterface
protected $cache;
protected $connection;
protected $loadedAces;
protected $loadedAcls;
protected $loadedAces = array();
protected $loadedAcls = array();
protected $options;
private $permissionGrantingStrategy;
@ -57,8 +57,6 @@ class AclProvider implements AclProviderInterface
{
$this->cache = $cache;
$this->connection = $connection;
$this->loadedAces = array();
$this->loadedAcls = array();
$this->options = $options;
$this->permissionGrantingStrategy = $permissionGrantingStrategy;
}

View File

@ -37,14 +37,14 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
private $parentAcl;
private $permissionGrantingStrategy;
private $objectIdentity;
private $classAces;
private $classFieldAces;
private $objectAces;
private $objectFieldAces;
private $classAces = array();
private $classFieldAces = array();
private $objectAces = array();
private $objectFieldAces = array();
private $id;
private $loadedSids;
private $entriesInheriting;
private $listeners;
private $listeners = array();
/**
* Constructor
@ -62,12 +62,6 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
$this->permissionGrantingStrategy = $permissionGrantingStrategy;
$this->loadedSids = $loadedSids;
$this->entriesInheriting = $entriesInheriting;
$this->parentAcl = null;
$this->classAces = array();
$this->classFieldAces = array();
$this->objectAces = array();
$this->objectFieldAces = array();
$this->listeners = array();
}
/**

View File

@ -26,9 +26,9 @@ use Symfony\Component\Security\Core\User\EquatableInterface;
abstract class AbstractToken implements TokenInterface
{
private $user;
private $roles;
private $authenticated;
private $attributes;
private $roles = array();
private $authenticated = false;
private $attributes = array();
/**
* Constructor.
@ -39,10 +39,6 @@ abstract class AbstractToken implements TokenInterface
*/
public function __construct(array $roles = array())
{
$this->authenticated = false;
$this->attributes = array();
$this->roles = array();
foreach ($roles as $role) {
if (is_string($role)) {
$role = new Role($role);

View File

@ -139,7 +139,7 @@ class DigestAuthenticationListener implements ListenerInterface
class DigestData
{
private $elements;
private $elements = array();
private $header;
private $nonceExpiryTime;
@ -147,7 +147,6 @@ class DigestData
{
$this->header = $header;
preg_match_all('/(\w+)=("((?:[^"\\\\]|\\\\.)+)"|([^\s,$]+))/', $header, $matches, PREG_SET_ORDER);
$this->elements = array();
foreach ($matches as $match) {
if (isset($match[1]) && isset($match[3])) {
$this->elements[$match[1]] = isset($match[4]) ? $match[4] : $match[3];

View File

@ -21,7 +21,7 @@ class StopwatchEvent
/**
* @var StopwatchPeriod[]
*/
private $periods;
private $periods = array();
/**
* @var float
@ -36,13 +36,13 @@ class StopwatchEvent
/**
* @var float[]
*/
private $started;
private $started = array();
/**
* Constructor.
*
* @param float $origin The origin time in milliseconds
* @param string $category The event category
* @param float $origin The origin time in milliseconds
* @param string|null $category The event category or null to use the default
*
* @throws \InvalidArgumentException When the raw time is not valid
*/
@ -50,8 +50,6 @@ class StopwatchEvent
{
$this->origin = $this->formatTime($origin);
$this->category = is_string($category) ? $category : 'default';
$this->started = array();
$this->periods = array();
}
/**
@ -67,7 +65,7 @@ class StopwatchEvent
/**
* Gets the origin.
*
* @return integer The origin in milliseconds
* @return float The origin in milliseconds
*/
public function getOrigin()
{
@ -178,7 +176,7 @@ class StopwatchEvent
$total += $period->getDuration();
}
return $this->formatTime($total);
return $total;
}
/**

View File

@ -23,10 +23,10 @@ class StopwatchPeriod
private $memory;
/**
* Constructor
* Constructor.
*
* @param integer $start The relative time of the start of the period
* @param integer $end The relative time of the end of the period
* @param integer $start The relative time of the start of the period (in milliseconds)
* @param integer $end The relative time of the end of the period (in milliseconds)
*/
public function __construct($start, $end)
{

View File

@ -23,7 +23,7 @@ class DelegatingEngine implements EngineInterface, StreamingEngineInterface
/**
* @var EngineInterface[]
*/
protected $engines;
protected $engines = array();
/**
* Constructor.
@ -34,7 +34,6 @@ class DelegatingEngine implements EngineInterface, StreamingEngineInterface
*/
public function __construct(array $engines = array())
{
$this->engines = array();
foreach ($engines as $engine) {
$this->addEngine($engine);
}

View File

@ -28,7 +28,7 @@ use Symfony\Component\Templating\Asset\PackageInterface;
class CoreAssetsHelper extends Helper implements PackageInterface
{
protected $defaultPackage;
protected $namedPackages;
protected $namedPackages = array();
/**
* Constructor.
@ -39,7 +39,6 @@ class CoreAssetsHelper extends Helper implements PackageInterface
public function __construct(PackageInterface $defaultPackage, array $namedPackages = array())
{
$this->defaultPackage = $defaultPackage;
$this->namedPackages = array();
foreach ($namedPackages as $name => $package) {
$this->addPackage($name, $package);

View File

@ -21,7 +21,7 @@ use Symfony\Component\Templating\TemplateReferenceInterface;
*/
class ChainLoader extends Loader
{
protected $loaders;
protected $loaders = array();
/**
* Constructor.
@ -30,7 +30,6 @@ class ChainLoader extends Loader
*/
public function __construct(array $loaders = array())
{
$this->loaders = array();
foreach ($loaders as $loader) {
$this->addLoader($loader);
}

View File

@ -32,14 +32,14 @@ class PhpEngine implements EngineInterface, \ArrayAccess
{
protected $loader;
protected $current;
protected $helpers;
protected $parents;
protected $stack;
protected $charset;
protected $cache;
protected $escapers;
protected static $escaperCache;
protected $globals;
protected $helpers = array();
protected $parents = array();
protected $stack = array();
protected $charset = 'UTF-8';
protected $cache = array();
protected $escapers = array();
protected static $escaperCache = array();
protected $globals = array();
protected $parser;
private $evalTemplate;
@ -56,13 +56,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
{
$this->parser = $parser;
$this->loader = $loader;
$this->parents = array();
$this->stack = array();
$this->charset = 'UTF-8';
$this->cache = array();
$this->globals = array();
$this->setHelpers($helpers);
$this->addHelpers($helpers);
$this->initializeEscapers();
foreach ($this->escapers as $context => $escaper) {

View File

@ -25,7 +25,7 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
*/
class Collection extends Constraint
{
public $fields;
public $fields = array();
public $allowExtraFields = false;
public $allowMissingFields = false;
public $extraFieldsMessage = 'This field was not expected.';