diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4be3bb10a..7fb2cd06a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,13 +7,15 @@ jobs: unit: name: "Unit tests" runs-on: ubuntu-22.04 - + continue-on-error: ${{ matrix.experimental }} strategy: - fail-fast: false + fail-fast: true matrix: - php: - - "7.4" - # - "8.2" + php: [ "7.4" ] + experimental: [ false ] + include: + - php: "8.2" + experimental: true steps: - uses: actions/checkout@v4 diff --git a/sources/Afup/Association/Cotisations.php b/sources/Afup/Association/Cotisations.php index c2d62d786..7c0305339 100644 --- a/sources/Afup/Association/Cotisations.php +++ b/sources/Afup/Association/Cotisations.php @@ -221,16 +221,13 @@ function estDejaReglee($cmd) function notifierRegelementEnLigneAuTresorier($cmd, $total, $autorisation, $transaction, UserRepository $userRepository) { - /** - * @var Configuration $configuration - */ - $configuration = $GLOBALS['AFUP_CONF']; - $account = $this->getAccountFromCmd($cmd); if (AFUP_PERSONNES_MORALES == $account['type']) { + $invoiceNumber = substr($cmd, 1); + $cotisation = $this->getByInvoice($invoiceNumber); $personnes = new Personnes_Morales($this->_bdd); - $infos = $personnes->obtenir($account['id'], 'nom, prenom, email'); + $infos = $personnes->obtenir($cotisation['id_personne'], 'nom, prenom, email'); } else { $user = $userRepository->get($account['id']); Assertion::notNull($user); @@ -281,7 +278,7 @@ function validerReglementEnLigne($cmd, $total, $autorisation, $transaction) $date_debut = mktime(0, 0, 0, substr($date, 2, 2), substr($date, 0, 2), substr($date, 4, 4)); $cotisation = $this->obtenirDerniere($type_personne, $id_personne); - $date_fin_precedente = $cotisation['date_fin']; + $date_fin_precedente = $cotisation === false ? 0 : $cotisation['date_fin']; if ($date_fin_precedente > 0) { $date_debut = strtotime('+1day', $date_fin_precedente); @@ -569,7 +566,7 @@ public function envoyerFacture($id_cotisation, Mailer $mailer, UserRepository $u * * @param int $id_personne Identifiant de la personne * @access public - * @return array + * @return array|false */ function obtenirDerniere($type_personne, $id_personne) { diff --git a/sources/Afup/Association/Personnes_Morales.php b/sources/Afup/Association/Personnes_Morales.php index e670d849b..2798a07f8 100644 --- a/sources/Afup/Association/Personnes_Morales.php +++ b/sources/Afup/Association/Personnes_Morales.php @@ -112,7 +112,7 @@ public function obtenirMembresMaximum($id, $default = 3) * @param int $id Identifiant de la personne * @param string $champs Champs à renvoyer * @access public - * @return array + * @return array|false */ function obtenir($id, $champs = '*') { diff --git a/sources/AppBundle/Association/Model/CompanyMember.php b/sources/AppBundle/Association/Model/CompanyMember.php index cf4607c4d..da8213743 100644 --- a/sources/AppBundle/Association/Model/CompanyMember.php +++ b/sources/AppBundle/Association/Model/CompanyMember.php @@ -557,15 +557,20 @@ public function getTwitterHandle() } /** + * Duplicate of AppBundle\Event\Model\Speaker::getCleanedTwitterHandle() * @return bool|string */ public function getCleanedTwitterHandle() { $twitter = $this->getTwitterHandle(); + if (!$twitter) { + return null; + } + $twitter = trim($twitter, '@'); $twitter = preg_replace('!^https?://twitter.com/!', '', $twitter); - if (0 === strlen(trim($twitter))) { + if (!$twitter) { return null; } @@ -660,7 +665,7 @@ public function getLastSubscription() public function setLastSubscription($sub) { if ($sub !== null) { - $this->lastSubscription = \DateTimeImmutable::createFromFormat('U', $sub); + $this->lastSubscription = \DateTimeImmutable::createFromFormat('U', (string) $sub); } } diff --git a/sources/AppBundle/Association/Model/User.php b/sources/AppBundle/Association/Model/User.php index 2f62b4cc6..8c2ecfa7f 100644 --- a/sources/AppBundle/Association/Model/User.php +++ b/sources/AppBundle/Association/Model/User.php @@ -582,7 +582,7 @@ public function getLastSubscription() public function setLastSubscription($sub) { if ($sub !== null) { - $this->lastSubscription = \DateTimeImmutable::createFromFormat('U', (string)$sub); + $this->lastSubscription = \DateTimeImmutable::createFromFormat('U', (string) $sub); } } diff --git a/sources/AppBundle/Controller/Admin/Members/GeneralMeeting/ReportsAction.php b/sources/AppBundle/Controller/Admin/Members/GeneralMeeting/ReportsAction.php index cb13aec95..c1abc65a5 100644 --- a/sources/AppBundle/Controller/Admin/Members/GeneralMeeting/ReportsAction.php +++ b/sources/AppBundle/Controller/Admin/Members/GeneralMeeting/ReportsAction.php @@ -89,7 +89,7 @@ public function __invoke(Request $request): Response private static function humanFilesize($bytes): string { $sz = 'BKMGTP'; - $factor = floor((strlen($bytes) - 1) / 3); + $factor = floor((strlen((string) $bytes) - 1) / 3); return sprintf("%.2f", $bytes / (1024 ** $factor)) . $sz[(int) $factor]; } diff --git a/sources/AppBundle/Controller/Admin/Planete/FeedListAction.php b/sources/AppBundle/Controller/Admin/Planete/FeedListAction.php index b95d905df..1470a21b3 100644 --- a/sources/AppBundle/Controller/Admin/Planete/FeedListAction.php +++ b/sources/AppBundle/Controller/Admin/Planete/FeedListAction.php @@ -53,7 +53,7 @@ public function __invoke(Request $request) private function testFeeds(array $feeds) { // on n'affiche rien du tout - ini_set('display_errors', 0); + ini_set('display_errors', '0'); set_time_limit(240); $results = []; foreach ($feeds as $f) { diff --git a/sources/AppBundle/Controller/MemberShipController.php b/sources/AppBundle/Controller/MemberShipController.php index c5543e838..82378a63a 100644 --- a/sources/AppBundle/Controller/MemberShipController.php +++ b/sources/AppBundle/Controller/MemberShipController.php @@ -404,9 +404,9 @@ public function membershipFeeAction() $message = sprintf( 'Votre dernière cotisation -- %s %s -- est valable jusqu\'au %s.
Si vous renouvelez votre cotisation maintenant, celle-ci sera valable jusqu\'au %s.', - number_format($cotisation['montant'], 2, ',', ' '), + number_format((float) $cotisation['montant'], 2, ',', ' '), EURO, - date("d/m/Y", $cotisation['date_fin']), + date("d/m/Y", (int) $cotisation['date_fin']), $endSubscription->format('d/m/Y') ); } @@ -508,7 +508,7 @@ public function membershipFeeDownloadAction(Request $request) $patternPrefix = $user->getLastName(); } - $pattern = str_replace(' ', '', $patternPrefix) . '_' . $numeroFacture . '_' . date('dmY', $cotisation['date_debut']) . '.pdf'; + $pattern = str_replace(' ', '', $patternPrefix) . '_' . $numeroFacture . '_' . date('dmY', (int) $cotisation['date_debut']) . '.pdf'; $response = new BinaryFileResponse($tempfile, 200, [], false); $response->deleteFileAfterSend(true); @@ -554,7 +554,7 @@ public function generalMeetingAction(Request $request) $generalMeetingPlanned = $generalMeetingRepository->hasGeneralMeetingPlanned(); $cotisation = $userService->getLastSubscription($user); - $needsMembersheepFeePayment = $latestDate->getTimestamp() > strtotime("+14 day", $cotisation['date_fin']); + $needsMembersheepFeePayment = $latestDate->getTimestamp() > strtotime("+14 day", (int) $cotisation['date_fin']); if ($needsMembersheepFeePayment) { return $this->render('admin/association/membership/generalmeeting_membersheepfee.html.twig', [ diff --git a/sources/AppBundle/TechLetter/Model/TechLetterFactory.php b/sources/AppBundle/TechLetter/Model/TechLetterFactory.php index 6c720724e..e2004dbd0 100644 --- a/sources/AppBundle/TechLetter/Model/TechLetterFactory.php +++ b/sources/AppBundle/TechLetter/Model/TechLetterFactory.php @@ -8,7 +8,7 @@ class TechLetterFactory { public static function createTechLetterFromJson($json) { - $array = json_decode($json, true); + $array = json_decode((string) $json, true); $articles = $projects = []; if (isset($array['projects'])) {