Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest ]
php-versions: [ '8.2', '8.3' ]
php-versions: [ '8.3' ]
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2']
php-versions: ['8.3']
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2']
php-versions: ['8.3']
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2']
php-versions: ['8.3']
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
83 changes: 0 additions & 83 deletions psalm-baseline.xml

This file was deleted.

1 change: 0 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="false"
findUnusedCode="false"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Chamilo\CoreBundle\Helpers\AccessUrlHelper;
use Chamilo\CourseBundle\Entity\CAttendanceCalendar;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -71,7 +72,7 @@ public function availability(
.' OR (cal.room IS NULL AND a.room IS NULL AND src.room IS NULL AND IDENTITY(c.room) = :roomId)'
)
->setParameter('roomId', $room['id'])
->setParameter('end', $end)
->setParameter('end', $end, Types::DATETIME_MUTABLE)
->getQuery()
->getArrayResult()
;
Expand Down
7 changes: 4 additions & 3 deletions src/CoreBundle/Controller/Admin/RoomOccupationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Chamilo\CoreBundle\Helpers\RoomAccessUrlHelper;
use Chamilo\CourseBundle\Entity\CAttendanceCalendar;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -73,9 +74,9 @@ public function occupation(
.' OR (cal.room IS NULL AND a.room IS NULL AND src.room = :room)'
.' OR (cal.room IS NULL AND a.room IS NULL AND src.room IS NULL AND c.room = :room)'
)
->setParameter('room', $room)
->setParameter('start', $start)
->setParameter('end', $end)
->setParameter('room', (int) $room->getId())
->setParameter('start', $start, Types::DATETIME_MUTABLE)
->setParameter('end', $end, Types::DATETIME_MUTABLE)
->orderBy('cal.dateTime', 'ASC')
->getQuery()
->getArrayResult()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function up(Schema $schema): void
private function migrateUserImages(IllustrationRepository $illustrationRepo, bool $splitDirectories): void
{
$query = $this->entityManager->createQuery(
'SELECT u FROM Chamilo\\CoreBundle\\Entity\\User u
'SELECT u FROM Chamilo\CoreBundle\Entity\User u
WHERE u.pictureUri IS NOT NULL AND u.pictureUri <> :empty'
)->setParameter('empty', '');

Expand Down Expand Up @@ -155,7 +155,7 @@ private function migrateUsergroupResources(): void
private function migrateUsergroupImages(IllustrationRepository $illustrationRepo, bool $splitDirectories): void
{
$query = $this->entityManager->createQuery(
'SELECT u FROM Chamilo\\CoreBundle\\Entity\\Usergroup u
'SELECT u FROM Chamilo\CoreBundle\Entity\Usergroup u
WHERE u.picture IS NOT NULL AND u.picture <> :empty'
)->setParameter('empty', '');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a
return $user;
}

/**
* @psalm-suppress MethodSignatureMismatch
*/
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
if (isset($context[self::ALREADY_CALLED])) {
Expand Down
22 changes: 11 additions & 11 deletions src/CoreBundle/Serializer/DocumentAiAssistedNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@ public function supportsNormalization($data, ?string $format = null, array $cont
return $data instanceof CDocument;
}

public function normalize($object, ?string $format = null, array $context = []): array|ArrayObject|bool|float|int|string|null
public function normalize($data, ?string $format = null, array $context = []): array|ArrayObject|bool|float|int|string|null
{
$context[self::ALREADY_CALLED] = true;

$data = $this->normalizer->normalize($object, $format, $context);
$result = $this->normalizer->normalize($data, $format, $context);

if (!\is_array($data) || !$object instanceof CDocument) {
return $data;
if (!\is_array($result) || !$data instanceof CDocument) {
return $result;
}

$docId = (int) ($object->getIid() ?? 0);
$docId = (int) ($data->getIid() ?? 0);
if ($docId <= 0) {
$data['ai_assisted'] = false;
$data['ai_assisted_raw'] = false;
$result['ai_assisted'] = false;
$result['ai_assisted_raw'] = false;

return $data;
return $result;
}

$raw = $this->aiDisclosureHelper->isAiAssistedExtraField('document', $docId);
$data['ai_assisted_raw'] = (bool) $raw;
$data['ai_assisted'] = $this->aiDisclosureHelper->isDisclosureEnabled() && $raw;
$result['ai_assisted_raw'] = (bool) $raw;
$result['ai_assisted'] = $this->aiDisclosureHelper->isDisclosureEnabled() && $raw;

return $data;
return $result;
}

public function getSupportedTypes(?string $format): array
Expand Down
22 changes: 11 additions & 11 deletions src/CoreBundle/Serializer/GlossaryAiAssistedNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@ public function supportsNormalization($data, ?string $format = null, array $cont
return $data instanceof CGlossary;
}

public function normalize($object, ?string $format = null, array $context = []): array|ArrayObject|bool|float|int|string|null
public function normalize($data, ?string $format = null, array $context = []): array|ArrayObject|bool|float|int|string|null
{
$context[self::ALREADY_CALLED] = true;

$data = $this->normalizer->normalize($object, $format, $context);
$result = $this->normalizer->normalize($data, $format, $context);

if (!\is_array($data) || !$object instanceof CGlossary) {
return $data;
if (!\is_array($result) || !$data instanceof CGlossary) {
return $result;
}

$iid = (int) ($object->getIid() ?? 0);
$iid = (int) ($data->getIid() ?? 0);
if ($iid <= 0) {
$data['ai_assisted_raw'] = false;
$data['ai_assisted'] = false;
$result['ai_assisted_raw'] = false;
$result['ai_assisted'] = false;

return $data;
return $result;
}

$raw = $this->aiDisclosureHelper->isAiAssistedExtraField('glossary', $iid);
$data['ai_assisted_raw'] = (bool) $raw;
$data['ai_assisted'] = $this->aiDisclosureHelper->isDisclosureEnabled() && (bool) $raw;
$result['ai_assisted_raw'] = (bool) $raw;
$result['ai_assisted'] = $this->aiDisclosureHelper->isDisclosureEnabled() && (bool) $raw;

return $data;
return $result;
}

public function getSupportedTypes(?string $format): array
Expand Down
12 changes: 6 additions & 6 deletions src/CoreBundle/Serializer/Normalizer/MessageNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ class MessageNormalizer implements NormalizerInterface, NormalizerAwareInterface

private const ALREADY_CALLED = 'MESSAGE_NORMALIZER_ALREADY_CALLED';

public function normalize($object, ?string $format = null, array $context = []): array
public function normalize($data, ?string $format = null, array $context = []): array
{
$context[self::ALREADY_CALLED] = true;

/** @var array<string, mixed> $data */
$data = $this->normalizer->normalize($object, $format, $context);
/** @var array<string, mixed> $result */
$result = $this->normalizer->normalize($data, $format, $context);

if (isset($data['content']) && \is_string($data['content'])) {
$data['content'] = Security::remove_XSS($data['content'], STUDENT);
if (isset($result['content']) && \is_string($result['content'])) {
$result['content'] = Security::remove_XSS($result['content'], STUDENT);
}

return $data;
return $result;
}

public function supportsNormalization($data, ?string $format = null, array $context = []): bool
Expand Down
4 changes: 2 additions & 2 deletions src/CoreBundle/Serializer/Normalizer/Scim/UserNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public function __construct(
private readonly ScimHelper $scimHelper,
) {}

public function normalize(mixed $object, ?string $format = null, array $context = []): array
public function normalize(mixed $data, ?string $format = null, array $context = []): array
{
/** @var User $user */
$user = $object;
$user = $data;

$uuid = $user->getUuid();

Expand Down
10 changes: 5 additions & 5 deletions src/CoreBundle/Serializer/Normalizer/SessionNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ public function __construct(

private const ALREADY_CALLED = 'SESSION_NORMALIZER_ALREADY_CALLED';

public function normalize($object, ?string $format = null, array $context = []): array
public function normalize($data, ?string $format = null, array $context = []): array
{
$context[self::ALREADY_CALLED] = true;

\assert($object instanceof Session);
\assert($data instanceof Session);

try {
$object->getAccessVisibility();
$data->getAccessVisibility();
} catch (LogicException) {
$object->setAccessVisibilityByUser(
$data->setAccessVisibilityByUser(
$this->userHelper->getCurrent()
);
}

return $this->normalizer->normalize($object, $format, $context);
return $this->normalizer->normalize($data, $format, $context);
}

public function supportsNormalization($data, ?string $format = null, array $context = []): bool
Expand Down
12 changes: 6 additions & 6 deletions src/CoreBundle/Serializer/Normalizer/SocialPostNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ class SocialPostNormalizer implements NormalizerInterface, NormalizerAwareInterf

private const ALREADY_CALLED = 'SOCIAL_POST_NORMALIZER_ALREADY_CALLED';

public function normalize($object, ?string $format = null, array $context = []): array
public function normalize($data, ?string $format = null, array $context = []): array
{
$context[self::ALREADY_CALLED] = true;

/** @var array<string, mixed> $data */
$data = $this->normalizer->normalize($object, $format, $context);
/** @var array<string, mixed> $result */
$result = $this->normalizer->normalize($data, $format, $context);

if (isset($data['content']) && \is_string($data['content'])) {
$data['content'] = Security::remove_XSS($data['content'], STUDENT);
if (isset($result['content']) && \is_string($result['content'])) {
$result['content'] = Security::remove_XSS($result['content'], STUDENT);
}

return $data;
return $result;
}

public function supportsNormalization($data, ?string $format = null, array $context = []): bool
Expand Down
8 changes: 4 additions & 4 deletions src/CoreBundle/Serializer/Normalizer/UserNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public function __construct(
private readonly NameConventionHelper $nameConventionHelper,
) {}

public function normalize($object, ?string $format = null, array $context = []): array
public function normalize($data, ?string $format = null, array $context = []): array
{
$context[self::ALREADY_CALLED] = true;

$data = $this->normalizer->normalize($object, $format, $context);
$result = $this->normalizer->normalize($data, $format, $context);

$data['fullName'] = $this->nameConventionHelper->getPersonName($object);
$result['fullName'] = $this->nameConventionHelper->getPersonName($data);

return $data;
return $result;
}

public function supportsNormalization($data, ?string $format = null, array $context = []): bool
Expand Down
Loading
Loading