Merge branch '3.2'

* 3.2:
  [Security] fix Composer constraint
  Provide less state in getRequestFormat
  fix test class location
  Static code analysis with Php Inspections (EA Extended): dead code dropped, couple bugs fixed
  Adding use statement for InvalidArgumentException
This commit is contained in:
Nicolas Grekas 2017-03-04 13:23:47 +01:00
commit a358675972
9 changed files with 13 additions and 6 deletions

View File

@ -1410,10 +1410,10 @@ class Request
public function getRequestFormat($default = 'html')
{
if (null === $this->format) {
$this->format = $this->attributes->get('_format', $default);
$this->format = $this->attributes->get('_format');
}
return $this->format;
return null === $this->format ? $default : $this->format;
}
/**

View File

@ -1438,6 +1438,11 @@ class RequestTest extends TestCase
$request = new Request();
$this->assertEquals('html', $request->getRequestFormat());
// Ensure that setting different default values over time is possible,
// aka. setRequestFormat determines the state.
$this->assertEquals('json', $request->getRequestFormat('json'));
$this->assertEquals('html', $request->getRequestFormat('html'));
$request = new Request();
$this->assertNull($request->getRequestFormat(null));

View File

@ -96,6 +96,6 @@ class TimeZoneTransformer extends Transformer
return 'Etc/GMT'.($hours !== 0 ? $signal.$hours : '');
}
throw new \InvalidArgumentException('The GMT time zone \'%s\' does not match with the supported formats GMT[+-]HH:MM or GMT[+-]HHMM.');
throw new \InvalidArgumentException(sprintf("The GMT time zone '%s' does not match with the supported formats GMT[+-]HH:MM or GMT[+-]HHMM.", $formattedTimeZone));
}
}

View File

@ -169,7 +169,6 @@ class Process implements \IteratorAggregate
$this->setTimeout($timeout);
$this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
$this->pty = false;
$this->enhanceWindowsCompatibility = true;
$this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
if (null !== $options) {
@trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since version 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);

View File

@ -205,7 +205,7 @@ class DigestData
} elseif ('auth' === $this->elements['qop']) {
$digest .= ':'.$this->elements['nc'].':'.$this->elements['cnonce'].':'.$this->elements['qop'];
} else {
throw new \InvalidArgumentException('This method does not support a qop: "%s".', $this->elements['qop']);
throw new \InvalidArgumentException(sprintf('This method does not support a qop: "%s".', $this->elements['qop']));
}
$digest .= ':'.$a2Md5;

View File

@ -85,7 +85,6 @@ abstract class AbstractOperation implements OperationInterface
$this->source = $source;
$this->target = $target;
$this->result = new MessageCatalogue($source->getLocale());
$this->domains = null;
$this->messages = array();
}

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Translation;
use Symfony\Component\Translation\Exception\InvalidArgumentException;
/**
* TranslatorBagInterface.
*

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Translation;
use Symfony\Component\Translation\Exception\InvalidArgumentException;
/**
* TranslatorInterface.
*