Merge branch '2.8' into 3.2

* 2.8:
  [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
This commit is contained in:
Nicolas Grekas 2017-03-04 13:23:14 +01:00
commit 4ee9d563c5
7 changed files with 9 additions and 6 deletions

View File

@ -1391,10 +1391,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

@ -1437,6 +1437,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();
$this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
}

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();
}