mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed "implicitly marking parameter as nullable" deprecations in PHP 8.4 fixed
This commit is contained in:
parent
d94c4af1be
commit
b724b05de6
31 changed files with 50 additions and 50 deletions
|
@ -43,9 +43,9 @@ class AddDocumentedAPIPropertiesJSONSchemaFactory implements SchemaFactoryInterf
|
|||
string $className,
|
||||
string $format = 'json',
|
||||
string $type = Schema::TYPE_OUTPUT,
|
||||
Operation $operation = null,
|
||||
Schema $schema = null,
|
||||
array $serializerContext = null,
|
||||
?Operation $operation = null,
|
||||
?Schema $schema = null,
|
||||
?array $serializerContext = null,
|
||||
bool $forceCollection = false
|
||||
): Schema {
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class EntityFilter extends AbstractFilter
|
|||
public function __construct(
|
||||
ManagerRegistry $managerRegistry,
|
||||
private readonly EntityFilterHelper $filter_helper,
|
||||
LoggerInterface $logger = null,
|
||||
?LoggerInterface $logger = null,
|
||||
?array $properties = null,
|
||||
?NameConverterInterface $nameConverter = null
|
||||
) {
|
||||
|
@ -50,7 +50,7 @@ class EntityFilter extends AbstractFilter
|
|||
QueryBuilder $queryBuilder,
|
||||
QueryNameGeneratorInterface $queryNameGenerator,
|
||||
string $resourceClass,
|
||||
Operation $operation = null,
|
||||
?Operation $operation = null,
|
||||
array $context = []
|
||||
): void {
|
||||
if (
|
||||
|
|
|
@ -38,7 +38,7 @@ final class LikeFilter extends AbstractFilter
|
|||
QueryBuilder $queryBuilder,
|
||||
QueryNameGeneratorInterface $queryNameGenerator,
|
||||
string $resourceClass,
|
||||
Operation $operation = null,
|
||||
?Operation $operation = null,
|
||||
array $context = []
|
||||
): void {
|
||||
// Otherwise filter is applied to order and page as well
|
||||
|
|
|
@ -38,7 +38,7 @@ class PartStoragelocationFilter extends AbstractFilter
|
|||
public function __construct(
|
||||
ManagerRegistry $managerRegistry,
|
||||
private readonly EntityFilterHelper $filter_helper,
|
||||
LoggerInterface $logger = null,
|
||||
?LoggerInterface $logger = null,
|
||||
?array $properties = null,
|
||||
?NameConverterInterface $nameConverter = null
|
||||
) {
|
||||
|
@ -51,7 +51,7 @@ class PartStoragelocationFilter extends AbstractFilter
|
|||
QueryBuilder $queryBuilder,
|
||||
QueryNameGeneratorInterface $queryNameGenerator,
|
||||
string $resourceClass,
|
||||
Operation $operation = null,
|
||||
?Operation $operation = null,
|
||||
array $context = []
|
||||
): void {
|
||||
//Do not check for mapping here, as we are using a virtual property
|
||||
|
|
|
@ -35,7 +35,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
|||
#[AsCommand('partdb:users:enable|partdb:user:enable', 'Enables/Disable the login of one or more users')]
|
||||
class UserEnableCommand extends Command
|
||||
{
|
||||
public function __construct(protected EntityManagerInterface $entityManager, string $name = null)
|
||||
public function __construct(protected EntityManagerInterface $entityManager, ?string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class TwoStepORMAdapter extends ORMAdapter
|
|||
|
||||
private \Closure|null $query_modifier = null;
|
||||
|
||||
public function __construct(ManagerRegistry $registry = null)
|
||||
public function __construct(?ManagerRegistry $registry = null)
|
||||
{
|
||||
parent::__construct($registry);
|
||||
$this->detailQueryCallable = static function (QueryBuilder $qb, array $ids): never {
|
||||
|
|
|
@ -45,7 +45,7 @@ abstract class AbstractConstraint implements FilterInterface
|
|||
* @var string The property where this BooleanConstraint should apply to
|
||||
*/
|
||||
protected string $property,
|
||||
string $identifier = null)
|
||||
?string $identifier = null)
|
||||
{
|
||||
$this->identifier = $identifier ?? $this->generateParameterIdentifier($property);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class BooleanConstraint extends AbstractConstraint
|
|||
{
|
||||
public function __construct(
|
||||
string $property,
|
||||
string $identifier = null,
|
||||
?string $identifier = null,
|
||||
/** @var bool|null The value of our constraint */
|
||||
protected ?bool $value = null
|
||||
)
|
||||
|
|
|
@ -34,7 +34,7 @@ class DateTimeConstraint extends AbstractConstraint
|
|||
|
||||
public function __construct(
|
||||
string $property,
|
||||
string $identifier = null,
|
||||
?string $identifier = null,
|
||||
/**
|
||||
* The value1 used for comparison (this is the main one used for all mono-value comparisons)
|
||||
*/
|
||||
|
|
|
@ -46,7 +46,7 @@ class EntityConstraint extends AbstractConstraint
|
|||
public function __construct(protected ?NodesListBuilder $nodesListBuilder,
|
||||
protected string $class,
|
||||
string $property,
|
||||
string $identifier = null,
|
||||
?string $identifier = null,
|
||||
protected ?AbstractDBElement $value = null,
|
||||
protected ?string $operator = null)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ class NumberConstraint extends AbstractConstraint
|
|||
|
||||
public function __construct(
|
||||
string $property,
|
||||
string $identifier = null,
|
||||
?string $identifier = null,
|
||||
/**
|
||||
* The value1 used for comparison (this is the main one used for all mono-value comparisons)
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||
|
||||
class LessThanDesiredConstraint extends BooleanConstraint
|
||||
{
|
||||
public function __construct(string $property = null, string $identifier = null, ?bool $default_value = null)
|
||||
public function __construct(?string $property = null, ?string $identifier = null, ?bool $default_value = null)
|
||||
{
|
||||
parent::__construct($property ?? '(
|
||||
SELECT COALESCE(SUM(ld_partLot.amount), 0.0)
|
||||
|
|
|
@ -30,7 +30,7 @@ class TagsConstraint extends AbstractConstraint
|
|||
{
|
||||
final public const ALLOWED_OPERATOR_VALUES = ['ANY', 'ALL', 'NONE'];
|
||||
|
||||
public function __construct(string $property, string $identifier = null,
|
||||
public function __construct(string $property, ?string $identifier = null,
|
||||
protected ?string $value = null,
|
||||
protected ?string $operator = '')
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ class TextConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function __construct(string $property, string $identifier = null, /**
|
||||
public function __construct(string $property, ?string $identifier = null, /**
|
||||
* @var string|null The value to compare to
|
||||
*/
|
||||
protected ?string $value = null, /**
|
||||
|
|
|
@ -162,7 +162,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
*
|
||||
* @return string the link to the article
|
||||
*/
|
||||
public function getAutoProductUrl(string $partnr = null): string
|
||||
public function getAutoProductUrl(?string $partnr = null): string
|
||||
{
|
||||
if (is_string($partnr)) {
|
||||
return str_replace('%PARTNUMBER%', $partnr, $this->auto_product_url);
|
||||
|
|
|
@ -54,7 +54,7 @@ class OAuthToken extends AbstractNamedDBElement implements AccessTokenInterface
|
|||
*/
|
||||
private const DEFAULT_EXPIRATION_TIME = 3600;
|
||||
|
||||
public function __construct(string $name, ?string $refresh_token, ?string $token = null, \DateTimeImmutable $expires_at = null)
|
||||
public function __construct(string $name, ?string $refresh_token, ?string $token = null, ?\DateTimeImmutable $expires_at = null)
|
||||
{
|
||||
//If token is given, you also have to give the expires_at date
|
||||
if ($token !== null && $expires_at === null) {
|
||||
|
|
|
@ -62,7 +62,7 @@ trait WithPermPresetsTrait
|
|||
return json_encode($user->getPermissions());
|
||||
}
|
||||
|
||||
public function setContainer(ContainerInterface $container = null): void
|
||||
public function setContainer(?ContainerInterface $container = null): void
|
||||
{
|
||||
if ($container !== null) {
|
||||
$this->container = $container;
|
||||
|
|
|
@ -160,7 +160,7 @@ class LogEntryRepository extends DBElementRepository
|
|||
* @param int|null $limit
|
||||
* @param int|null $offset
|
||||
*/
|
||||
public function getLogsOrderedByTimestamp(string $order = 'DESC', int $limit = null, int $offset = null): array
|
||||
public function getLogsOrderedByTimestamp(string $order = 'DESC', ?int $limit = null, ?int $offset = null): array
|
||||
{
|
||||
return $this->findBy([], ['timestamp' => $order], $limit, $offset);
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ class ApiTokenAuthenticator implements AuthenticatorInterface
|
|||
/**
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc6750#section-3
|
||||
*/
|
||||
private function getAuthenticateHeader(string $errorDescription = null): string
|
||||
private function getAuthenticateHeader(?string $errorDescription = null): string
|
||||
{
|
||||
$data = [
|
||||
'realm' => $this->realm,
|
||||
|
|
|
@ -47,7 +47,7 @@ class AuthenticationEntryPoint implements AuthenticationEntryPointInterface
|
|||
) {
|
||||
}
|
||||
|
||||
public function start(Request $request, AuthenticationException $authException = null): Response
|
||||
public function start(Request $request, ?AuthenticationException $authException = null): Response
|
||||
{
|
||||
//Check if the request is an API request
|
||||
if ($this->isJSONRequest($request)) {
|
||||
|
|
|
@ -116,10 +116,10 @@ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterf
|
|||
* Maps a list of SAML roles to a local group ID.
|
||||
* The first available mapping will be used (so the order of the $map is important, first match wins).
|
||||
* @param array $roles The list of SAML roles
|
||||
* @param array $map|null The mapping from SAML roles. If null, the global mapping will be used.
|
||||
* @param array|null $map The mapping from SAML roles. If null, the global mapping will be used.
|
||||
* @return int|null The ID of the local group or null if no mapping was found.
|
||||
*/
|
||||
public function mapSAMLRolesToLocalGroupID(array $roles, array $map = null): ?int
|
||||
public function mapSAMLRolesToLocalGroupID(array $roles, ?array $map = null): ?int
|
||||
{
|
||||
$map ??= $this->saml_role_mapping;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class AttachmentNormalizer implements NormalizerInterface, NormalizerAwareInterf
|
|||
{
|
||||
}
|
||||
|
||||
public function normalize(mixed $object, string $format = null, array $context = []): array|null
|
||||
public function normalize(mixed $object, ?string $format = null, array $context = []): array|null
|
||||
{
|
||||
if (!$object instanceof Attachment) {
|
||||
throw new \InvalidArgumentException('This normalizer only supports Attachment objects!');
|
||||
|
@ -60,7 +60,7 @@ class AttachmentNormalizer implements NormalizerInterface, NormalizerAwareInterf
|
|||
return $data;
|
||||
}
|
||||
|
||||
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
|
||||
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
// avoid recursion: only call once per object
|
||||
if (isset($context[self::ALREADY_CALLED])) {
|
||||
|
|
|
@ -33,12 +33,12 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
|||
class BigNumberNormalizer implements NormalizerInterface, DenormalizerInterface
|
||||
{
|
||||
|
||||
public function supportsNormalization($data, string $format = null, array $context = []): bool
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return $data instanceof BigNumber;
|
||||
}
|
||||
|
||||
public function normalize($object, string $format = null, array $context = []): string
|
||||
public function normalize($object, ?string $format = null, array $context = []): string
|
||||
{
|
||||
if (!$object instanceof BigNumber) {
|
||||
throw new \InvalidArgumentException('This normalizer only supports BigNumber objects!');
|
||||
|
@ -58,7 +58,7 @@ class BigNumberNormalizer implements NormalizerInterface, DenormalizerInterface
|
|||
];
|
||||
}
|
||||
|
||||
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): BigNumber|null
|
||||
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): BigNumber|null
|
||||
{
|
||||
if (!is_a($type, BigNumber::class, true)) {
|
||||
throw new \InvalidArgumentException('This normalizer only supports BigNumber objects!');
|
||||
|
@ -67,7 +67,7 @@ class BigNumberNormalizer implements NormalizerInterface, DenormalizerInterface
|
|||
return $type::of($data);
|
||||
}
|
||||
|
||||
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
|
||||
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
//data must be a string or a number (int, float, etc.) and the type must be BigNumber or BigDecimal
|
||||
return (is_string($data) || is_numeric($data)) && (is_subclass_of($type, BigNumber::class));
|
||||
|
|
|
@ -63,13 +63,13 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Norm
|
|||
{
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, string $format = null, array $context = []): bool
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
//We only remove the type field for CSV export
|
||||
return !isset($context[self::ALREADY_CALLED]) && $format === 'csv' && $data instanceof Part ;
|
||||
}
|
||||
|
||||
public function normalize($object, string $format = null, array $context = []): array
|
||||
public function normalize($object, ?string $format = null, array $context = []): array
|
||||
{
|
||||
if (!$object instanceof Part) {
|
||||
throw new \InvalidArgumentException('This normalizer only supports Part objects!');
|
||||
|
@ -117,7 +117,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Norm
|
|||
return $data;
|
||||
}
|
||||
|
||||
public function denormalize($data, string $type, string $format = null, array $context = []): ?Part
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = []): ?Part
|
||||
{
|
||||
$this->normalizeKeys($data);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class StructuralElementDenormalizer implements DenormalizerInterface, Denormaliz
|
|||
{
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
//Only denormalize if we are doing a file import operation
|
||||
if (!($context['partdb_import'] ?? false)) {
|
||||
|
@ -78,7 +78,7 @@ class StructuralElementDenormalizer implements DenormalizerInterface, Denormaliz
|
|||
* @return AbstractStructuralDBElement|null
|
||||
* @phpstan-return T|null
|
||||
*/
|
||||
public function denormalize($data, string $type, string $format = null, array $context = []): ?AbstractStructuralDBElement
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = []): ?AbstractStructuralDBElement
|
||||
{
|
||||
//Do not use API Platform's denormalizer
|
||||
$context[SkippableItemNormalizer::DISABLE_ITEM_NORMALIZER] = true;
|
||||
|
|
|
@ -36,7 +36,7 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface
|
|||
{
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
//Only denormalize if we are doing a file import operation
|
||||
if (!($context['partdb_import'] ?? false)) {
|
||||
|
@ -51,7 +51,7 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface
|
|||
* @phpstan-param class-string<T> $type
|
||||
* @phpstan-return T|null
|
||||
*/
|
||||
public function denormalize($data, string $type, string $format = null, array $context = []): AbstractStructuralDBElement|null
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = []): AbstractStructuralDBElement|null
|
||||
{
|
||||
//Retrieve the repository for the given type
|
||||
/** @var StructuralDBElementRepository<T> $repo */
|
||||
|
|
|
@ -38,7 +38,7 @@ class StructuralElementNormalizer implements NormalizerInterface
|
|||
{
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, string $format = null, array $context = []): bool
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
//Only normalize if we are doing a file export operation
|
||||
if (!($context['partdb_export'] ?? false)) {
|
||||
|
@ -48,7 +48,7 @@ class StructuralElementNormalizer implements NormalizerInterface
|
|||
return $data instanceof AbstractStructuralDBElement;
|
||||
}
|
||||
|
||||
public function normalize($object, string $format = null, array $context = []): mixed
|
||||
public function normalize($object, ?string $format = null, array $context = []): mixed
|
||||
{
|
||||
if (!$object instanceof AbstractStructuralDBElement) {
|
||||
throw new \InvalidArgumentException('This normalizer only supports AbstractStructural objects!');
|
||||
|
|
|
@ -357,7 +357,7 @@ class EntityImporter
|
|||
* @param iterable $entities the list of entities that should be fixed
|
||||
* @param AbstractStructuralDBElement|null $parent the parent, to which the entity should be set
|
||||
*/
|
||||
protected function correctParentEntites(iterable $entities, AbstractStructuralDBElement $parent = null): void
|
||||
protected function correctParentEntites(iterable $entities, ?AbstractStructuralDBElement $parent = null): void
|
||||
{
|
||||
foreach ($entities as $entity) {
|
||||
/** @var AbstractStructuralDBElement $entity */
|
||||
|
|
|
@ -1221,7 +1221,7 @@ class OEMSecretsProvider implements InfoProviderInterface
|
|||
* - 'value_min' => string|null The minimum value in a range, if applicable.
|
||||
* - 'value_max' => string|null The maximum value in a range, if applicable.
|
||||
*/
|
||||
private function customSplitIntoValueAndUnit(string $value1, string $value2 = null): array
|
||||
private function customSplitIntoValueAndUnit(string $value1, ?string $value2 = null): array
|
||||
{
|
||||
// Separate numbers and units (basic parsing handling)
|
||||
$unit = null;
|
||||
|
|
|
@ -43,12 +43,12 @@ class UniqueObjectCollection extends Constraint
|
|||
* @param array|string $fields the combination of fields that must contain unique values or a set of options
|
||||
*/
|
||||
public function __construct(
|
||||
array $options = null,
|
||||
string $message = null,
|
||||
callable $normalizer = null,
|
||||
array $groups = null,
|
||||
?array $options = null,
|
||||
?string $message = null,
|
||||
?callable $normalizer = null,
|
||||
?array $groups = null,
|
||||
mixed $payload = null,
|
||||
array|string $fields = null,
|
||||
array|string|null $fields = null,
|
||||
public bool $allowNull = true,
|
||||
) {
|
||||
parent::__construct($options, $groups, $payload);
|
||||
|
|
|
@ -31,8 +31,8 @@ class ValidGoogleAuthCode extends Constraint
|
|||
* @param TwoFactorInterface|null $user The user to use for the validation process, if null, the current user is used
|
||||
*/
|
||||
public function __construct(
|
||||
array $options = null,
|
||||
array $groups = null,
|
||||
?array $options = null,
|
||||
?array $groups = null,
|
||||
mixed $payload = null,
|
||||
public ?TwoFactorInterface $user = null)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue