Fixed deprecation warnings about passing null as parameter
This commit is contained in:
parent
d3ebc5fd53
commit
7d9bdf5734
@ -151,9 +151,9 @@ if ('disabled' === $getEnvVar('SYMFONY_DEPRECATIONS_HELPER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
|
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
|
||||||
|| ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`))
|
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)))
|
||||||
|| ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`))
|
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)))
|
||||||
|| file_exists($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`).\DIRECTORY_SEPARATOR.'composer.phar')
|
|| file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar')
|
||||||
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
|
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
|
||||||
: 'composer';
|
: 'composer';
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class Cookie
|
|||||||
* Sets a cookie.
|
* Sets a cookie.
|
||||||
*
|
*
|
||||||
* @param string $name The cookie name
|
* @param string $name The cookie name
|
||||||
* @param string $value The value of the cookie
|
* @param string|null $value The value of the cookie
|
||||||
* @param string|null $expires The time the cookie expires
|
* @param string|null $expires The time the cookie expires
|
||||||
* @param string|null $path The path on the server in which the cookie will be available on
|
* @param string|null $path The path on the server in which the cookie will be available on
|
||||||
* @param string $domain The domain that the cookie is available
|
* @param string $domain The domain that the cookie is available
|
||||||
@ -62,7 +62,7 @@ class Cookie
|
|||||||
$this->rawValue = $value;
|
$this->rawValue = $value;
|
||||||
} else {
|
} else {
|
||||||
$this->value = $value;
|
$this->value = $value;
|
||||||
$this->rawValue = rawurlencode($value);
|
$this->rawValue = rawurlencode($value ?? '');
|
||||||
}
|
}
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->path = empty($path) ? '/' : $path;
|
$this->path = empty($path) ? '/' : $path;
|
||||||
|
@ -157,7 +157,7 @@ class NodeExtension extends AbstractExtension
|
|||||||
{
|
{
|
||||||
$element = $node->getElement();
|
$element = $node->getElement();
|
||||||
|
|
||||||
if ($this->hasFlag(self::ELEMENT_NAME_IN_LOWER_CASE)) {
|
if ($element && $this->hasFlag(self::ELEMENT_NAME_IN_LOWER_CASE)) {
|
||||||
$element = strtolower($element);
|
$element = strtolower($element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass
|
|||||||
if ($value instanceof Definition) {
|
if ($value instanceof Definition) {
|
||||||
$class = $value->getClass();
|
$class = $value->getClass();
|
||||||
|
|
||||||
if (isset(self::BUILTIN_TYPES[strtolower($class)])) {
|
if ($class && isset(self::BUILTIN_TYPES[strtolower($class)])) {
|
||||||
$class = strtolower($class);
|
$class = strtolower($class);
|
||||||
} elseif (!$class || (!$this->autoload && !class_exists($class, false) && !interface_exists($class, false))) {
|
} elseif (!$class || (!$this->autoload && !class_exists($class, false) && !interface_exists($class, false))) {
|
||||||
return;
|
return;
|
||||||
|
@ -88,10 +88,12 @@ class RegisterServiceSubscribersPass extends AbstractRecursivePass
|
|||||||
$serviceMap[$key] = new Reference($type);
|
$serviceMap[$key] = new Reference($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== $i = strpos($name, '::get')) {
|
if ($name) {
|
||||||
$name = lcfirst(substr($name, 5 + $i));
|
if (false !== $i = strpos($name, '::get')) {
|
||||||
} elseif (false !== strpos($name, '::')) {
|
$name = lcfirst(substr($name, 5 + $i));
|
||||||
$name = null;
|
} elseif (false !== strpos($name, '::')) {
|
||||||
|
$name = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $name && !$this->container->has($name) && !$this->container->has($type.' $'.$name)) {
|
if (null !== $name && !$this->container->has($name) && !$this->container->has($type.' $'.$name)) {
|
||||||
|
@ -178,7 +178,7 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
|||||||
|
|
||||||
$typeHint = ProxyHelper::getTypeHint($reflectionMethod, $parameter);
|
$typeHint = ProxyHelper::getTypeHint($reflectionMethod, $parameter);
|
||||||
|
|
||||||
if (\array_key_exists($k = ltrim($typeHint, '\\').' $'.$parameter->name, $bindings)) {
|
if ($typeHint && \array_key_exists($k = ltrim($typeHint, '\\').' $'.$parameter->name, $bindings)) {
|
||||||
$arguments[$key] = $this->getBindingValue($bindings[$k]);
|
$arguments[$key] = $this->getBindingValue($bindings[$k]);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -47,7 +47,7 @@ abstract class AbstractUriElement
|
|||||||
$this->currentUri = $currentUri;
|
$this->currentUri = $currentUri;
|
||||||
|
|
||||||
$elementUriIsRelative = null === parse_url(trim($this->getRawUri()), \PHP_URL_SCHEME);
|
$elementUriIsRelative = null === parse_url(trim($this->getRawUri()), \PHP_URL_SCHEME);
|
||||||
$baseUriIsAbsolute = \in_array(strtolower(substr($this->currentUri, 0, 4)), ['http', 'file']);
|
$baseUriIsAbsolute = null !== $this->currentUri && \in_array(strtolower(substr($this->currentUri, 0, 4)), ['http', 'file']);
|
||||||
if ($elementUriIsRelative && !$baseUriIsAbsolute) {
|
if ($elementUriIsRelative && !$baseUriIsAbsolute) {
|
||||||
throw new \InvalidArgumentException(sprintf('The URL of the element is relative, so you must define its base URI passing an absolute URL to the constructor of the "%s" class ("%s" was passed).', __CLASS__, $this->currentUri));
|
throw new \InvalidArgumentException(sprintf('The URL of the element is relative, so you must define its base URI passing an absolute URL to the constructor of the "%s" class ("%s" was passed).', __CLASS__, $this->currentUri));
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,8 @@ class NumberComparator extends Comparator
|
|||||||
*/
|
*/
|
||||||
public function __construct(?string $test)
|
public function __construct(?string $test)
|
||||||
{
|
{
|
||||||
if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
|
if (null === $test || !preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
|
||||||
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
|
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test ?? 'null'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = $matches[2];
|
$target = $matches[2];
|
||||||
|
@ -124,7 +124,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
|||||||
$args = [];
|
$args = [];
|
||||||
foreach ($parameters as $p) {
|
foreach ($parameters as $p) {
|
||||||
/** @var \ReflectionParameter $p */
|
/** @var \ReflectionParameter $p */
|
||||||
$type = ltrim($target = ProxyHelper::getTypeHint($r, $p), '\\');
|
$type = ltrim($target = (string) ProxyHelper::getTypeHint($r, $p), '\\');
|
||||||
$invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
|
$invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
|
||||||
|
|
||||||
if (isset($arguments[$r->name][$p->name])) {
|
if (isset($arguments[$r->name][$p->name])) {
|
||||||
|
@ -164,7 +164,7 @@ class RouterListener implements EventSubscriberInterface
|
|||||||
private function createWelcomeResponse(): Response
|
private function createWelcomeResponse(): Response
|
||||||
{
|
{
|
||||||
$version = Kernel::VERSION;
|
$version = Kernel::VERSION;
|
||||||
$projectDir = realpath($this->projectDir).\DIRECTORY_SEPARATOR;
|
$projectDir = realpath((string) $this->projectDir).\DIRECTORY_SEPARATOR;
|
||||||
$docVersion = substr(Kernel::VERSION, 0, 3);
|
$docVersion = substr(Kernel::VERSION, 0, 3);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -212,8 +212,8 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
|
|
||||||
public function testValidatesPrivateResponsesCachedOnTheClient()
|
public function testValidatesPrivateResponsesCachedOnTheClient()
|
||||||
{
|
{
|
||||||
$this->setNextResponse(200, [], '', function ($request, $response) {
|
$this->setNextResponse(200, [], '', function (Request $request, $response) {
|
||||||
$etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH'));
|
$etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH', ''));
|
||||||
if ($request->cookies->has('authenticated')) {
|
if ($request->cookies->has('authenticated')) {
|
||||||
$response->headers->set('Cache-Control', 'private, no-store');
|
$response->headers->set('Cache-Control', 'private, no-store');
|
||||||
$response->setETag('"private tag"');
|
$response->setETag('"private tag"');
|
||||||
|
@ -30,7 +30,7 @@ class AdapterTest extends LdapTestCase
|
|||||||
{
|
{
|
||||||
$ldap = new Adapter();
|
$ldap = new Adapter();
|
||||||
|
|
||||||
$this->assertEquals('\20foo\3dbar\0d(baz)*\20', $ldap->escape(" foo=bar\r(baz)* ", null, LdapInterface::ESCAPE_DN));
|
$this->assertEquals('\20foo\3dbar\0d(baz)*\20', $ldap->escape(" foo=bar\r(baz)* ", '', LdapInterface::ESCAPE_DN));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -266,7 +266,7 @@ class Email extends Message
|
|||||||
*/
|
*/
|
||||||
public function getPriority(): int
|
public function getPriority(): int
|
||||||
{
|
{
|
||||||
[$priority] = sscanf($this->getHeaders()->getHeaderBody('X-Priority'), '%[1-5]');
|
[$priority] = sscanf($this->getHeaders()->getHeaderBody('X-Priority') ?? '', '%[1-5]');
|
||||||
|
|
||||||
return $priority ?? 3;
|
return $priority ?? 3;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
|||||||
|
|
||||||
if (!$optional || $important || !\array_key_exists($varName, $defaults) || (null !== $mergedParams[$varName] && (string) $mergedParams[$varName] !== (string) $defaults[$varName])) {
|
if (!$optional || $important || !\array_key_exists($varName, $defaults) || (null !== $mergedParams[$varName] && (string) $mergedParams[$varName] !== (string) $defaults[$varName])) {
|
||||||
// check requirement (while ignoring look-around patterns)
|
// check requirement (while ignoring look-around patterns)
|
||||||
if (null !== $this->strictRequirements && !preg_match('#^'.preg_replace('/\(\?(?:=|<=|!|<!)((?:[^()\\\\]+|\\\\.|\((?1)\))*)\)/', '', $token[2]).'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) {
|
if (null !== $this->strictRequirements && !preg_match('#^'.preg_replace('/\(\?(?:=|<=|!|<!)((?:[^()\\\\]+|\\\\.|\((?1)\))*)\)/', '', $token[2]).'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]] ?? '')) {
|
||||||
if ($this->strictRequirements) {
|
if ($this->strictRequirements) {
|
||||||
throw new InvalidParameterException(strtr($message, ['{parameter}' => $varName, '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$varName]]));
|
throw new InvalidParameterException(strtr($message, ['{parameter}' => $varName, '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$varName]]));
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@ class LdapBindAuthenticationProviderTest extends TestCase
|
|||||||
->method('bind')
|
->method('bind')
|
||||||
->willThrowException(new ConnectionException())
|
->willThrowException(new ConnectionException())
|
||||||
;
|
;
|
||||||
|
$ldap->method('escape')->willReturnArgument(0);
|
||||||
$userChecker = $this->createMock(UserCheckerInterface::class);
|
$userChecker = $this->createMock(UserCheckerInterface::class);
|
||||||
|
|
||||||
$provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap);
|
$provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap);
|
||||||
@ -207,6 +208,7 @@ class LdapBindAuthenticationProviderTest extends TestCase
|
|||||||
->method('query')
|
->method('query')
|
||||||
->willReturn($query)
|
->willReturn($query)
|
||||||
;
|
;
|
||||||
|
$ldap->method('escape')->willReturnArgument(0);
|
||||||
$userChecker = $this->createMock(UserCheckerInterface::class);
|
$userChecker = $this->createMock(UserCheckerInterface::class);
|
||||||
|
|
||||||
$provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap, '{username}', true, 'elsa', 'test1234A$');
|
$provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap, '{username}', true, 'elsa', 'test1234A$');
|
||||||
|
@ -82,8 +82,8 @@ class UsernamePasswordJsonAuthenticationListener extends AbstractListener implem
|
|||||||
|
|
||||||
public function supports(Request $request): ?bool
|
public function supports(Request $request): ?bool
|
||||||
{
|
{
|
||||||
if (false === strpos($request->getRequestFormat(), 'json')
|
if (false === strpos($request->getRequestFormat() ?? '', 'json')
|
||||||
&& false === strpos($request->getContentType(), 'json')
|
&& false === strpos($request->getContentType() ?? '', 'json')
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ class XliffFileLoader implements LoaderInterface
|
|||||||
private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
|
private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
|
||||||
{
|
{
|
||||||
$xml = simplexml_import_dom($dom);
|
$xml = simplexml_import_dom($dom);
|
||||||
$encoding = strtoupper($dom->encoding);
|
$encoding = $dom->encoding ? strtoupper($dom->encoding) : null;
|
||||||
|
|
||||||
$xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:2.0');
|
$xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:2.0');
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function assertValidLocale($locale)
|
protected function assertValidLocale($locale)
|
||||||
{
|
{
|
||||||
if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
|
if (null !== $locale && 1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale));
|
throw new InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class IpValidator extends ConstraintValidator
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$flag = null;
|
$flag = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ class Parser
|
|||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
if ($this->getCurrentLineIndentation() >= $newIndent) {
|
if ($this->getCurrentLineIndentation() >= $newIndent) {
|
||||||
$data[] = substr($this->currentLine, $newIndent);
|
$data[] = substr($this->currentLine, $newIndent ?? 0);
|
||||||
} elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
|
} elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
|
||||||
$data[] = $this->currentLine;
|
$data[] = $this->currentLine;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user