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

View File

@ -59,19 +59,8 @@
<label for="priority">Priority</label>
<select id="priority" name="priority" onchange="document.getElementById('priority-form').submit(); ">
{# values < 0 are custom levels #}
{% for value, text in {
100: 'DEBUG',
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>
{% for value, text in { 100: 'DEBUG', 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 %}
</select>
<noscript>
@ -122,11 +111,7 @@
{% set from = '-' %}
{% endif %}
<li>Called from {{ call.file is defined and call.line is defined
? call.file|format_file(call.line, from)
: from|raw
}}
</li>
<li>Called from {{ call.file is defined and call.line is defined ? call.file|format_file(call.line, from) : from|raw }}</li>
{{ index == log.context.stack|length - 1 ? '</ul>' : '' }}
{% endfor %}

View File

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

View File

@ -610,15 +610,15 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($inputDefinition->hasOption('custom'));
}
public function testSettingCustomInputDefinitionOverwritesDefaultValues()
{
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
$application->setDefinition(new InputDefinition(array(new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.'))));
$inputDefinition = $application->getDefinition();
// 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.
*
*
* @param ResourceInterface[] $resources An array of resources
*
*
* @return ContainerBuilder The current instance
*
*
* @api
*/
public function setResources(array $resources)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -406,7 +406,6 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder = $finder->append($finder1);
$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(
function () {},
function ($value) { // reverseTransform
return 'foobar';
}
));
@ -507,6 +508,7 @@ class FormTypeTest extends TypeTestCase
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
function () {},
function ($value) use ($ref2) { // reverseTransform
return $ref2;
}
));

View File

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

View File

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

View File

@ -179,7 +179,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$collection->expects($this->once())
->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->assertGreaterThanOrEqual(time() - -1, $criteria[$that->options['time_field']]['$lt']->sec);
}));

View File

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

View File

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

View File

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

View File

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

View File

@ -194,7 +194,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
class EventSubscriber implements EventSubscriberInterface
{
static public function getSubscribedEvents()
public static function getSubscribedEvents()
{
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) {
$test->assertNull($previousValue);
return '';
});
$this->assertEquals(array('foo' => ''), $this->options->all());

View File

@ -115,7 +115,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
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();
$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()
{
$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();
while ($p->isRunning()) {
@ -134,7 +134,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
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();
$this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches));
@ -142,7 +142,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
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();
while ($p->isRunning()) {

View File

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

View File

@ -83,6 +83,7 @@ class ApacheUrlMatcher extends UrlMatcher
if (null !== $route) {
$parameters['_route'] = $route;
return $this->mergeDefaults($parameters, $defaults);
} elseif (0 < count($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.
*
*
* It implements \IteratorAggregate.
*
* @see all()

View File

@ -131,7 +131,7 @@ class RouteCompiler implements RouteCompilerInterface
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
// 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
// directly adjacent, e.g. '/{x}{y}'.
$regexp .= '+';

View File

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

View File

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

View File

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

View File

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

View File

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