Merge branch '2.7' into 2.8

* 2.7:
  do not depend on a fixed date in layout tests
  [Console] Escape default value when dumping help
  [Console] OS X Can't call cli_set_process_title php without superuser
  Polish translation improvement in Validator component
  [Console] Descriptors should use Helper::strlen
  [Config] Improve PHPdoc / IDE autocomplete
  [Debug] Wrap call to ->log in a try catch block
  [Debug] UndefinedMethodFatalErrorHandler - Handle anonymous classes
  [SecurityBundle] Made collection of user provider unique when injecting them to the RemberMeService
This commit is contained in:
Nicolas Grekas 2017-01-02 15:44:49 +01:00
commit 23590eb51a
39 changed files with 629 additions and 39 deletions

View File

@ -22,7 +22,7 @@
"require-dev": { "require-dev": {
"symfony/asset": "~2.7|~3.0.0", "symfony/asset": "~2.7|~3.0.0",
"symfony/finder": "~2.3|~3.0.0", "symfony/finder": "~2.3|~3.0.0",
"symfony/form": "~2.8.4", "symfony/form": "~2.8.16",
"symfony/http-kernel": "~2.8|~3.0.0", "symfony/http-kernel": "~2.8|~3.0.0",
"symfony/polyfill-intl-icu": "~1.0", "symfony/polyfill-intl-icu": "~1.0",
"symfony/routing": "~2.2|~3.0.0", "symfony/routing": "~2.2|~3.0.0",

View File

@ -43,7 +43,7 @@
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0", "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
"symfony/polyfill-intl-icu": "~1.0", "symfony/polyfill-intl-icu": "~1.0",
"symfony/security": "~2.6|~3.0.0", "symfony/security": "~2.6|~3.0.0",
"symfony/form": "^2.8.4", "symfony/form": "^2.8.16",
"symfony/expression-language": "~2.6|~3.0.0", "symfony/expression-language": "~2.6|~3.0.0",
"symfony/process": "~2.0,>=2.0.5|~3.0.0", "symfony/process": "~2.0,>=2.0.5|~3.0.0",
"symfony/validator": "~2.5|~3.0.0", "symfony/validator": "~2.5|~3.0.0",

View File

@ -97,7 +97,8 @@ class RememberMeFactory implements SecurityFactoryInterface
if (count($userProviders) === 0) { if (count($userProviders) === 0) {
throw new \RuntimeException('You must configure at least one remember-me aware listener (such as form-login) for each firewall that has remember-me enabled.'); throw new \RuntimeException('You must configure at least one remember-me aware listener (such as form-login) for each firewall that has remember-me enabled.');
} }
$rememberMeServices->replaceArgument(0, $userProviders);
$rememberMeServices->replaceArgument(0, array_unique($userProviders));
// remember-me listener // remember-me listener
$listenerId = 'security.authentication.listener.rememberme.'.$id; $listenerId = 'security.authentication.listener.rememberme.'.$id;

View File

@ -198,7 +198,7 @@ class ExprBuilder
/** /**
* Returns the related node. * Returns the related node.
* *
* @return NodeDefinition * @return NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition
* *
* @throws \RuntimeException * @throws \RuntimeException
*/ */

View File

@ -63,7 +63,7 @@ class MergeBuilder
/** /**
* Returns the related node. * Returns the related node.
* *
* @return NodeDefinition * @return NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition
*/ */
public function end() public function end()
{ {

View File

@ -107,7 +107,7 @@ abstract class NodeDefinition implements NodeParentInterface
/** /**
* Returns the parent node. * Returns the parent node.
* *
* @return NodeParentInterface|NodeBuilder|NodeDefinition|null The builder of the parent node * @return NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null The builder of the parent node
*/ */
public function end() public function end()
{ {

View File

@ -36,7 +36,7 @@ class ValidationBuilder
* *
* @param \Closure $closure * @param \Closure $closure
* *
* @return ExprBuilder|ValidationBuilder * @return ExprBuilder|$this
*/ */
public function rule(\Closure $closure = null) public function rule(\Closure $closure = null)
{ {

View File

@ -230,7 +230,14 @@ class Command
if (null !== $this->processTitle) { if (null !== $this->processTitle) {
if (function_exists('cli_set_process_title')) { if (function_exists('cli_set_process_title')) {
cli_set_process_title($this->processTitle); if (false === @cli_set_process_title($this->processTitle)) {
if ('Darwin' === PHP_OS) {
$output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
} else {
$error = error_get_last();
trigger_error($error['message'], E_USER_WARNING);
}
}
} elseif (function_exists('setproctitle')) { } elseif (function_exists('setproctitle')) {
setproctitle($this->processTitle); setproctitle($this->processTitle);
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) { } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
@ -94,7 +95,7 @@ class MarkdownDescriptor extends Descriptor
$this->write( $this->write(
$command->getName()."\n" $command->getName()."\n"
.str_repeat('-', strlen($command->getName()))."\n\n" .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
.'* Description: '.($command->getDescription() ?: '<none>')."\n" .'* Description: '.($command->getDescription() ?: '<none>')."\n"
.'* Usage:'."\n\n" .'* Usage:'."\n\n"
.array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) { .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
@ -121,7 +122,7 @@ class MarkdownDescriptor extends Descriptor
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace); $description = new ApplicationDescription($application, $describedNamespace);
$this->write($application->getName()."\n".str_repeat('=', strlen($application->getName()))); $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
foreach ($description->getNamespaces() as $namespace) { foreach ($description->getNamespaces() as $namespace) {
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {

View File

@ -13,6 +13,8 @@ namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
@ -37,7 +39,7 @@ class TextDescriptor extends Descriptor
$default = ''; $default = '';
} }
$totalWidth = isset($options['total_width']) ? $options['total_width'] : strlen($argument->getName()); $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
$spacingWidth = $totalWidth - strlen($argument->getName()); $spacingWidth = $totalWidth - strlen($argument->getName());
$this->writeText(sprintf(' <info>%s</info> %s%s%s', $this->writeText(sprintf(' <info>%s</info> %s%s%s',
@ -75,7 +77,7 @@ class TextDescriptor extends Descriptor
sprintf('--%s%s', $option->getName(), $value) sprintf('--%s%s', $option->getName(), $value)
); );
$spacingWidth = $totalWidth - strlen($synopsis); $spacingWidth = $totalWidth - Helper::strlen($synopsis);
$this->writeText(sprintf(' <info>%s</info> %s%s%s%s', $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
$synopsis, $synopsis,
@ -94,7 +96,7 @@ class TextDescriptor extends Descriptor
{ {
$totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions()); $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
foreach ($definition->getArguments() as $argument) { foreach ($definition->getArguments() as $argument) {
$totalWidth = max($totalWidth, strlen($argument->getName())); $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
} }
if ($definition->getArguments()) { if ($definition->getArguments()) {
@ -206,7 +208,7 @@ class TextDescriptor extends Descriptor
foreach ($namespace['commands'] as $name) { foreach ($namespace['commands'] as $name) {
$this->writeText("\n"); $this->writeText("\n");
$spacingWidth = $width - strlen($name); $spacingWidth = $width - Helper::strlen($name);
$this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options); $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
} }
} }
@ -235,6 +237,16 @@ class TextDescriptor extends Descriptor
*/ */
private function formatDefaultValue($default) private function formatDefaultValue($default)
{ {
if (is_string($default)) {
$default = OutputFormatter::escape($default);
} elseif (is_array($default)) {
foreach ($default as $key => $value) {
if (is_string($value)) {
$default[$key] = OutputFormatter::escape($value);
}
}
}
if (PHP_VERSION_ID < 50400) { if (PHP_VERSION_ID < 50400) {
return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default)); return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
} }
@ -252,9 +264,9 @@ class TextDescriptor extends Descriptor
$widths = array(); $widths = array();
foreach ($commands as $command) { foreach ($commands as $command) {
$widths[] = strlen($command->getName()); $widths[] = Helper::strlen($command->getName());
foreach ($command->getAliases() as $alias) { foreach ($command->getAliases() as $alias) {
$widths[] = strlen($alias); $widths[] = Helper::strlen($alias);
} }
} }
@ -271,10 +283,10 @@ class TextDescriptor extends Descriptor
$totalWidth = 0; $totalWidth = 0;
foreach ($options as $option) { foreach ($options as $option) {
// "-" + shortcut + ", --" + name // "-" + shortcut + ", --" + name
$nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + strlen($option->getName()); $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
if ($option->acceptValue()) { if ($option->acceptValue()) {
$valueLength = 1 + strlen($option->getName()); // = + value $valueLength = 1 + Helper::strlen($option->getName()); // = + value
$valueLength += $option->isValueOptional() ? 2 : 0; // [ + ] $valueLength += $option->isValueOptional() ? 2 : 0; // [ + ]
$nameLength += $valueLength; $nameLength += $valueLength;

View File

@ -328,6 +328,9 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$command->setProcessTitle('foo'); $command->setProcessTitle('foo');
$this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); $this->assertSame(0, $command->run(new StringInput(''), new NullOutput()));
if (function_exists('cli_set_process_title')) { if (function_exists('cli_set_process_title')) {
if (null === @cli_get_process_title() && 'Darwin' === PHP_OS) {
$this->markTestSkipped('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.');
}
$this->assertEquals('foo', cli_get_process_title()); $this->assertEquals('foo', cli_get_process_title());
} }
} }

View File

@ -86,7 +86,7 @@ abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
abstract protected function getFormat(); abstract protected function getFormat();
private function getDescriptionTestData(array $objects) protected function getDescriptionTestData(array $objects)
{ {
$data = array(); $data = array();
foreach ($objects as $name => $object) { foreach ($objects as $name => $object) {

View File

@ -12,9 +12,27 @@
namespace Symfony\Component\Console\Tests\Descriptor; namespace Symfony\Component\Console\Tests\Descriptor;
use Symfony\Component\Console\Descriptor\MarkdownDescriptor; use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplicationMbString;
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommandMbString;
class MarkdownDescriptorTest extends AbstractDescriptorTest class MarkdownDescriptorTest extends AbstractDescriptorTest
{ {
public function getDescribeCommandTestData()
{
return $this->getDescriptionTestData(array_merge(
ObjectsProvider::getCommands(),
array('command_mbstring' => new DescriptorCommandMbString())
));
}
public function getDescribeApplicationTestData()
{
return $this->getDescriptionTestData(array_merge(
ObjectsProvider::getApplications(),
array('application_mbstring' => new DescriptorApplicationMbString())
));
}
protected function getDescriptor() protected function getDescriptor()
{ {
return new MarkdownDescriptor(); return new MarkdownDescriptor();

View File

@ -31,6 +31,7 @@ class ObjectsProvider
'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'), 'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'),
'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'), 'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'),
'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"), 'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"),
'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', '<comment>style</>'),
); );
} }
@ -43,6 +44,8 @@ class ObjectsProvider
'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()), 'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()),
'input_option_5' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, "multiline\noption description"), 'input_option_5' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, "multiline\noption description"),
'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'), 'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'),
'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', '<comment>style</>'),
'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', array('<comment>Hello</comment>', '<info>world</info>')),
); );
} }

View File

@ -12,9 +12,27 @@
namespace Symfony\Component\Console\Tests\Descriptor; namespace Symfony\Component\Console\Tests\Descriptor;
use Symfony\Component\Console\Descriptor\TextDescriptor; use Symfony\Component\Console\Descriptor\TextDescriptor;
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplicationMbString;
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommandMbString;
class TextDescriptorTest extends AbstractDescriptorTest class TextDescriptorTest extends AbstractDescriptorTest
{ {
public function getDescribeCommandTestData()
{
return $this->getDescriptionTestData(array_merge(
ObjectsProvider::getCommands(),
array('command_mbstring' => new DescriptorCommandMbString())
));
}
public function getDescribeApplicationTestData()
{
return $this->getDescriptionTestData(array_merge(
ObjectsProvider::getApplications(),
array('application_mbstring' => new DescriptorApplicationMbString())
));
}
protected function getDescriptor() protected function getDescriptor()
{ {
return new TextDescriptor(); return new TextDescriptor();

View File

@ -0,0 +1,24 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Fixtures;
use Symfony\Component\Console\Application;
class DescriptorApplicationMbString extends Application
{
public function __construct()
{
parent::__construct('MbString åpplicätion');
$this->add(new DescriptorCommandMbString());
}
}

View File

@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Fixtures;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class DescriptorCommandMbString extends Command
{
protected function configure()
{
$this
->setName('descriptor:åèä')
->setDescription('command åèä description')
->setHelp('command åèä help')
->addUsage('-o|--option_name <argument_name>')
->addUsage('<argument_name>')
->addArgument('argument_åèä', InputArgument::REQUIRED)
->addOption('option_åèä', 'o', InputOption::VALUE_NONE)
;
}
}

View File

@ -0,0 +1,309 @@
MbString åpplicätion
====================
* help
* list
**descriptor:**
* descriptor:åèä
help
----
* Description: Displays help for a command
* Usage:
* `help [--xml] [--format FORMAT] [--raw] [--] [<command_name>]`
The <info>help</info> command displays help for a given command:
<info>php app/console help list</info>
You can also output the help in other formats by using the <comment>--format</comment> option:
<info>php app/console help --format=xml list</info>
To display the list of available commands, please use the <info>list</info> command.
### Arguments:
**command_name:**
* Name: command_name
* Is required: no
* Is array: no
* Description: The command name
* Default: `'help'`
### Options:
**xml:**
* Name: `--xml`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output help as XML
* Default: `false`
**format:**
* Name: `--format`
* Shortcut: <none>
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Description: The output format (txt, xml, json, or md)
* Default: `'txt'`
**raw:**
* Name: `--raw`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output raw command help
* Default: `false`
**help:**
* Name: `--help`
* Shortcut: `-h`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this help message
* Default: `false`
**quiet:**
* Name: `--quiet`
* Shortcut: `-q`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not output any message
* Default: `false`
**verbose:**
* Name: `--verbose`
* Shortcut: `-v|-vv|-vvv`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
* Default: `false`
**version:**
* Name: `--version`
* Shortcut: `-V`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this application version
* Default: `false`
**ansi:**
* Name: `--ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Force ANSI output
* Default: `false`
**no-ansi:**
* Name: `--no-ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Disable ANSI output
* Default: `false`
**no-interaction:**
* Name: `--no-interaction`
* Shortcut: `-n`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not ask any interactive question
* Default: `false`
list
----
* Description: Lists commands
* Usage:
* `list [--xml] [--raw] [--format FORMAT] [--] [<namespace>]`
The <info>list</info> command lists all commands:
<info>php app/console list</info>
You can also display the commands for a specific namespace:
<info>php app/console list test</info>
You can also output the information in other formats by using the <comment>--format</comment> option:
<info>php app/console list --format=xml</info>
It's also possible to get raw list of commands (useful for embedding command runner):
<info>php app/console list --raw</info>
### Arguments:
**namespace:**
* Name: namespace
* Is required: no
* Is array: no
* Description: The namespace name
* Default: `NULL`
### Options:
**xml:**
* Name: `--xml`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output list as XML
* Default: `false`
**raw:**
* Name: `--raw`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: To output raw command list
* Default: `false`
**format:**
* Name: `--format`
* Shortcut: <none>
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Description: The output format (txt, xml, json, or md)
* Default: `'txt'`
descriptor:åèä
--------------
* Description: command åèä description
* Usage:
* `descriptor:åèä [-o|--option_åèä] [--] <argument_åèä>`
* `descriptor:åèä -o|--option_name <argument_name>`
* `descriptor:åèä <argument_name>`
command åèä help
### Arguments:
**argument_åèä:**
* Name: argument_åèä
* Is required: yes
* Is array: no
* Description: <none>
* Default: `NULL`
### Options:
**option_åèä:**
* Name: `--option_åèä`
* Shortcut: `-o`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: <none>
* Default: `false`
**help:**
* Name: `--help`
* Shortcut: `-h`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this help message
* Default: `false`
**quiet:**
* Name: `--quiet`
* Shortcut: `-q`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not output any message
* Default: `false`
**verbose:**
* Name: `--verbose`
* Shortcut: `-v|-vv|-vvv`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
* Default: `false`
**version:**
* Name: `--version`
* Shortcut: `-V`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Display this application version
* Default: `false`
**ansi:**
* Name: `--ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Force ANSI output
* Default: `false`
**no-ansi:**
* Name: `--no-ansi`
* Shortcut: <none>
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Disable ANSI output
* Default: `false`
**no-interaction:**
* Name: `--no-interaction`
* Shortcut: `-n`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: Do not ask any interactive question
* Default: `false`

View File

@ -0,0 +1,19 @@
<info>MbString åpplicätion</info>
<comment>Usage:</comment>
command [options] [arguments]
<comment>Options:</comment>
<info>-h, --help</info> Display this help message
<info>-q, --quiet</info> Do not output any message
<info>-V, --version</info> Display this application version
<info> --ansi</info> Force ANSI output
<info> --no-ansi</info> Disable ANSI output
<info>-n, --no-interaction</info> Do not ask any interactive question
<info>-v|vv|vvv, --verbose</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
<comment>Available commands:</comment>
<info>help</info> Displays help for a command
<info>list</info> Lists commands
<comment>descriptor</comment>
<info>descriptor:åèä</info> command åèä description

View File

@ -0,0 +1,33 @@
descriptor:åèä
--------------
* Description: command åèä description
* Usage:
* `descriptor:åèä [-o|--option_åèä] [--] <argument_åèä>`
* `descriptor:åèä -o|--option_name <argument_name>`
* `descriptor:åèä <argument_name>`
command åèä help
### Arguments:
**argument_åèä:**
* Name: argument_åèä
* Is required: yes
* Is array: no
* Description: <none>
* Default: `NULL`
### Options:
**option_åèä:**
* Name: `--option_åèä`
* Shortcut: `-o`
* Accept value: no
* Is value required: no
* Is multiple: no
* Description: <none>
* Default: `false`

View File

@ -0,0 +1,13 @@
<comment>Usage:</comment>
descriptor:åèä [options] [--] <argument_åèä>
descriptor:åèä -o|--option_name <argument_name>
descriptor:åèä <argument_name>
<comment>Arguments:</comment>
<info>argument_åèä</info>
<comment>Options:</comment>
<info>-o, --option_åèä</info>
<comment>Help:</comment>
command åèä help

View File

@ -0,0 +1,7 @@
{
"name": "argument_name",
"is_required": false,
"is_array": false,
"description": "argument description",
"default": "<comment>style</>"
}

View File

@ -0,0 +1,7 @@
**argument_name:**
* Name: argument_name
* Is required: no
* Is array: no
* Description: argument description
* Default: `'<comment>style</>'`

View File

@ -0,0 +1 @@
<info>argument_name</info> argument description<comment> [default: "\<comment>style\</>"]</comment>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<argument name="argument_name" is_required="0" is_array="0">
<description>argument description</description>
<defaults>
<default>&lt;comment&gt;style&lt;/&gt;</default>
</defaults>
</argument>

View File

@ -0,0 +1,9 @@
{
"name": "--option_name",
"shortcut": "-o",
"accept_value": true,
"is_value_required": true,
"is_multiple": false,
"description": "option description",
"default": "<comment>style</>"
}

View File

@ -0,0 +1,9 @@
**option_name:**
* Name: `--option_name`
* Shortcut: `-o`
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Description: option description
* Default: `'<comment>style</>'`

View File

@ -0,0 +1 @@
<info>-o, --option_name=OPTION_NAME</info> option description<comment> [default: "\<comment>style\</>"]</comment>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<option name="--option_name" shortcut="-o" accept_value="1" is_value_required="1" is_multiple="0">
<description>option description</description>
<defaults>
<default>&lt;comment&gt;style&lt;/&gt;</default>
</defaults>
</option>

View File

@ -0,0 +1,12 @@
{
"name": "--option_name",
"shortcut": "-o",
"accept_value": true,
"is_value_required": true,
"is_multiple": true,
"description": "option description",
"default": [
"<comment>Hello</comment>",
"<info>world</info>"
]
}

View File

@ -0,0 +1,9 @@
**option_name:**
* Name: `--option_name`
* Shortcut: `-o`
* Accept value: yes
* Is value required: yes
* Is multiple: yes
* Description: option description
* Default: `array ( 0 => '<comment>Hello</comment>', 1 => '<info>world</info>',)`

View File

@ -0,0 +1 @@
<info>-o, --option_name=OPTION_NAME</info> option description<comment> [default: ["\<comment>Hello\</comment>","\<info>world\</info>"]]</comment><comment> (multiple values allowed)</comment>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<option name="--option_name" shortcut="-o" accept_value="1" is_value_required="1" is_multiple="1">
<description>option description</description>
<defaults>
<default>&lt;comment&gt;Hello&lt;/comment&gt;</default>
<default>&lt;info&gt;world&lt;/info&gt;</default>
</defaults>
</option>

View File

@ -574,7 +574,11 @@ class ErrorHandler
} }
} }
if ($this->loggedErrors & $type) { if ($this->loggedErrors & $type) {
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e); try {
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
} catch (\Exception $handlerException) {
} catch (\Throwable $handlerException) {
}
} }
if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) { if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
foreach ($this->getFatalErrorHandlers() as $handler) { foreach ($this->getFatalErrorHandlers() as $handler) {

View File

@ -36,8 +36,13 @@ class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
$message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className); $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
if (!class_exists($className) || null === $methods = get_class_methods($className)) {
// failed to get the class or its methods on which an unknown method was called (for example on an anonymous class)
return new UndefinedMethodException($message, $exception);
}
$candidates = array(); $candidates = array();
foreach (get_class_methods($className) as $definedMethodName) { foreach ($methods as $definedMethodName) {
$lev = levenshtein($methodName, $definedMethodName); $lev = levenshtein($methodName, $definedMethodName);
if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) { if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
$candidates[] = $definedMethodName; $candidates[] = $definedMethodName;
@ -52,6 +57,7 @@ class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
} else { } else {
$candidates = '"'.$last; $candidates = '"'.$last;
} }
$message .= "\nDid you mean to call ".$candidates; $message .= "\nDid you mean to call ".$candidates;
} }

View File

@ -61,6 +61,15 @@ class UndefinedMethodFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase
), ),
"Attempted to call an undefined method named \"offsetFet\" of class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?", "Attempted to call an undefined method named \"offsetFet\" of class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?",
), ),
array(
array(
'type' => 1,
'message' => 'Call to undefined method class@anonymous::test()',
'file' => '/home/possum/work/symfony/test.php',
'line' => 11,
),
'Attempted to call an undefined method named "test" of class "class@anonymous".',
),
); );
} }
} }

View File

@ -1408,7 +1408,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTime() public function testDateTime()
{ {
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', date('Y').'-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'with_seconds' => false, 'with_seconds' => false,
)); ));
@ -1427,7 +1427,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
/following-sibling::select /following-sibling::select
[@id="name_date_year"] [@id="name_date_year"]
[@class="form-control"] [@class="form-control"]
[./option[@value="2011"][@selected="selected"]] [./option[@value="'.date('Y').'"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_time_hour"] [@id="name_time_hour"]
[@class="form-control"] [@class="form-control"]
@ -1482,7 +1482,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTimeWithHourAndMinute() public function testDateTimeWithHourAndMinute()
{ {
$data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5'); $data = array('year' => date('Y'), 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', $data, array( $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', $data, array(
'input' => 'array', 'input' => 'array',
@ -1504,7 +1504,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
/following-sibling::select /following-sibling::select
[@id="name_date_year"] [@id="name_date_year"]
[@class="form-control"] [@class="form-control"]
[./option[@value="2011"][@selected="selected"]] [./option[@value="'.date('Y').'"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_time_hour"] [@id="name_time_hour"]
[@class="form-control"] [@class="form-control"]
@ -1521,7 +1521,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTimeWithSeconds() public function testDateTimeWithSeconds()
{ {
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', date('Y').'-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'with_seconds' => true, 'with_seconds' => true,
)); ));
@ -1541,7 +1541,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
/following-sibling::select /following-sibling::select
[@id="name_date_year"] [@id="name_date_year"]
[@class="form-control"] [@class="form-control"]
[./option[@value="2011"][@selected="selected"]] [./option[@value="'.date('Y').'"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_time_hour"] [@id="name_time_hour"]
[@class="form-control"] [@class="form-control"]
@ -1631,7 +1631,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateChoice() public function testDateChoice()
{ {
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array( $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', date('Y').'-02-03', array(
'input' => 'string', 'input' => 'string',
'widget' => 'choice', 'widget' => 'choice',
)); ));
@ -1651,7 +1651,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
/following-sibling::select /following-sibling::select
[@id="name_year"] [@id="name_year"]
[@class="form-control"] [@class="form-control"]
[./option[@value="2011"][@selected="selected"]] [./option[@value="'.date('Y').'"][@selected="selected"]]
] ]
[count(./select)=3] [count(./select)=3]
' '

View File

@ -1300,7 +1300,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTime() public function testDateTime()
{ {
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', date('Y').'-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'with_seconds' => false, 'with_seconds' => false,
)); ));
@ -1319,7 +1319,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
[./option[@value="3"][@selected="selected"]] [./option[@value="3"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_date_year"] [@id="name_date_year"]
[./option[@value="2011"][@selected="selected"]] [./option[@value="'.date('Y').'"][@selected="selected"]]
] ]
/following-sibling::div /following-sibling::div
[@id="name_time"] [@id="name_time"]
@ -1379,7 +1379,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTimeWithHourAndMinute() public function testDateTimeWithHourAndMinute()
{ {
$data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5'); $data = array('year' => date('Y'), 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', $data, array( $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', $data, array(
'input' => 'array', 'input' => 'array',
@ -1400,7 +1400,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
[./option[@value="3"][@selected="selected"]] [./option[@value="3"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_date_year"] [@id="name_date_year"]
[./option[@value="2011"][@selected="selected"]] [./option[@value="'.date('Y').'"][@selected="selected"]]
] ]
/following-sibling::div /following-sibling::div
[@id="name_time"] [@id="name_time"]
@ -1420,7 +1420,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTimeWithSeconds() public function testDateTimeWithSeconds()
{ {
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', date('Y').'-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'with_seconds' => true, 'with_seconds' => true,
)); ));
@ -1439,7 +1439,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
[./option[@value="3"][@selected="selected"]] [./option[@value="3"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_date_year"] [@id="name_date_year"]
[./option[@value="2011"][@selected="selected"]] [./option[@value="'.date('Y').'"][@selected="selected"]]
] ]
/following-sibling::div /following-sibling::div
[@id="name_time"] [@id="name_time"]
@ -1526,7 +1526,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateChoice() public function testDateChoice()
{ {
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array( $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', date('Y').'-02-03', array(
'input' => 'string', 'input' => 'string',
'widget' => 'choice', 'widget' => 'choice',
)); ));
@ -1542,7 +1542,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
[./option[@value="3"][@selected="selected"]] [./option[@value="3"][@selected="selected"]]
/following-sibling::select /following-sibling::select
[@id="name_year"] [@id="name_year"]
[./option[@value="2011"][@selected="selected"]] [./option[@value="'.date('Y').'"][@selected="selected"]]
] ]
[count(./select)=3] [count(./select)=3]
' '

View File

@ -36,11 +36,11 @@
</trans-unit> </trans-unit>
<trans-unit id="9"> <trans-unit id="9">
<source>This field was not expected.</source> <source>This field was not expected.</source>
<target>To pole nie spodziewano.</target> <target>Tego pola się nie spodziewano.</target>
</trans-unit> </trans-unit>
<trans-unit id="10"> <trans-unit id="10">
<source>This field is missing.</source> <source>This field is missing.</source>
<target>To pole jest chybianie.</target> <target>Tego pola brakuje.</target>
</trans-unit> </trans-unit>
<trans-unit id="11"> <trans-unit id="11">
<source>This value is not a valid date.</source> <source>This value is not a valid date.</source>