Merge branch '2.7' into 2.8
* 2.7: CS fixes Remove trailing space CS: apply rules [Yaml] Clean some messages + add test case [Form] Fix UrlType transforms valid protocols [SecurityBundle] Changed encoder configuration example to bcrypt
This commit is contained in:
commit
37956db606
@ -138,7 +138,6 @@ abstract class DoctrineType extends AbstractType
|
||||
$type = $this;
|
||||
|
||||
$choiceLoader = function (Options $options) use ($choiceListFactory, &$choiceLoaders, $type) {
|
||||
|
||||
// Unless the choices are given explicitly, load them on demand
|
||||
if (null === $options['choices']) {
|
||||
$hash = null;
|
||||
|
@ -44,7 +44,7 @@ class DoctrineExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->extension->expects($this->any())
|
||||
->method('getObjectManagerElementName')
|
||||
->will($this->returnCallback(function ($name) {
|
||||
return 'doctrine.orm.'.$name;
|
||||
return 'doctrine.orm.'.$name;
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ class DebugCommand extends Command
|
||||
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'),
|
||||
))
|
||||
->setDescription('Shows a list of twig functions, filters, globals and tests')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command outputs a list of twig functions,
|
||||
filters, globals and tests. Output can be filtered with an optional argument.
|
||||
|
||||
|
@ -62,7 +62,7 @@ class LintCommand extends Command
|
||||
->setDescription('Lints a template and outputs encountered errors')
|
||||
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
|
||||
->addArgument('filename', InputArgument::IS_ARRAY)
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command lints a template and outputs to STDOUT
|
||||
the first encountered syntax error.
|
||||
|
||||
|
@ -39,7 +39,7 @@ class ConfigDebugCommand extends AbstractConfigCommand
|
||||
new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'),
|
||||
))
|
||||
->setDescription('Dumps the current configuration for an extension')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command dumps the current configuration for an
|
||||
extension/bundle.
|
||||
|
||||
|
@ -39,7 +39,7 @@ class EventDispatcherDebugCommand extends ContainerAwareCommand
|
||||
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'),
|
||||
))
|
||||
->setDescription('Displays configured listeners for an application')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command displays all configured listeners:
|
||||
|
||||
<info>php %command.full_name%</info>
|
||||
|
@ -41,7 +41,7 @@ class ServerStartCommand extends ServerCommand
|
||||
))
|
||||
->setName('server:start')
|
||||
->setDescription('Starts PHP built-in web server in the background')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> runs PHP's built-in web server:
|
||||
|
||||
<info>php %command.full_name%</info>
|
||||
|
@ -36,7 +36,7 @@ class ServerStopCommand extends ServerCommand
|
||||
))
|
||||
->setName('server:stop')
|
||||
->setDescription('Stops PHP\'s built-in web server that was started with the server:start command')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> stops PHP's built-in web server:
|
||||
|
||||
<info>php %command.full_name%</info>
|
||||
|
@ -53,7 +53,7 @@ class TranslationDebugCommand extends ContainerAwareCommand
|
||||
new InputOption('all', null, InputOption::VALUE_NONE, 'Load messages from all registered bundles'),
|
||||
))
|
||||
->setDescription('Displays translation messages information')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command helps finding unused or missing translation
|
||||
messages and comparing them with the fallback ones by inspecting the
|
||||
templates and translation files of a given bundle or the app folder.
|
||||
|
@ -35,7 +35,7 @@ class YamlLintCommand extends Command
|
||||
->setDescription('Lints a file and outputs encountered errors')
|
||||
->addArgument('filename', null, 'A file or a directory or STDIN')
|
||||
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command lints a YAML file and outputs to STDOUT
|
||||
the first encountered syntax error.
|
||||
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> %
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> %
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?>
|
||||
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?>
|
||||
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?>
|
||||
|
@ -164,7 +164,6 @@ class Router extends BaseRouter implements WarmableInterface
|
||||
gettype($resolved)
|
||||
)
|
||||
);
|
||||
|
||||
}, $value);
|
||||
|
||||
return str_replace('%%', '%', $escapedValue);
|
||||
|
@ -88,7 +88,6 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->will($this->returnValueMap(array(
|
||||
array('router', 1, $router),
|
||||
array('controller_name_converter', 1, $loader),
|
||||
|
||||
)));
|
||||
|
||||
return $container;
|
||||
|
@ -136,7 +136,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('extract')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
|
||||
$catalogue->add($extractedMessages);
|
||||
$catalogue->add($extractedMessages);
|
||||
})
|
||||
);
|
||||
|
||||
@ -146,7 +146,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('loadMessages')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
|
||||
$catalogue->add($loadedMessages);
|
||||
$catalogue->add($loadedMessages);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -91,7 +91,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('extract')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
|
||||
$catalogue->add($extractedMessages);
|
||||
$catalogue->add($extractedMessages);
|
||||
})
|
||||
);
|
||||
|
||||
@ -101,7 +101,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('loadMessages')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
|
||||
$catalogue->add($loadedMessages);
|
||||
$catalogue->add($loadedMessages);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -146,6 +146,7 @@ abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
abstract protected function getDescriptor();
|
||||
|
||||
abstract protected function getFormat();
|
||||
|
||||
private function assertDescription($expectedDescription, $describedObject, array $options = array())
|
||||
|
@ -191,9 +191,11 @@ class CallableClass
|
||||
public function __invoke()
|
||||
{
|
||||
}
|
||||
|
||||
public static function staticMethod()
|
||||
{
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
This template is used for translation message extraction tests
|
||||
<?php echo $view['translator']->trans('single-quoted key') ?>
|
||||
<?php echo $view['translator']->trans('double-quoted key') ?>
|
||||
<?php echo $view['translator']->trans(<<<EOF
|
||||
<?php echo $view['translator']->trans(<<<'EOF'
|
||||
heredoc key
|
||||
EOF
|
||||
) ?>
|
||||
|
@ -99,7 +99,7 @@ class SecurityDataCollector extends DataCollector
|
||||
'token_class' => get_class($token),
|
||||
'logout_url' => $logoutUrl,
|
||||
'user' => $token->getUsername(),
|
||||
'roles' => array_map(function (RoleInterface $role) { return $role->getRole();}, $assignedRoles),
|
||||
'roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $assignedRoles),
|
||||
'inherited_roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles),
|
||||
'supports_role_hierarchy' => null !== $this->roleHierarchy,
|
||||
);
|
||||
|
@ -430,11 +430,10 @@ class MainConfiguration implements ConfigurationInterface
|
||||
->children()
|
||||
->arrayNode('encoders')
|
||||
->example(array(
|
||||
'Acme\DemoBundle\Entity\User1' => 'sha512',
|
||||
'Acme\DemoBundle\Entity\User2' => array(
|
||||
'algorithm' => 'sha512',
|
||||
'encode_as_base64' => 'true',
|
||||
'iterations' => 5000,
|
||||
'AppBundle\Entity\User1' => 'bcrypt',
|
||||
'AppBundle\Entity\User2' => array(
|
||||
'algorithm' => 'bcrypt',
|
||||
'cost' => 13,
|
||||
),
|
||||
))
|
||||
->requiresAtLeastOneElement()
|
||||
|
@ -25,7 +25,7 @@ interface SecurityFactoryInterface
|
||||
* Configures the container services required to use the authentication listener.
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
* @param string $id The unique id of the firewall
|
||||
* @param string $id The unique id of the firewall
|
||||
* @param array $config The options array for the listener
|
||||
* @param string $userProvider The service id of the user provider
|
||||
* @param string $defaultEntryPoint
|
||||
@ -48,7 +48,7 @@ interface SecurityFactoryInterface
|
||||
/**
|
||||
* Defines the configuration key used to reference the provider
|
||||
* in the firewall configuration.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKey();
|
||||
|
@ -34,7 +34,6 @@ class PreviewErrorControllerTest extends TestCase
|
||||
->method('handle')
|
||||
->with(
|
||||
$this->callback(function (Request $request) use ($self, $logicalControllerName, $code) {
|
||||
|
||||
$self->assertEquals($logicalControllerName, $request->attributes->get('_controller'));
|
||||
|
||||
$exception = $request->attributes->get('exception');
|
||||
|
@ -115,7 +115,7 @@ class FilesystemLoaderTest extends TestCase
|
||||
$method->setAccessible(true);
|
||||
$method->invoke($loader, 'name.format.engine');
|
||||
}
|
||||
|
||||
|
||||
public function testTwigSoftErrorIfTemplateDoesNotExist()
|
||||
{
|
||||
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
|
@ -34,7 +34,7 @@ class XmlReferenceDumperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getConfigurationAsString()
|
||||
{
|
||||
return str_replace("\n", PHP_EOL, <<<EOL
|
||||
return str_replace("\n", PHP_EOL, <<<'EOL'
|
||||
<!-- Namespace: http://example.org/schema/dic/acme_root -->
|
||||
<!-- scalar-required: Required -->
|
||||
<!-- enum-with-default: One of "this"; "that" -->
|
||||
|
@ -112,7 +112,7 @@ TABLE
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
TableHelper::LAYOUT_COMPACT,
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
ISBN Title Author
|
||||
99921-58-10-7 Divine Comedy Dante Alighieri
|
||||
9971-5-0210-0 A Tale of Two Cities Charles Dickens
|
||||
@ -125,7 +125,7 @@ TABLE
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
TableHelper::LAYOUT_BORDERLESS,
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
=============== ========================== ==================
|
||||
ISBN Title Author
|
||||
=============== ========================== ==================
|
||||
|
@ -46,35 +46,35 @@ class ProcessHelperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function provideCommandsAndOutput()
|
||||
{
|
||||
$successOutputVerbose = <<<EOT
|
||||
$successOutputVerbose = <<<'EOT'
|
||||
RUN php -r "echo 42;"
|
||||
RES Command ran successfully
|
||||
|
||||
EOT;
|
||||
$successOutputDebug = <<<EOT
|
||||
$successOutputDebug = <<<'EOT'
|
||||
RUN php -r "echo 42;"
|
||||
OUT 42
|
||||
RES Command ran successfully
|
||||
|
||||
EOT;
|
||||
$successOutputDebugWithTags = <<<EOT
|
||||
$successOutputDebugWithTags = <<<'EOT'
|
||||
RUN php -r "echo '<info>42</info>';"
|
||||
OUT <info>42</info>
|
||||
RES Command ran successfully
|
||||
|
||||
EOT;
|
||||
$successOutputProcessDebug = <<<EOT
|
||||
$successOutputProcessDebug = <<<'EOT'
|
||||
RUN 'php' '-r' 'echo 42;'
|
||||
OUT 42
|
||||
RES Command ran successfully
|
||||
|
||||
EOT;
|
||||
$syntaxErrorOutputVerbose = <<<EOT
|
||||
$syntaxErrorOutputVerbose = <<<'EOT'
|
||||
RUN php -r "fwrite(STDERR, 'error message');usleep(50000);fwrite(STDOUT, 'out message');exit(252);"
|
||||
RES 252 Command did not run successfully
|
||||
|
||||
EOT;
|
||||
$syntaxErrorOutputDebug = <<<EOT
|
||||
$syntaxErrorOutputDebug = <<<'EOT'
|
||||
RUN php -r "fwrite(STDERR, 'error message');usleep(500000);fwrite(STDOUT, 'out message');exit(252);"
|
||||
ERR error message
|
||||
OUT out message
|
||||
|
@ -273,8 +273,6 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testSetCurrentBeforeStarting()
|
||||
{
|
||||
$bar = new ProgressBar($this->getOutputStream());
|
||||
@ -582,7 +580,6 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
|
||||
" \033[44;37m Starting the demo... fingers crossed \033[0m\n".
|
||||
' 0/15 '.$progress.str_repeat($empty, 26)." 0%\n".
|
||||
" \xf0\x9f\x8f\x81 < 1 sec \033[44;37m 0 B \033[0m"
|
||||
|
@ -96,7 +96,7 @@ class TableTest extends \PHPUnit_Framework_TestCase
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+--------------------------+------------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+--------------------------+------------------+
|
||||
@ -112,7 +112,7 @@ TABLE
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
'compact',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
ISBN Title Author
|
||||
99921-58-10-7 Divine Comedy Dante Alighieri
|
||||
9971-5-0210-0 A Tale of Two Cities Charles Dickens
|
||||
@ -125,7 +125,7 @@ TABLE
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
'borderless',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
=============== ========================== ==================
|
||||
ISBN Title Author
|
||||
=============== ========================== ==================
|
||||
@ -146,7 +146,7 @@ TABLE
|
||||
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+--------------------------+------------------+
|
||||
| ISBN | Title | |
|
||||
+---------------+--------------------------+------------------+
|
||||
@ -167,7 +167,7 @@ TABLE
|
||||
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+--------------------------+------------------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
|
||||
| 9971-5-0210-0 | | |
|
||||
@ -186,7 +186,7 @@ TABLE
|
||||
array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+----------------------------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+----------------------------+-----------------+
|
||||
@ -206,7 +206,7 @@ TABLE
|
||||
array('ISBN', 'Title'),
|
||||
array(),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------+-------+
|
||||
| ISBN | Title |
|
||||
+------+-------+
|
||||
@ -226,7 +226,7 @@ TABLE
|
||||
array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+----------------------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+----------------------+-----------------+
|
||||
@ -243,7 +243,7 @@ TABLE
|
||||
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+----------------------------------+----------------------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+----------------------------------+----------------------+-----------------+
|
||||
@ -275,7 +275,7 @@ TABLE
|
||||
),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+-------------------------------+-------------------------------+-----------------------------+
|
||||
| ISBN | Title | Author |
|
||||
+-------------------------------+-------------------------------+-----------------------------+
|
||||
@ -308,7 +308,7 @@ TABLE
|
||||
array('80-902734-1-7', 'Test'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+----------------------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+----------------------+-----------------+
|
||||
@ -341,7 +341,7 @@ TABLE
|
||||
array('J. R. R'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------------------+---------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+------------------+---------+-----------------+
|
||||
@ -376,7 +376,7 @@ TABLE
|
||||
),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+-----------------+-------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+-----------------+-------+-----------------+
|
||||
@ -413,7 +413,7 @@ TABLE
|
||||
array('Charles Dickens'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+-----------------+-------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+-----------------+-------+-----------------+
|
||||
@ -440,7 +440,7 @@ TABLE
|
||||
array('Charles Dickens'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+-----------------+
|
||||
| ISBN | Author |
|
||||
+---------------+-----------------+
|
||||
@ -458,7 +458,7 @@ TABLE
|
||||
),
|
||||
array(),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------+-------+--------+
|
||||
| Main title |
|
||||
+------+-------+--------+
|
||||
@ -478,7 +478,7 @@ TABLE
|
||||
),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---+--+--+---+--+---+--+---+--+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
+---+--+--+---+--+---+--+---+--+
|
||||
@ -499,7 +499,7 @@ TABLE
|
||||
$table->render();
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------+
|
||||
| ■■ |
|
||||
+------+
|
||||
@ -529,7 +529,7 @@ TABLE;
|
||||
$table->render();
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
.......
|
||||
. Foo .
|
||||
.......
|
||||
@ -556,7 +556,7 @@ TABLE;
|
||||
$table->render();
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------+
|
||||
| Foo |
|
||||
+------+
|
||||
|
@ -118,8 +118,6 @@ class Reader
|
||||
$this->position += $length;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function moveToEnd()
|
||||
{
|
||||
$this->position = $this->length;
|
||||
|
@ -1,14 +1,14 @@
|
||||
--TEST--
|
||||
Test symfony_zval_info API
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?>
|
||||
<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$int = 42;
|
||||
$float = 42.42;
|
||||
$str = "foobar";
|
||||
$object = new StdClass;
|
||||
$str = 'foobar';
|
||||
$object = new StdClass();
|
||||
$array = array('foo', 'bar');
|
||||
$resource = tmpfile();
|
||||
$null = null;
|
||||
@ -17,15 +17,17 @@ $bool = true;
|
||||
$anotherint = 42;
|
||||
$refcount2 = &$anotherint;
|
||||
|
||||
$var = array('int' => $int,
|
||||
'float' => $float,
|
||||
'str' => $str,
|
||||
'object' => $object,
|
||||
'array' => $array,
|
||||
'resource' => $resource,
|
||||
'null' => $null,
|
||||
'bool' => $bool,
|
||||
'refcount' => &$refcount2);
|
||||
$var = array(
|
||||
'int' => $int,
|
||||
'float' => $float,
|
||||
'str' => $str,
|
||||
'object' => $object,
|
||||
'array' => $array,
|
||||
'resource' => $resource,
|
||||
'null' => $null,
|
||||
'bool' => $bool,
|
||||
'refcount' => &$refcount2,
|
||||
);
|
||||
|
||||
var_dump(symfony_zval_info('int', $var));
|
||||
var_dump(symfony_zval_info('float', $var));
|
||||
|
@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test symfony_debug_backtrace in case of fatal error
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?>
|
||||
<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -18,7 +18,6 @@ function foo()
|
||||
function bt()
|
||||
{
|
||||
print_r(symfony_debug_backtrace());
|
||||
|
||||
}
|
||||
|
||||
register_shutdown_function('bt');
|
||||
|
@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test symfony_debug_backtrace in case of non fatal error
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?>
|
||||
<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -13,7 +13,6 @@ function bar()
|
||||
function bt()
|
||||
{
|
||||
print_r(symfony_debug_backtrace());
|
||||
|
||||
}
|
||||
|
||||
bar();
|
||||
|
@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test ErrorHandler in case of fatal error
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?>
|
||||
<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace Symfony\Component\DependencyInjection\Compiler;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* A pass to automatically process extensions if they implement
|
||||
* A pass to automatically process extensions if they implement
|
||||
* CompilerPassInterface.
|
||||
*
|
||||
* @author Wouter J <wouter@wouterj.nl>
|
||||
|
@ -794,12 +794,11 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$loader = new ClosureLoader($container = new ContainerBuilder());
|
||||
$loader->load(function (ContainerBuilder $container) {
|
||||
$container->set('a', new \BazClass());
|
||||
$definition = new Definition('BazClass');
|
||||
$definition->setLazy(true);
|
||||
$container->setDefinition('a', $definition);
|
||||
}
|
||||
);
|
||||
$container->set('a', new \BazClass());
|
||||
$definition = new Definition('BazClass');
|
||||
$definition->setLazy(true);
|
||||
$container->setDefinition('a', $definition);
|
||||
});
|
||||
|
||||
$container->setResourceTracking(true);
|
||||
|
||||
|
@ -6,7 +6,7 @@ if (is_file($file)) {
|
||||
}
|
||||
|
||||
$phar = new Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar');
|
||||
$phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<EOT
|
||||
$phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<'EOT'
|
||||
<?php
|
||||
|
||||
class ProjectWithXsdExtensionInPhar extends ProjectExtension
|
||||
@ -28,7 +28,7 @@ class ProjectWithXsdExtensionInPhar extends ProjectExtension
|
||||
}
|
||||
EOT
|
||||
);
|
||||
$phar->addFromString('schema/project-1.0.xsd', <<<EOT
|
||||
$phar->addFromString('schema/project-1.0.xsd', <<<'EOT'
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<xsd:schema xmlns="http://www.example.com/schema/projectwithxsdinphar"
|
||||
|
@ -188,7 +188,8 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
||||
$form = $this->createForm('<form>'.$form.'</form>');
|
||||
$this->assertEquals(
|
||||
$values,
|
||||
array_map(function ($field) {
|
||||
array_map(
|
||||
function ($field) {
|
||||
$class = get_class($field);
|
||||
|
||||
return array(substr($class, strrpos($class, '\\') + 1), $field->getValue());
|
||||
|
@ -20,7 +20,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$node = new Node(array(new ConstantNode('foo')));
|
||||
|
||||
$this->assertEquals(<<<EOF
|
||||
$this->assertEquals(<<<'EOF'
|
||||
Node(
|
||||
ConstantNode(value: 'foo')
|
||||
)
|
||||
|
@ -77,7 +77,6 @@ class PathFilterIteratorTest extends IteratorTestCase
|
||||
array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
|
||||
array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')),
|
||||
array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
{
|
||||
if (!is_callable($mode)) {
|
||||
switch ($mode) {
|
||||
case SortableIterator::SORT_BY_ACCESSED_TIME :
|
||||
case SortableIterator::SORT_BY_ACCESSED_TIME:
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
touch(self::toAbsolute('.git'));
|
||||
} else {
|
||||
@ -41,12 +41,12 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
sleep(1);
|
||||
file_get_contents(self::toAbsolute('.bar'));
|
||||
break;
|
||||
case SortableIterator::SORT_BY_CHANGED_TIME :
|
||||
case SortableIterator::SORT_BY_CHANGED_TIME:
|
||||
file_put_contents(self::toAbsolute('test.php'), 'foo');
|
||||
sleep(1);
|
||||
file_put_contents(self::toAbsolute('test.py'), 'foo');
|
||||
break;
|
||||
case SortableIterator::SORT_BY_MODIFIED_TIME :
|
||||
case SortableIterator::SORT_BY_MODIFIED_TIME:
|
||||
file_put_contents(self::toAbsolute('test.php'), 'foo');
|
||||
sleep(1);
|
||||
file_put_contents(self::toAbsolute('test.py'), 'foo');
|
||||
|
@ -38,7 +38,7 @@ class FixUrlProtocolListener implements EventSubscriberInterface
|
||||
{
|
||||
$data = $event->getData();
|
||||
|
||||
if ($this->defaultProtocol && $data && !preg_match('~^\w+://~', $data)) {
|
||||
if ($this->defaultProtocol && $data && !preg_match('~^[\w+.-]+://~', $data)) {
|
||||
$event->setData($this->defaultProtocol.'://'.$data);
|
||||
}
|
||||
}
|
||||
|
@ -40,15 +40,28 @@ class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://www.symfony.com', $event->getData());
|
||||
}
|
||||
|
||||
public function testSkipOtherProtocol()
|
||||
public function provideUrlsWithSupportedProtocols()
|
||||
{
|
||||
return array(
|
||||
array('ftp://www.symfony.com'),
|
||||
array('chrome-extension://foo'),
|
||||
array('h323://foo'),
|
||||
array('iris.beep://foo'),
|
||||
array('foo+bar://foo'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideUrlsWithSupportedProtocols
|
||||
*/
|
||||
public function testSkipOtherProtocol($url)
|
||||
{
|
||||
$data = 'ftp://www.symfony.com';
|
||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||
$event = new FormEvent($form, $data);
|
||||
$event = new FormEvent($form, $url);
|
||||
|
||||
$filter = new FixUrlProtocolListener('http');
|
||||
$filter->onSubmit($event);
|
||||
|
||||
$this->assertEquals('ftp://www.symfony.com', $event->getData());
|
||||
$this->assertEquals($url, $event->getData());
|
||||
}
|
||||
}
|
||||
|
@ -485,7 +485,6 @@ class FormTypeTest extends BaseTypeTest
|
||||
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
|
||||
function () {},
|
||||
function ($value) { // reverseTransform
|
||||
|
||||
return 'foobar';
|
||||
}
|
||||
));
|
||||
@ -511,7 +510,6 @@ class FormTypeTest extends BaseTypeTest
|
||||
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
|
||||
function () {},
|
||||
function ($value) use ($ref2) { // reverseTransform
|
||||
|
||||
return $ref2;
|
||||
}
|
||||
));
|
||||
|
@ -641,10 +641,10 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$form = $this->getBuilder()
|
||||
->setEmptyData('foo')
|
||||
->addViewTransformer(new FixedDataTransformer(array(
|
||||
'' => '',
|
||||
// direction is reversed!
|
||||
'bar' => 'foo',
|
||||
)))
|
||||
'' => '',
|
||||
// direction is reversed!
|
||||
'bar' => 'foo',
|
||||
)))
|
||||
->getForm();
|
||||
|
||||
$form->submit('');
|
||||
@ -657,17 +657,17 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$test = $this;
|
||||
$form = $this->getBuilder()
|
||||
->setEmptyData(function ($form) use ($test) {
|
||||
// the form instance is passed to the closure to allow use
|
||||
// of form data when creating the empty value
|
||||
$test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form);
|
||||
// the form instance is passed to the closure to allow use
|
||||
// of form data when creating the empty value
|
||||
$test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form);
|
||||
|
||||
return 'foo';
|
||||
})
|
||||
return 'foo';
|
||||
})
|
||||
->addViewTransformer(new FixedDataTransformer(array(
|
||||
'' => '',
|
||||
// direction is reversed!
|
||||
'bar' => 'foo',
|
||||
)))
|
||||
'' => '',
|
||||
// direction is reversed!
|
||||
'bar' => 'foo',
|
||||
)))
|
||||
->getForm();
|
||||
|
||||
$form->submit('');
|
||||
|
@ -1090,7 +1090,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
array('put'),
|
||||
array('delete'),
|
||||
array('patch'),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
|
||||
private function notImplemented(array $dataSets)
|
||||
{
|
||||
return array_map(function ($row) {
|
||||
return array($row[0], $row[1], 0);
|
||||
}, $dataSets);
|
||||
return array($row[0], $row[1], 0);
|
||||
}, $dataSets);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface
|
||||
* Whatever value you return here will be passed to getUser() and checkCredentials()
|
||||
*
|
||||
* For example, for a form login, you might:
|
||||
*
|
||||
*
|
||||
* if ($request->request->has('_username')) {
|
||||
* return array(
|
||||
* 'username' => $request->request->get('_username'),
|
||||
@ -87,7 +87,7 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface
|
||||
*
|
||||
* @param mixed $credentials
|
||||
* @param UserInterface $user
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws AuthenticationException
|
||||
|
@ -141,7 +141,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
public function testContext()
|
||||
{
|
||||
$array = array('person' => array('name' => 'George Abitbol'));
|
||||
$expected = <<<XML
|
||||
$expected = <<<'XML'
|
||||
<?xml version="1.0"?>
|
||||
<response>
|
||||
<person>
|
||||
@ -255,7 +255,7 @@ XML;
|
||||
$serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder()));
|
||||
$this->encoder->setSerializer($serializer);
|
||||
|
||||
$expected = <<<XML
|
||||
$expected = <<<'XML'
|
||||
<?xml version="1.0"?>
|
||||
<response><foo>normalizedFoo</foo><bar>normalizedBar</bar></response>
|
||||
|
||||
@ -366,7 +366,7 @@ XML;
|
||||
|
||||
public function testDecodeIgnoreWhiteSpace()
|
||||
{
|
||||
$source = <<<XML
|
||||
$source = <<<'XML'
|
||||
<?xml version="1.0"?>
|
||||
<people>
|
||||
<person>
|
||||
|
@ -355,8 +355,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bar) {
|
||||
return 'baz';
|
||||
},
|
||||
return 'baz';
|
||||
},
|
||||
),
|
||||
'baz',
|
||||
array('foo' => '', 'bar' => 'baz', 'baz' => true),
|
||||
@ -365,8 +365,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bar) {
|
||||
return;
|
||||
},
|
||||
return;
|
||||
},
|
||||
),
|
||||
'baz',
|
||||
array('foo' => '', 'bar' => null, 'baz' => true),
|
||||
@ -375,8 +375,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bar) {
|
||||
return $bar->format('d-m-Y H:i:s');
|
||||
},
|
||||
return $bar->format('d-m-Y H:i:s');
|
||||
},
|
||||
),
|
||||
new \DateTime('2011-09-10 06:30:00'),
|
||||
array('foo' => '', 'bar' => '10-09-2011 06:30:00', 'baz' => true),
|
||||
@ -385,13 +385,13 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bars) {
|
||||
$foos = '';
|
||||
foreach ($bars as $bar) {
|
||||
$foos .= $bar->getFoo();
|
||||
}
|
||||
$foos = '';
|
||||
foreach ($bars as $bar) {
|
||||
$foos .= $bar->getFoo();
|
||||
}
|
||||
|
||||
return $foos;
|
||||
},
|
||||
return $foos;
|
||||
},
|
||||
),
|
||||
array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)),
|
||||
array('foo' => '', 'bar' => 'bazquux', 'baz' => true),
|
||||
@ -400,8 +400,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bars) {
|
||||
return count($bars);
|
||||
},
|
||||
return count($bars);
|
||||
},
|
||||
),
|
||||
array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)),
|
||||
array('foo' => '', 'bar' => 2, 'baz' => true),
|
||||
|
@ -44,7 +44,7 @@ class IcuResFileDumper extends FileDumper
|
||||
|
||||
foreach ($messages->all($domain) as $source => $target) {
|
||||
$indexes .= pack('v', strlen($data) + 28);
|
||||
$data .= $source."\0";
|
||||
$data .= $source."\0";
|
||||
}
|
||||
|
||||
$data .= $this->writePadding($data);
|
||||
|
@ -380,9 +380,9 @@ EOF
|
||||
$fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback));
|
||||
$currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current));
|
||||
|
||||
$fallbackContent .= sprintf(<<<EOF
|
||||
\$catalogue%s = new MessageCatalogue('%s', %s);
|
||||
\$catalogue%s->addFallbackCatalogue(\$catalogue%s);
|
||||
$fallbackContent .= sprintf(<<<'EOF'
|
||||
$catalogue%s = new MessageCatalogue('%s', %s);
|
||||
$catalogue%s->addFallbackCatalogue($catalogue%s);
|
||||
|
||||
EOF
|
||||
,
|
||||
|
@ -119,7 +119,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
||||
* (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped
|
||||
* in double quotes ("). Objects, arrays and resources are formatted as
|
||||
* "object", "array" and "resource". If the $format bitmask contains
|
||||
* the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted
|
||||
* the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted
|
||||
* as RFC-3339 dates ("Y-m-d H:i:s").
|
||||
*
|
||||
* Be careful when passing message parameters to a constraint violation
|
||||
|
@ -144,14 +144,14 @@ class IsbnValidator extends ConstraintValidator
|
||||
// If we test the length before the loop, we get an ERROR_TOO_SHORT
|
||||
// when actually an ERROR_INVALID_CHARACTERS is wanted, e.g. for
|
||||
// "0-45122_5244" (typo)
|
||||
if (!isset($isbn{$i})) {
|
||||
if (!isset($isbn[$i])) {
|
||||
return Isbn::TOO_SHORT_ERROR;
|
||||
}
|
||||
|
||||
if ('X' === $isbn{$i}) {
|
||||
if ('X' === $isbn[$i]) {
|
||||
$digit = 10;
|
||||
} elseif (ctype_digit($isbn{$i})) {
|
||||
$digit = $isbn{$i};
|
||||
} elseif (ctype_digit($isbn[$i])) {
|
||||
$digit = $isbn[$i];
|
||||
} else {
|
||||
return Isbn::INVALID_CHARACTERS_ERROR;
|
||||
}
|
||||
@ -159,7 +159,7 @@ class IsbnValidator extends ConstraintValidator
|
||||
$checkSum += $digit * (10 - $i);
|
||||
}
|
||||
|
||||
if (isset($isbn{$i})) {
|
||||
if (isset($isbn[$i])) {
|
||||
return Isbn::TOO_LONG_ERROR;
|
||||
}
|
||||
|
||||
@ -190,11 +190,11 @@ class IsbnValidator extends ConstraintValidator
|
||||
$checkSum = 0;
|
||||
|
||||
for ($i = 0; $i < 13; $i += 2) {
|
||||
$checkSum += $isbn{$i};
|
||||
$checkSum += $isbn[$i];
|
||||
}
|
||||
|
||||
for ($i = 1; $i < 12; $i += 2) {
|
||||
$checkSum += $isbn{$i}
|
||||
$checkSum += $isbn[$i]
|
||||
* 3;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class IssnValidator extends ConstraintValidator
|
||||
|
||||
// 1234-567X
|
||||
// ^
|
||||
if (isset($canonical{4}) && '-' === $canonical{4}) {
|
||||
if (isset($canonical[4]) && '-' === $canonical[4]) {
|
||||
// remove hyphen
|
||||
$canonical = substr($canonical, 0, 4).substr($canonical, 5);
|
||||
} elseif ($constraint->requireHyphen) {
|
||||
@ -121,7 +121,7 @@ class IssnValidator extends ConstraintValidator
|
||||
|
||||
// 1234567X
|
||||
// ^ digit, x or X
|
||||
if (!ctype_digit($canonical{7}) && 'x' !== $canonical{7} && 'X' !== $canonical{7}) {
|
||||
if (!ctype_digit($canonical[7]) && 'x' !== $canonical[7] && 'X' !== $canonical[7]) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -139,7 +139,7 @@ class IssnValidator extends ConstraintValidator
|
||||
|
||||
// 1234567X
|
||||
// ^ case-sensitive?
|
||||
if ($constraint->caseSensitive && 'x' === $canonical{7}) {
|
||||
if ($constraint->caseSensitive && 'x' === $canonical[7]) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -156,14 +156,14 @@ class IssnValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Calculate a checksum. "X" equals 10.
|
||||
$checkSum = 'X' === $canonical{7}
|
||||
|| 'x' === $canonical{7}
|
||||
$checkSum = 'X' === $canonical[7]
|
||||
|| 'x' === $canonical[7]
|
||||
? 10
|
||||
: $canonical{7};
|
||||
: $canonical[7];
|
||||
|
||||
for ($i = 0; $i < 7; ++$i) {
|
||||
// Multiply the first digit by 8, the second by 7, etc.
|
||||
$checkSum += (8 - $i) * $canonical{$i};
|
||||
$checkSum += (8 - $i) * $canonical[$i];
|
||||
}
|
||||
|
||||
if (0 !== $checkSum % 11) {
|
||||
|
@ -81,7 +81,7 @@ class LuhnValidator extends ConstraintValidator
|
||||
// ^ ^ ^ ^ ^ ^
|
||||
// = 7 + 9 + 7 + 9 + 7 + 3
|
||||
for ($i = $length - 1; $i >= 0; $i -= 2) {
|
||||
$checkSum += $value{$i};
|
||||
$checkSum += $value[$i];
|
||||
}
|
||||
|
||||
// Starting with the second last digit and walking left, double every
|
||||
@ -91,7 +91,7 @@ class LuhnValidator extends ConstraintValidator
|
||||
// ^ ^ ^ ^ ^
|
||||
// = 1+8 + 4 + 6 + 1+6 + 2
|
||||
for ($i = $length - 2; $i >= 0; $i -= 2) {
|
||||
$checkSum += array_sum(str_split($value{$i} * 2));
|
||||
$checkSum += array_sum(str_split($value[$i] * 2));
|
||||
}
|
||||
|
||||
if (0 === $checkSum || 0 !== $checkSum % 10) {
|
||||
|
@ -118,7 +118,7 @@ class UuidValidator extends ConstraintValidator
|
||||
|
||||
for ($i = 0; $i < $l; ++$i) {
|
||||
// Check length
|
||||
if (!isset($trimmed{$i})) {
|
||||
if (!isset($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -137,7 +137,7 @@ class UuidValidator extends ConstraintValidator
|
||||
// Hyphens must occur every fifth position
|
||||
// xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx
|
||||
// ^ ^ ^ ^ ^ ^ ^
|
||||
if ('-' === $trimmed{$i}) {
|
||||
if ('-' === $trimmed[$i]) {
|
||||
if ($i !== $h) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
@ -166,7 +166,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check characters
|
||||
if (!ctype_xdigit($trimmed{$i})) {
|
||||
if (!ctype_xdigit($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -184,7 +184,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check length again
|
||||
if (isset($trimmed{$i})) {
|
||||
if (isset($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -213,7 +213,7 @@ class UuidValidator extends ConstraintValidator
|
||||
|
||||
for ($i = 0; $i < self::STRICT_LENGTH; ++$i) {
|
||||
// Check length
|
||||
if (!isset($value{$i})) {
|
||||
if (!isset($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -232,7 +232,7 @@ class UuidValidator extends ConstraintValidator
|
||||
// Check hyphen placement
|
||||
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
// ^ ^ ^ ^
|
||||
if ('-' === $value{$i}) {
|
||||
if ('-' === $value[$i]) {
|
||||
if ($i !== $h) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
@ -259,7 +259,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check characters
|
||||
if (!ctype_xdigit($value{$i})) {
|
||||
if (!ctype_xdigit($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -294,7 +294,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check length again
|
||||
if (isset($value{$i})) {
|
||||
if (isset($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -309,7 +309,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check version
|
||||
if (!in_array($value{self::STRICT_VERSION_POSITION}, $constraint->versions)) {
|
||||
if (!in_array($value[self::STRICT_VERSION_POSITION], $constraint->versions)) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -327,7 +327,7 @@ class UuidValidator extends ConstraintValidator
|
||||
// 0b10xx
|
||||
// & 0b1100 (12)
|
||||
// = 0b1000 (8)
|
||||
if ((hexdec($value{self::STRICT_VARIANT_POSITION}) & 12) !== 8) {
|
||||
if ((hexdec($value[self::STRICT_VARIANT_POSITION]) & 12) !== 8) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -185,7 +185,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -201,7 +200,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -217,7 +215,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -235,7 +232,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -255,7 +251,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -273,7 +268,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ class PropertyPath
|
||||
public static function append($basePath, $subPath)
|
||||
{
|
||||
if ('' !== (string) $subPath) {
|
||||
if ('[' === $subPath{0}) {
|
||||
if ('[' === $subPath[0]) {
|
||||
return $basePath.$subPath;
|
||||
}
|
||||
|
||||
|
@ -314,6 +314,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
|
||||
|
||||
return array($groups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an object against the constraints defined for its class.
|
||||
*
|
||||
|
@ -59,7 +59,7 @@ class CliDumper extends AbstractDumper
|
||||
parent::__construct($output, $charset);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR && 'ON' !== @getenv('ConEmuANSI') && 'xterm' !== @getenv('TERM')) {
|
||||
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
|
||||
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
|
||||
$this->setStyles(array(
|
||||
'default' => '31',
|
||||
'num' => '1;34',
|
||||
|
@ -120,7 +120,7 @@ EOTXT
|
||||
$var = xml_parser_create();
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
xml resource {
|
||||
current_byte_index: %i
|
||||
current_column_number: %i
|
||||
@ -142,7 +142,7 @@ EOTXT
|
||||
$var[''] = 2;
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
array:4 [
|
||||
"0" => {}
|
||||
"1" => &1 null
|
||||
@ -161,7 +161,7 @@ EOTXT
|
||||
$var->{1} = 2;
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
{
|
||||
+1: 1
|
||||
+"1": 2
|
||||
@ -351,7 +351,7 @@ EOTXT
|
||||
$var = $this->getSpecialVars();
|
||||
|
||||
$this->assertDumpEquals(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
array:3 [
|
||||
0 => array:1 [
|
||||
0 => &1 array:1 [
|
||||
@ -397,7 +397,7 @@ EOTXT
|
||||
$dumper->dump($data);
|
||||
|
||||
$this->assertSame(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
array:2 [
|
||||
1 => array:1 [
|
||||
"GLOBALS" => &1 array:1 [
|
||||
@ -439,7 +439,7 @@ EOTXT
|
||||
});
|
||||
|
||||
$this->assertSame(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
array:1 [
|
||||
0 => array:1 [
|
||||
0 => array:1 [
|
||||
|
@ -132,7 +132,7 @@ EOTXT
|
||||
$out = stream_get_contents($out, -1, 0);
|
||||
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
<foo></foo><bar>b"<span class=sf-dump-str title="7 binary or non-UTF-8 characters">Словарь</span>"
|
||||
</bar>
|
||||
|
||||
|
@ -251,7 +251,7 @@ class Inline
|
||||
$output = $match[1];
|
||||
$i += strlen($output);
|
||||
} else {
|
||||
throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar));
|
||||
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar));
|
||||
}
|
||||
|
||||
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
|
||||
@ -283,7 +283,7 @@ class Inline
|
||||
private static function parseQuotedScalar($scalar, &$i)
|
||||
{
|
||||
if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
|
||||
throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i)));
|
||||
throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)));
|
||||
}
|
||||
|
||||
$output = substr($match[0], 1, strlen($match[0]) - 2);
|
||||
@ -356,7 +356,7 @@ class Inline
|
||||
++$i;
|
||||
}
|
||||
|
||||
throw new ParseException(sprintf('Malformed inline YAML string %s', $sequence));
|
||||
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -444,7 +444,7 @@ class Inline
|
||||
}
|
||||
}
|
||||
|
||||
throw new ParseException(sprintf('Malformed inline YAML string %s', $mapping));
|
||||
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -448,4 +448,13 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported}.
|
||||
*/
|
||||
public function testNotSupportedMissingValue()
|
||||
{
|
||||
Inline::parse('{this, is not, supported}');
|
||||
}
|
||||
}
|
||||
|
@ -421,13 +421,13 @@ EOF;
|
||||
|
||||
public function testObjectSupportEnabled()
|
||||
{
|
||||
$input = <<<EOF
|
||||
$input = <<<'EOF'
|
||||
foo: !!php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF;
|
||||
$this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, false, true), '->parse() is able to parse objects');
|
||||
|
||||
$input = <<<EOF
|
||||
$input = <<<'EOF'
|
||||
foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF;
|
||||
@ -454,7 +454,7 @@ EOF;
|
||||
{
|
||||
$tests = array();
|
||||
|
||||
$yaml = <<<EOF
|
||||
$yaml = <<<'EOF'
|
||||
foo:
|
||||
fiz: [cat]
|
||||
EOF;
|
||||
@ -475,7 +475,7 @@ EOF;
|
||||
$expected->baz = 'foobar';
|
||||
$tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected);
|
||||
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
array:
|
||||
- key: one
|
||||
- key: two
|
||||
@ -488,7 +488,7 @@ EOT;
|
||||
$expected->array[1]->key = 'two';
|
||||
$tests['nest-map-and-sequence'] = array($yaml, $expected);
|
||||
|
||||
$yaml = <<<YAML
|
||||
$yaml = <<<'YAML'
|
||||
map:
|
||||
1: one
|
||||
2: two
|
||||
@ -499,7 +499,7 @@ YAML;
|
||||
$expected->map->{2} = 'two';
|
||||
$tests['numeric-keys'] = array($yaml, $expected);
|
||||
|
||||
$yaml = <<<YAML
|
||||
$yaml = <<<'YAML'
|
||||
map:
|
||||
0: one
|
||||
1: two
|
||||
@ -524,11 +524,11 @@ YAML;
|
||||
|
||||
public function invalidDumpedObjectProvider()
|
||||
{
|
||||
$yamlTag = <<<EOF
|
||||
$yamlTag = <<<'EOF'
|
||||
foo: !!php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF;
|
||||
$localTag = <<<EOF
|
||||
$localTag = <<<'EOF'
|
||||
foo: !php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF;
|
||||
@ -630,7 +630,7 @@ EOF
|
||||
|
||||
public function testSequenceInMappingStartedBySingleDashLine()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
a:
|
||||
-
|
||||
b:
|
||||
@ -658,7 +658,7 @@ EOT;
|
||||
|
||||
public function testSequenceFollowedByCommentEmbeddedInMapping()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
a:
|
||||
b:
|
||||
- c
|
||||
@ -694,7 +694,7 @@ EOF
|
||||
*/
|
||||
public function testScalarInSequence()
|
||||
{
|
||||
Yaml::parse(<<<EOF
|
||||
Yaml::parse(<<<'EOF'
|
||||
foo:
|
||||
- bar
|
||||
"missing colon"
|
||||
@ -715,7 +715,7 @@ EOF
|
||||
*/
|
||||
public function testMappingDuplicateKeyBlock()
|
||||
{
|
||||
$input = <<<EOD
|
||||
$input = <<<'EOD'
|
||||
parent:
|
||||
child: first
|
||||
child: duplicate
|
||||
@ -733,7 +733,7 @@ EOD;
|
||||
|
||||
public function testMappingDuplicateKeyFlow()
|
||||
{
|
||||
$input = <<<EOD
|
||||
$input = <<<'EOD'
|
||||
parent: { child: first, child: duplicate }
|
||||
parent: { child: duplicate, child: duplicate }
|
||||
EOD;
|
||||
@ -931,7 +931,7 @@ EOF;
|
||||
*/
|
||||
public function testColonInMappingValueException()
|
||||
{
|
||||
$yaml = <<<EOF
|
||||
$yaml = <<<'EOF'
|
||||
foo: bar: baz
|
||||
EOF;
|
||||
|
||||
@ -940,7 +940,7 @@ EOF;
|
||||
|
||||
public function testColonInMappingValueExceptionNotTriggeredByColonInComment()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
foo:
|
||||
bar: foobar # Note: a comment after a colon
|
||||
EOT;
|
||||
@ -1041,7 +1041,7 @@ EOT
|
||||
);
|
||||
$tests[] = array($yaml, $expected);
|
||||
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
foo:
|
||||
bar:
|
||||
scalar-block: >
|
||||
@ -1084,7 +1084,7 @@ EOT;
|
||||
|
||||
public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
test: >
|
||||
<h2>A heading</h2>
|
||||
|
||||
@ -1096,7 +1096,7 @@ EOT;
|
||||
|
||||
$this->assertSame(
|
||||
array(
|
||||
'test' => <<<EOT
|
||||
'test' => <<<'EOT'
|
||||
<h2>A heading</h2>
|
||||
<ul> <li>a list</li> <li>may be a good example</li> </ul>
|
||||
EOT
|
||||
@ -1108,7 +1108,7 @@ EOT
|
||||
|
||||
public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
test: >
|
||||
<h2>A heading</h2>
|
||||
|
||||
@ -1120,7 +1120,7 @@ EOT;
|
||||
|
||||
$this->assertSame(
|
||||
array(
|
||||
'test' => <<<EOT
|
||||
'test' => <<<'EOT'
|
||||
<h2>A heading</h2>
|
||||
<ul>
|
||||
<li>a list</li>
|
||||
@ -1153,7 +1153,7 @@ EOT
|
||||
return array(
|
||||
array(
|
||||
4,
|
||||
<<<YAML
|
||||
<<<'YAML'
|
||||
foo:
|
||||
-
|
||||
# bar
|
||||
@ -1162,7 +1162,7 @@ YAML
|
||||
),
|
||||
array(
|
||||
5,
|
||||
<<<YAML
|
||||
<<<'YAML'
|
||||
foo:
|
||||
-
|
||||
# bar
|
||||
@ -1172,7 +1172,7 @@ YAML
|
||||
),
|
||||
array(
|
||||
8,
|
||||
<<<YAML
|
||||
<<<'YAML'
|
||||
foo:
|
||||
-
|
||||
# foobar
|
||||
@ -1185,7 +1185,7 @@ YAML
|
||||
),
|
||||
array(
|
||||
10,
|
||||
<<<YAML
|
||||
<<<'YAML'
|
||||
foo:
|
||||
-
|
||||
# foobar
|
||||
|
Reference in New Issue
Block a user