This commit is contained in:
Fabien Potencier 2012-12-11 11:49:22 +01:00
parent 3c010db2cb
commit fdb11be242
34 changed files with 53 additions and 70 deletions

View File

@ -89,6 +89,7 @@ EOF
} }
$this->outputTags($output, $input->getOption('show-private')); $this->outputTags($output, $input->getOption('show-private'));
return; return;
} }
@ -146,8 +147,8 @@ EOF
if (null !== $showTagAttributes) { if (null !== $showTagAttributes) {
$tags = $definition->getTag($showTagAttributes); $tags = $definition->getTag($showTagAttributes);
foreach($tags as $tag) { foreach ($tags as $tag) {
foreach($tag as $key => $value) { foreach ($tag as $key => $value) {
if (!isset($maxTags[$key])) { if (!isset($maxTags[$key])) {
$maxTags[$key] = strlen($key); $maxTags[$key] = strlen($key);
} }
@ -173,7 +174,7 @@ EOF
$format1 .= '%-'.($maxScope + 19).'s %s'; $format1 .= '%-'.($maxScope + 19).'s %s';
$tags = array(); $tags = array();
foreach($maxTags as $tagName => $length) { foreach ($maxTags as $tagName => $length) {
$tags[] = '<comment>'.$tagName.'</comment>'; $tags[] = '<comment>'.$tagName.'</comment>';
} }
$output->writeln(vsprintf($format1, $this->buildArgumentsArray('<comment>Service Id</comment>', '<comment>Scope</comment>', '<comment>Class Name</comment>', $tags))); $output->writeln(vsprintf($format1, $this->buildArgumentsArray('<comment>Service Id</comment>', '<comment>Scope</comment>', '<comment>Class Name</comment>', $tags)));
@ -184,9 +185,9 @@ EOF
if ($definition instanceof Definition) { if ($definition instanceof Definition) {
$lines = array(); $lines = array();
if (null !== $showTagAttributes) { if (null !== $showTagAttributes) {
foreach($definition->getTag($showTagAttributes) as $key => $tag) { foreach ($definition->getTag($showTagAttributes) as $key => $tag) {
$tagValues = array(); $tagValues = array();
foreach(array_keys($maxTags) as $tagName) { foreach (array_keys($maxTags) as $tagName) {
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : ""; $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : "";
} }
if (0 === $key) { if (0 === $key) {
@ -199,7 +200,7 @@ EOF
$lines[] = $this->buildArgumentsArray($serviceId, $definition->getScope(), $definition->getClass()); $lines[] = $this->buildArgumentsArray($serviceId, $definition->getScope(), $definition->getClass());
} }
foreach($lines as $arguments) { foreach ($lines as $arguments) {
$output->writeln(vsprintf($format, $arguments)); $output->writeln(vsprintf($format, $arguments));
} }
} elseif ($definition instanceof Alias) { } elseif ($definition instanceof Alias) {
@ -216,7 +217,7 @@ EOF
protected function buildArgumentsArray($serviceId, $scope, $className, array $tagAttributes = array()) protected function buildArgumentsArray($serviceId, $scope, $className, array $tagAttributes = array())
{ {
$arguments = array($serviceId); $arguments = array($serviceId);
foreach($tagAttributes as $tagAttribute) { foreach ($tagAttributes as $tagAttribute) {
$arguments[] = $tagAttribute; $arguments[] = $tagAttribute;
} }
$arguments[] = $scope; $arguments[] = $scope;

View File

@ -59,19 +59,8 @@
<label for="priority">Priority</label> <label for="priority">Priority</label>
<select id="priority" name="priority" onchange="document.getElementById('priority-form').submit(); "> <select id="priority" name="priority" onchange="document.getElementById('priority-form').submit(); ">
{# values < 0 are custom levels #} {# values < 0 are custom levels #}
{% for value, text in { {% for value, text in { 100: 'DEBUG', 200: 'INFO', 250: 'NOTICE', 300: 'WARNING', 400: 'ERROR', 500: 'CRITICAL', 550: 'ALERT', 600: 'EMERGENCY', '-100': 'DEPRECATION only' } %}
100: 'DEBUG', <option value="{{ value }}"{{ value == priority ? ' selected' : '' }}>{{ text }}</option>
200: 'INFO',
250: 'NOTICE',
300: 'WARNING',
400: 'ERROR',
500: 'CRITICAL',
550: 'ALERT',
600: 'EMERGENCY',
'-100': 'DEPRECATION only'
}
%}
<option value="{{ value }}"{{ value == priority ? ' selected' : '' }}>{{ text }}</option>
{% endfor %} {% endfor %}
</select> </select>
<noscript> <noscript>
@ -122,11 +111,7 @@
{% set from = '-' %} {% set from = '-' %}
{% endif %} {% endif %}
<li>Called from {{ call.file is defined and call.line is defined <li>Called from {{ call.file is defined and call.line is defined ? call.file|format_file(call.line, from) : from|raw }}</li>
? call.file|format_file(call.line, from)
: from|raw
}}
</li>
{{ index == log.context.stack|length - 1 ? '</ul>' : '' }} {{ index == log.context.stack|length - 1 ? '</ul>' : '' }}
{% endfor %} {% endfor %}

View File

@ -242,7 +242,7 @@ class UniversalClassLoader
* Loads the given class or interface. * Loads the given class or interface.
* *
* @param string $class The name of the class * @param string $class The name of the class
* *
* @return Boolean|null True, if loaded * @return Boolean|null True, if loaded
*/ */
public function loadClass($class) public function loadClass($class)

View File

@ -610,15 +610,15 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($inputDefinition->hasOption('custom')); $this->assertTrue($inputDefinition->hasOption('custom'));
} }
public function testSettingCustomInputDefinitionOverwritesDefaultValues() public function testSettingCustomInputDefinitionOverwritesDefaultValues()
{ {
$application = new Application(); $application = new Application();
$application->setAutoExit(false); $application->setAutoExit(false);
$application->setCatchExceptions(false); $application->setCatchExceptions(false);
$application->setDefinition(new InputDefinition(array(new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.')))); $application->setDefinition(new InputDefinition(array(new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.'))));
$inputDefinition = $application->getDefinition(); $inputDefinition = $application->getDefinition();
// check whether the default arguments and options are not returned any more // check whether the default arguments and options are not returned any more

View File

@ -159,11 +159,11 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
/** /**
* Sets the resources for this configuration. * Sets the resources for this configuration.
* *
* @param ResourceInterface[] $resources An array of resources * @param ResourceInterface[] $resources An array of resources
* *
* @return ContainerBuilder The current instance * @return ContainerBuilder The current instance
* *
* @api * @api
*/ */
public function setResources(array $resources) public function setResources(array $resources)

View File

@ -316,6 +316,7 @@ abstract class AbstractFindAdapter extends AbstractAdapter
switch ($sort) { switch ($sort) {
case SortableIterator::SORT_BY_NAME: case SortableIterator::SORT_BY_NAME:
$command->ins('sort')->add('| sort'); $command->ins('sort')->add('| sort');
return; return;
case SortableIterator::SORT_BY_TYPE: case SortableIterator::SORT_BY_TYPE:
$format = '%y'; $format = '%y';

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Finder\Adapter; namespace Symfony\Component\Finder\Adapter;
use Symfony\Component\Finder\Iterator;
use Symfony\Component\Finder\Shell\Shell; use Symfony\Component\Finder\Shell\Shell;
use Symfony\Component\Finder\Shell\Command; use Symfony\Component\Finder\Shell\Command;

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Finder\Adapter; namespace Symfony\Component\Finder\Adapter;
use Symfony\Component\Finder\Iterator;
use Symfony\Component\Finder\Shell\Shell; use Symfony\Component\Finder\Shell\Shell;
use Symfony\Component\Finder\Shell\Command; use Symfony\Component\Finder\Shell\Command;

View File

@ -10,5 +10,5 @@ interface ExceptionInterface
/** /**
* @return \Symfony\Component\Finder\Adapter\AdapterInterface * @return \Symfony\Component\Finder\Adapter\AdapterInterface
*/ */
function getAdapter(); public function getAdapter();
} }

View File

@ -41,7 +41,7 @@ class Expression implements ValueInterface
{ {
try { try {
$this->value = Regex::create($expr); $this->value = Regex::create($expr);
} catch(\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
$this->value = new Glob($expr); $this->value = new Glob($expr);
} }
} }

View File

@ -21,28 +21,28 @@ interface ValueInterface
* *
* @return string * @return string
*/ */
function render(); public function render();
/** /**
* Renders string representation of pattern. * Renders string representation of pattern.
* *
* @return string * @return string
*/ */
function renderPattern(); public function renderPattern();
/** /**
* Returns value case sensitivity. * Returns value case sensitivity.
* *
* @return bool * @return bool
*/ */
function isCaseSensitive(); public function isCaseSensitive();
/** /**
* Returns expression type. * Returns expression type.
* *
* @return int * @return int
*/ */
function getType(); public function getType();
/** /**
* @param string $expr * @param string $expr

View File

@ -723,7 +723,7 @@ class Finder implements \IteratorAggregate, \Countable
return $this return $this
->buildAdapter($adapter['adapter']) ->buildAdapter($adapter['adapter'])
->searchInDirectory($dir); ->searchInDirectory($dir);
} catch(ExceptionInterface $e) {} } catch (ExceptionInterface $e) {}
} }
} }

View File

@ -406,7 +406,6 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder = $finder->append($finder1); $finder = $finder->append($finder1);
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator()); $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator());
} }

View File

@ -83,4 +83,3 @@ class PathFilterIteratorTest extends IteratorTestCase
} }
} }

View File

@ -482,6 +482,7 @@ class FormTypeTest extends TypeTestCase
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer( $builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
function () {}, function () {},
function ($value) { // reverseTransform function ($value) { // reverseTransform
return 'foobar'; return 'foobar';
} }
)); ));
@ -507,6 +508,7 @@ class FormTypeTest extends TypeTestCase
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer( $builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
function () {}, function () {},
function ($value) use ($ref2) { // reverseTransform function ($value) use ($ref2) { // reverseTransform
return $ref2; return $ref2;
} }
)); ));

View File

@ -12,13 +12,11 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\Constraints; namespace Symfony\Component\Form\Tests\Extension\Validator\Constraints;
use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Extension\Validator\Constraints\Form; use Symfony\Component\Form\Extension\Validator\Constraints\Form;
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator; use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
use Symfony\Component\Form\Util\PropertyPath;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotBlank;

View File

@ -102,7 +102,6 @@ class UploadedFileTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('gif', $file->getClientOriginalExtension()); $this->assertEquals('gif', $file->getClientOriginalExtension());
} }
/** /**
* @expectedException Symfony\Component\HttpFoundation\File\Exception\FileException * @expectedException Symfony\Component\HttpFoundation\File\Exception\FileException
*/ */

View File

@ -179,7 +179,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$collection->expects($this->once()) $collection->expects($this->once())
->method('remove') ->method('remove')
->will($this->returnCallback(function($criteria) use($that) { ->will($this->returnCallback(function($criteria) use ($that) {
$that->assertInstanceOf('MongoDate', $criteria[$that->options['time_field']]['$lt']); $that->assertInstanceOf('MongoDate', $criteria[$that->options['time_field']]['$lt']);
$that->assertGreaterThanOrEqual(time() - -1, $criteria[$that->options['time_field']]['$lt']->sec); $that->assertGreaterThanOrEqual(time() - -1, $criteria[$that->options['time_field']]['$lt']->sec);
})); }));

View File

@ -84,6 +84,7 @@ class Store implements StoreInterface
return true; return true;
} }
return !file_exists($path) ?: $path; return !file_exists($path) ?: $path;
} }

View File

@ -208,7 +208,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @api * @api
*/ */
public function getBundles() public function getBundles()

View File

@ -111,7 +111,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface
/** /**
* @param array $data * @param array $data
* *
* @return Profile * @return Profile
*/ */
protected function createProfileFromData(array $data) protected function createProfileFromData(array $data)
@ -132,7 +132,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface
/** /**
* @param string $token * @param string $token
* *
* @return Profile[] An array of Profile instances * @return Profile[] An array of Profile instances
*/ */
protected function readChildren($token) protected function readChildren($token)
@ -156,7 +156,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface
* @param string $ip * @param string $ip
* @param string $url * @param string $url
* @param string $method * @param string $method
* *
* @return array * @return array
*/ */
private function buildQuery($ip, $url, $method) private function buildQuery($ip, $url, $method)
@ -180,7 +180,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface
/** /**
* @param array $data * @param array $data
* *
* @return array * @return array
*/ */
private function getData(array $data) private function getData(array $data)
@ -198,7 +198,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface
/** /**
* @param array $data * @param array $data
* *
* @return Profile * @return Profile
*/ */
private function getProfile(array $data) private function getProfile(array $data)

View File

@ -114,7 +114,7 @@ class Profile
/** /**
* Sets the IP. * Sets the IP.
* *
* @param string $ip * @param string $ip
*/ */
public function setIp($ip) public function setIp($ip)
@ -179,7 +179,7 @@ class Profile
/** /**
* Sets children profiler. * Sets children profiler.
* *
* @param Profile[] $children An array of Profile * @param Profile[] $children An array of Profile
*/ */
public function setChildren(array $children) public function setChildren(array $children)
@ -221,7 +221,7 @@ class Profile
/** /**
* Gets the Collectors associated with this profile. * Gets the Collectors associated with this profile.
* *
* @return DataCollectorInterface[] * @return DataCollectorInterface[]
*/ */
public function getCollectors() public function getCollectors()
@ -231,7 +231,7 @@ class Profile
/** /**
* Sets the Collectors associated with this profile. * Sets the Collectors associated with this profile.
* *
* @param DataCollectorInterface[] $collectors * @param DataCollectorInterface[] $collectors
*/ */
public function setCollectors(array $collectors) public function setCollectors(array $collectors)

View File

@ -194,7 +194,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
class EventSubscriber implements EventSubscriberInterface class EventSubscriber implements EventSubscriberInterface
{ {
static public function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array('foo' => 'call'); return array('foo' => 'call');
} }

View File

@ -521,6 +521,7 @@ class OptionsTest extends \PHPUnit_Framework_TestCase
$this->options->setNormalizer('foo', function (Options $options, $previousValue) use ($test) { $this->options->setNormalizer('foo', function (Options $options, $previousValue) use ($test) {
$test->assertNull($previousValue); $test->assertNull($previousValue);
return ''; return '';
}); });
$this->assertEquals(array('foo' => ''), $this->options->all()); $this->assertEquals(array('foo' => ''), $this->options->all());

View File

@ -115,7 +115,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetErrorOutput() public function testGetErrorOutput()
{ {
$p = new Process(sprintf('php -r %s', escapeshellarg('ini_set(\'display_errors\',\'on\');$n=0;while($n<3){echo $a;$n++;}'))); $p = new Process(sprintf('php -r %s', escapeshellarg('ini_set(\'display_errors\',\'on\'); $n = 0; while ($n < 3) { echo $a; $n++; }')));
$p->run(); $p->run();
$this->assertEquals(3, preg_match_all('/PHP Notice/', $p->getErrorOutput(), $matches)); $this->assertEquals(3, preg_match_all('/PHP Notice/', $p->getErrorOutput(), $matches));
@ -123,7 +123,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetIncrementalErrorOutput() public function testGetIncrementalErrorOutput()
{ {
$p = new Process(sprintf('php -r %s', escapeshellarg('ini_set(\'display_errors\',\'on\');usleep(50000);$n=0;while($n<3){echo $a;$n++;}'))); $p = new Process(sprintf('php -r %s', escapeshellarg('ini_set(\'display_errors\',\'on\'); usleep(50000); $n = 0; while ($n < 3) { echo $a; $n++; }')));
$p->start(); $p->start();
while ($p->isRunning()) { while ($p->isRunning()) {
@ -134,7 +134,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetOutput() public function testGetOutput()
{ {
$p = new Process(sprintf('php -r %s', escapeshellarg('$n=0;while($n<3){echo \' foo \';$n++;}'))); $p = new Process(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) {echo \' foo \';$n++;}')));
$p->run(); $p->run();
$this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches)); $this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches));
@ -142,7 +142,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetIncrementalOutput() public function testGetIncrementalOutput()
{ {
$p = new Process(sprintf('php -r %s', escapeshellarg('$n=0;while($n<3){echo \' foo \';usleep(50000);$n++;}'))); $p = new Process(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) { echo \' foo \'; usleep(50000); $n++; }')));
$p->start(); $p->start();
while ($p->isRunning()) { while ($p->isRunning()) {

View File

@ -29,7 +29,7 @@ use Symfony\Component\HttpKernel\Log\LoggerInterface;
class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface
{ {
/** /**
* @var RouteCollection * @var RouteCollection
*/ */
protected $routes; protected $routes;

View File

@ -83,6 +83,7 @@ class ApacheUrlMatcher extends UrlMatcher
if (null !== $route) { if (null !== $route) {
$parameters['_route'] = $route; $parameters['_route'] = $route;
return $this->mergeDefaults($parameters, $defaults); return $this->mergeDefaults($parameters, $defaults);
} elseif (0 < count($allow)) { } elseif (0 < count($allow)) {
throw new MethodNotAllowedException($allow); throw new MethodNotAllowedException($allow);

View File

@ -86,7 +86,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
/** /**
* Gets the current RouteCollection as an Iterator that includes all routes. * Gets the current RouteCollection as an Iterator that includes all routes.
* *
* It implements \IteratorAggregate. * It implements \IteratorAggregate.
* *
* @see all() * @see all()

View File

@ -131,7 +131,7 @@ class RouteCompiler implements RouteCompilerInterface
if (('' !== $nextSeparator && !preg_match('#^\{\w+\}#', $followingPattern)) || '' === $followingPattern) { if (('' !== $nextSeparator && !preg_match('#^\{\w+\}#', $followingPattern)) || '' === $followingPattern) {
// When we have a separator, which is disallowed for the variable, we can optimize the regex with a possessive // When we have a separator, which is disallowed for the variable, we can optimize the regex with a possessive
// quantifier. This prevents useless backtracking of PCRE and improves performance by 20% for matching those patterns. // quantifier. This prevents useless backtracking of PCRE and improves performance by 20% for matching those patterns.
// Given the above example, there is no point in backtracking into {page} (that forbids the dot) when a dot must follow // Given the above example, there is no point in backtracking into {page} (that forbids the dot) when a dot must follow
// after it. This optimization cannot be applied when the next char is no real separator or when the next variable is // after it. This optimization cannot be applied when the next char is no real separator or when the next variable is
// directly adjacent, e.g. '/{x}{y}'. // directly adjacent, e.g. '/{x}{y}'.
$regexp .= '+'; $regexp .= '+';

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Security\Core\Util; namespace Symfony\Component\Security\Core\Util;
/** /**
* Interface that needs to be implemented by all secure random number generators. * Interface that needs to be implemented by all secure random number generators.
* *

View File

@ -279,4 +279,3 @@ class Section
return $this->events; return $this->events;
} }
} }

View File

@ -89,7 +89,7 @@ class FilesystemLoader extends Loader
* *
* @param TemplateReferenceInterface $template A template * @param TemplateReferenceInterface $template A template
* @param integer $time The last modification time of the cached template (timestamp) * @param integer $time The last modification time of the cached template (timestamp)
* *
* @return Boolean true if the template is still fresh, false otherwise * @return Boolean true if the template is still fresh, false otherwise
* *
* @api * @api

View File

@ -236,7 +236,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess
/** /**
* Adds some helpers. * Adds some helpers.
* *
* @param HelperInterface[] $helpers An array of helper * @param HelperInterface[] $helpers An array of helper
* *
* @api * @api

View File

@ -82,7 +82,7 @@ class ClassMetadata extends ElementMetadata implements MetadataInterface, ClassB
$this->defaultGroup = $class; $this->defaultGroup = $class;
} }
} }
public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null) public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null)
{ {
if (null === $propagatedGroup && Constraint::DEFAULT_GROUP === $group if (null === $propagatedGroup && Constraint::DEFAULT_GROUP === $group