*/
public function register()
{
- spl_autoload_register(array($this, 'loadClass'));
+ spl_autoload_register(function (string $class): void {
+ $this->loadClass($class);
+ });
}
/**
*
* @return boolean TRUE if the class has been successfully loaded, FALSE otherwise.
*/
- public function loadClass($className)
+ public function loadClass($className): bool
{
if ($this->namespace !== null && strpos($className, $this->namespace . $this->namespaceSeparator) !== 0) {
return false;
if ($res === true) {
$success_detected[] = str_replace(
'%i',
- $members->getCount(),
+ (string)$members->getCount(),
_T("Logins and passwords have been successfully filled (%i processed).")
);
} else {
} else {
$msg = str_replace(
'%id',
- $id,
+ (string)$id,
_T("Unable to impersonate as %id")
);
$this->flash->addMessage(
$redirect_url = $this->routeparser->urlFor('slash');
if ((($this->login->isAdmin() || $this->login->isStaff()) && $id_adh !== null)) {
$from_admin = true;
- $redirect_url = $this->routeparser->urlFor('member', ['id' => $id_adh]);
+ $redirect_url = $this->routeparser->urlFor('member', ['id' => (string)$id_adh]);
}
if (
$this->history->add(
str_replace(
'%s',
- $id_adh,
+ (string)$id_adh,
_T("Password changed for member '%s'.")
)
);
'mode' => ($request->getHeaderLine('X-Requested-With') === 'XMLHttpRequest') ? 'ajax' : '',
'page_title' => str_replace(
'%count',
- count($data['id']),
+ (string)count($data['id']),
_T('Mass add contribution on %count members')
),
'data' => $data,
'mode' => ($request->getHeaderLine('X-Requested-With') === 'XMLHttpRequest') ? 'ajax' : '',
'page_title' => str_replace(
'%count',
- count($data['id']),
+ (string)count($data['id']),
_T('Mass add contribution on %count members')
),
'form_url' => $this->routeparser->urlFor('doMassAddContributions'),
'error_detected',
str_replace(
'%id',
- $id,
+ (string)$id,
_T("Unable to load contribution #%id!")
)
);
'Location',
$this->routeparser->urlFor(
$route_name,
- ['id' => $id]
+ ['id' => (string)$id]
)
);
}
return $response
->withHeader(
'Location',
- $this->routeparser->urlFor('member', ['id' => $id])
+ $this->routeparser->urlFor('member', ['id' => (string)$id])
);
}
}
$group->setName($name);
$group->store();
if (!$this->login->isSuperAdmin()) {
- $group->setManagers(new Adherent($this->zdb, $this->login->id));
+ $group->setManagers([new Adherent($this->zdb, $this->login->id)]);
}
$id = $group->getId();
return $response
->withStatus(301)
- ->withHeader('Location', $this->routeparser->urlFor('groups', ['id' => $id]));
+ ->withHeader('Location', $this->routeparser->urlFor('groups', ['id' => (string)$id]));
}
}
return $response
->withStatus(301)
- ->withHeader('Location', $this->routeparser->urlFor('groups', ['id' => $group->getId()]) . $tab);
+ ->withHeader('Location', $this->routeparser->urlFor('groups', ['id' => (string)$group->getId()]) . $tab);
}
/**
{
return $this->routeparser->urlFor(
'doRemoveGroup',
- ['id' => (int)$args['id']]
+ ['id' => (string)$args['id']]
);
}
//member does not exist!
$this->flash->addMessage(
'error_detected',
- str_replace('%id', $id, _T("No member #%id."))
+ str_replace('%id', (string)$id, _T("No member #%id."))
);
return $response
'mode' => ($request->getHeaderLine('X-Requested-With') === 'XMLHttpRequest') ? 'ajax' : '',
'page_title' => str_replace(
'%count',
- count($data['id']),
+ (string)count($data['id']),
_T('Mass change %count members')
),
'form_url' => $this->routeparser->urlFor('masschangeMembersReview'),
'mode' => ($request->getHeaderLine('X-Requested-With') === 'XMLHttpRequest') ? 'ajax' : '',
'page_title' => str_replace(
'%count',
- count($data['id']),
+ (string)count($data['id']),
_T('Review mass change %count members')
),
'form_url' => $this->routeparser->urlFor('massstoremembers'),
'success_detected',
str_replace(
'%count',
- $mass,
+ (string)$mass,
_T('%count members has been changed successfully!')
)
);
throw new \RuntimeException(
str_replace(
'%id',
- $member->id,
+ (string)$member->id,
'No right to store member #%id'
)
);
}
// Validation
- $redirect_url = $this->routeparser->urlFor('member', ['id' => $member->id]);
+ $redirect_url = $this->routeparser->urlFor('member', ['id' => (string)$member->id]);
if (!count($real_requireds) || isset($post[array_shift($real_requireds)])) {
// regular fields
$valid = $member->check($post, $required, $disabled);
}
if (isset($post['del_photo'])) {
- if (!$member->picture->delete($member->id)) {
+ if (!$member->picture->delete()) {
$error_detected[] = _T("Delete failed");
$str_adh = $member->id . ' (' . $member->sname . ' ' . ')';
Analog::log(
$redirect_url = $this->routeparser->urlFor('addMember');
break;
case Adherent::AFTER_ADD_SHOW:
- $redirect_url = $this->routeparser->urlFor('member', ['id' => $member->id]);
+ $redirect_url = $this->routeparser->urlFor('member', ['id' => (string)$member->id]);
break;
case Adherent::AFTER_ADD_LIST:
$redirect_url = $this->routeparser->urlFor('members');
['type' => 'fee']
) . '?id_adh=' . $member->id;
} else {
- $redirect_url = $this->routeparser->urlFor('member', ['id' => $member->id]);
+ $redirect_url = $this->routeparser->urlFor('member', ['id' => (string)$member->id]);
}
} else {
//store entity in session
if ($member->id) {
$redirect_url = $this->routeparser->urlFor(
'editMember',
- ['id' => $member->id]
+ ['id' => (string)$member->id]
);
} else {
$redirect_url = $this->routeparser->urlFor((isset($post['addchild']) ? 'addMemberChild' : 'addMember'));
$this->session->{$this->getFilterName(['suffix' => 'delete'])} = $filters;
return str_replace(
'%count',
- count($filters->selected),
+ (string)count($filters->selected),
_T('You are about to remove %count members.')
);
}
_T("Payment type '%s' has not been modified!")
);
//redirect to payment type edition
- $redirect_uri = $this->routeparser->urlFor('editPaymentType', ['id' => $id]);
+ $redirect_uri = $this->routeparser->urlFor('editPaymentType', ['id' => (string)$id]);
}
} else {
if ($id === null) {
$filters = $this->session->filter_savedsearch;
return str_replace(
'%count',
- count($filters->selected),
+ (string)count($filters->selected),
_T('You are about to remove %count searches.')
);
}
_T("Title '%s' has not been modified!")
);
- $redirect_uri = $this->routeparser->urlFor('editTitle', ['id' => $id]);
+ $redirect_uri = $this->routeparser->urlFor('editTitle', ['id' => (string)$id]);
}
} else {
if ($id === null) {
*/
public function doAdd(Request $request, Response $response, string $type = null): Response
{
- return $this->doEdit($request, $response, $type);
+ return $this->doEdit($request, $response, null, $type);
}
// /CRUD - Create
*
* @param Request $request PSR Request
* @param Response $response PSR Response
- * @param integer $id Transaction id
- * @param string $type Transaction type
+ * @param ?integer $id Transaction id
+ * @param ?string $type Transaction type
*
* @return Response
*/
$args = [];
if ($trans_id !== null) {
- $args['id'] = $id;
+ $args['id'] = (string)$id;
}
//redirect to calling action
return $response
->withStatus(301)
->withHeader('Location', $this->routeparser->urlFor(
'editTransaction',
- ['id' => $id]
+ ['id' => (string)$id]
));
}
->withStatus(301)
->withHeader('Location', $this->routeparser->urlFor(
'editTransaction',
- ['id' => $id]
+ ['id' => (string)$id]
));
}
'error_detected',
str_replace(
'%id',
- $id,
+ (string)$id,
_T("Unable to load contribution #%id!")
)
);
'error_detected',
str_replace(
'%id',
- $id,
+ (string)$id,
_T("Unable to load contribution #%id!")
)
);
);
} else {
return $this->sql->select(
+ //@phpstan-ignore-next-line
array(
$alias => PREFIX_DB . $table
)
* Default constructor.
* Initialize default language and set environment variables
*
- * @param bool $lang true if there were a language change
+ * @param string|false $lang true if there were a language change
*
* @return void
*/
/**
* Set connection information
*
- * @param string $host Database host
- * @param string $port Database port
- * @param string $name Database name
- * @param string $user Database user name
- * @param string $pass Database user's password
+ * @param string $host Database host
+ * @param string $port Database port
+ * @param string $name Database name
+ * @param string $user Database username
+ * @param ?string $pass Database user's password
*
* @return void
*/
/**
* Set installed version if we're upgrading
*
- * @param string $version Installed version
+ * @param ?string $version Installed version
*
* @return void
*/
*/
public function __construct(Db $zdb, Login $login, Preferences $preferences, MailingsList $filters = null, Mailing $mailing = null)
{
+ //@phpstan-ignore-next-line
parent::__construct($zdb, $login, $preferences, $filters);
$this->mailing = $mailing;
}
$paginate .= $this->getLink(
'<i class="fast backward small icon" aria-hidden="true"></i>',
$this->getHref(1),
- preg_replace("(%i)", $next, _T("First page"))
+ preg_replace("(%i)", (string)$next, _T("First page"))
);
$paginate .= $this->getLink(
'<i class="step backward small icon" aria-hidden="true"></i>',
$this->getHref($previous),
- preg_replace("(%i)", $previous, _T("Previous page (%i)"))
+ preg_replace("(%i)", (string)$previous, _T("Previous page (%i)"))
);
}
$this->getHref($this->current_page),
preg_replace(
"(%i)",
- $this->current_page,
+ (string)$this->current_page,
_T("Current page (%i)")
),
true
);
} else {
$paginate .= $this->getLink(
- $i,
+ (string)$i,
$this->getHref($i),
- preg_replace("(%i)", $i, _T("Page %i"))
+ preg_replace("(%i)", (string)$i, _T("Page %i"))
);
}
}
$paginate .= $this->getLink(
'<i class="step forward small icon" aria-hidden="true"></i>',
$this->getHref($next),
- preg_replace("(%i)", $next, _T("Next page (%i)"))
+ preg_replace("(%i)", (string)$next, _T("Next page (%i)"))
);
$paginate .= $this->getLink(
'<i class="fast forward small icon" aria-hidden="true"></i>',
$this->getHref($this->pages),
- preg_replace("(%i)", $this->pages, _T("Last page (%i)"))
+ preg_replace("(%i)", (string)$this->pages, _T("Last page (%i)"))
);
}
if ($this->current_page == 1 && $this->current_page == $this->pages) {
/**
* Stores an image on the disk and in the database
*
- * @param object $file The uploaded file
- * @param boolean $ajax If the image cames from an ajax call (dnd)
+ * @param array $file The uploaded file
+ * @param boolean $ajax If the image comes from an ajax call (dnd)
* @param array $cropping Cropping properties
*
* @return bool|int
$file = $existing_disk[$valid->id_adh];
$this->storeInDb(
$zdb,
- $file['id'],
+ (int)$file['id'],
$this->store_path . $file['id'] . '.' . $file['ext'],
$file['ext']
);
/**
* Get module namespace
*
- * @param integer $id Module ID
+ * @param string $id Module ID
*
* @return string
*/
/**
* Get module class name
*
- * @param integer $id Module ID
- * @param bool $full Include namespace, defaults to false
+ * @param string $id Module ID
+ * @param bool $full Include namespace, defaults to false
*
* @return string
*/
$this->errors[] = _T("- Invalid format of beginning of membership.");
} else {
$now = getdate();
- if (!checkdate($beg_membership[1], $beg_membership[0], $now['year'])) {
+ if (!checkdate((int)$beg_membership[1], (int)$beg_membership[0], $now['year'])) {
$this->errors[] = _T("- Invalid date for beginning of membership.");
}
}
if ($years <= -200) {
$this->errors[] = str_replace(
'%years',
- $years * -1,
+ (string)($years * -1),
_T('- Members must be less than 200 years old (currently %years)!')
);
}
if (strlen($value) < 2) {
$this->errors[] = str_replace(
'%i',
- 2,
+ '2',
_T("- The username must be composed of at least %i characters!")
);
} else {
return str_replace(
'%age',
- $d->diff(new \DateTime())->y,
+ (string)$d->diff(new \DateTime())->y,
_T(' (%age years old)')
);
}
/**
* Default constructor
*
- * @param Db $zdb Database
- * @param ArrayObject $args Optional existing result set
+ * @param Db $zdb Database
+ * @param mixed $args Optional existing result set
*/
public function __construct(Db $zdb, $args = null)
{
);
$this->errors[] = preg_replace(
'|%d|',
- $max_size,
+ (string)$max_size,
_T("File is too big. Maximum allowed size is %dKo")
);
continue;
$tmp_filename,
GALETTE_FILES_PATH . $new_filename
);
- $this->dynamics->setValue($this->id, $field_id, $val_index, $file['name']);
+ $this->dynamics->setValue($this->id, (int)$field_id, (int)$val_index, $file['name']);
$store = true;
}
$day = 31;
}
$y->setDate(
- $y->format('Y'),
+ (int)$y->format('Y'),
$month,
$day
);
if ($y === false && $ym !== false) {
$day = 1;
if ($name === 'end_date_filter') {
- $day = $ym->format('t');
+ $day = (int)$ym->format('t');
}
$ym->setDate(
- $ym->format('Y'),
- $ym->format('m'),
+ (int)$ym->format('Y'),
+ (int)$ym->format('m'),
$day
);
$this->$name = $ym->format('Y-m-d');
$day = 31;
}
$y->setDate(
- $y->format('Y'),
+ (int)$y->format('Y'),
$month,
$day
);
if ($y === false && $ym !== false) {
$day = 1;
if ($name === 'end_date_filter') {
- $day = $ym->format('t');
+ $day = (int)$ym->format('t');
}
$ym->setDate(
- $ym->format('Y'),
- $ym->format('m'),
+ (int)$ym->format('Y'),
+ (int)$ym->format('m'),
$day
);
$this->$name = $ym->format('Y-m-d');
$day = 31;
}
$y->setDate(
- $y->format('Y'),
+ (int)$y->format('Y'),
$month,
$day
);
if ($y === false && $ym !== false) {
$day = 1;
if ($name === 'end_date_filter') {
- $day = $ym->format('t');
+ $day = (int)$ym->format('t');
}
$ym->setDate(
- $ym->format('Y'),
- $ym->format('m'),
+ (int)$ym->format('Y'),
+ (int)$ym->format('m'),
$day
);
$this->$name = $ym->format('Y-m-d');
$day = 31;
}
$y->setDate(
- $y->format('Y'),
+ (int)$y->format('Y'),
$month,
$day
);
if ($y === false && $ym !== false) {
$day = 1;
if ($name === 'end_date_filter') {
- $day = $ym->format('t');
+ $day = (int)$ym->format('t');
}
$ym->setDate(
- $ym->format('Y'),
- $ym->format('m'),
+ (int)$ym->format('Y'),
+ (int)$ym->format('m'),
$day
);
$this->$name = $ym->format('Y-m-d');
/**
* Export Array result set to CSV
*
- * @param ResultSet $rs Results as an array
+ * @param mixed $rs Results as an array
* @param string $separator The CSV separator (either '\t', ';' or ','
* are accepted)
* @param string $quote how does fields should be quoted
- * @param array|false $titles does export shows column titles or not.
+ * @param array|boolean $titles does export shows column titles or not.
* Defaults to false.
* @param resource|false $file export to a file on disk. A file pointer
* should be passed here. Defaults to false.
/**
* Initialization
*
- * @param string $dest File destination directory
- * @param array $extensions Array of permitted extensions
- * @param array $mimes Array of permitted mime types
- * @param int $maxlenght Maximum lenght for each file
- * @param int $mincropsize Minimum image side size required for cropping
+ * @param ?string $dest File destination directory
+ * @param array $extensions Array of permitted extensions
+ * @param array $mimes Array of permitted mime types
+ * @param int $maxlenght Maximum length for each file
+ * @param int $mincropsize Minimum image side size required for cropping
*
* @return void
*/
}
/**
- * Stores an file on the disk
+ * Stores a file on the disk
*
- * @param object $file the uploaded file
- * @param boolean $ajax If the file cames from an ajax call (dnd)
+ * @param array $file the uploaded file
+ * @param boolean $ajax If the file comes from an ajax call (dnd)
*
* @return true|false|int result of the storage process
*/
$this->SetFont(self::FONT, 'B', self::FONT_SIZE + 2);
if ($title !== null) {
- $this->Cell(0, 6, $title, 0, 1, ($this->i18n->isRTL() ? 'R' : 'L'), 0);
+ $this->Cell(0, 6, $title, 0, 1, ($this->i18n->isRTL() ? 'R' : 'L'), false);
}
$yend = $this->getY(); //store position at the end of the text
if ($this->sheet_date !== null) {
$head_title .= ' - ' . $this->sheet_date->format(__("Y-m-d"));
}
- $this->Cell(0, 10, $head_title, 0, false, 'C', 0, '', 0, false, 'M', 'M');
+ $this->Cell(0, 10, $head_title, 0, 0, 'C', false, '', 0, false, 'M', 'M');
}
}
// Header
$this->SetFont('', 'B');
$this->SetFillColor(255, 255, 255);
- $this->Cell(110, 7, _T("Name"), 1, 0, 'C', 1);
- $this->Cell(80, 7, _T("Signature"), 1, 1, 'C', 1);
+ $this->Cell(110, 7, _T("Name"), 1, 0, 'C', true);
+ $this->Cell(80, 7, _T("Signature"), 1, 1, 'C', true);
// Data
$this->SetFont('');
$mcount = 0;
foreach ($members as $m) {
$mcount++;
- $this->Cell(10, 16, $mcount, ($this->i18n->isRTL() ? 'R' : 'L') . 'TB', 0, 'R');
+ $this->Cell(10, 16, (string)$mcount, ($this->i18n->isRTL() ? 'R' : 'L') . 'TB', 0, 'R');
if ($m->hasPicture() && $this->wimages) {
$p = $m->picture->getPath();
10,
_T("Members by groups"),
0,
- false,
- 'C',
0,
+ 'C',
+ false,
'',
0,
false,
$this->SetFont('', 'B');
$this->SetFillColor(255, 255, 255);
- $this->Cell(80, 7, _T("Name"), 1, 0, 'C', 1);
- $this->Cell(50, 7, _T("Email"), 1, 0, 'C', 1);
- $this->Cell(30, 7, _T("Phone"), 1, 0, 'C', 1);
- $this->Cell(30, 7, _T("GSM"), 1, 1, 'C', 1);
+ $this->Cell(80, 7, _T("Name"), 1, 0, 'C', true);
+ $this->Cell(50, 7, _T("Email"), 1, 0, 'C', true);
+ $this->Cell(30, 7, _T("Phone"), 1, 0, 'C', true);
+ $this->Cell(30, 7, _T("GSM"), 1, 1, 'C', true);
$this->SetFont('', 'B');
$this->year_font_size
) - 0.2;
$this->SetXY($xan_cot, $y0 + $this->hlogo - 0.3);
- $this->writeHTML('<strong>' . $an_cot . '</strong>', false, 0);
+ $this->writeHTML('<strong>' . $an_cot . '</strong>', false, false);
// Colored Text (Big label, id, year)
$this->SetTextColor($fcol['R'], $fcol['G'], $fcol['B']);
$member_id = (!empty($member->number)) ? $member->number : $member->id;
$xid = $x0 + $this->wi - $this->GetStringWidth($member_id, self::FONT, 'B', 8) - 0.2;
$this->SetXY($xid, $y0 + 28);
- $this->writeHTML('<strong>' . $member_id . '</strong>', false, 0);
+ $this->writeHTML('<strong>' . $member_id . '</strong>', false, false);
}
$this->SetFontSize($this->year_font_size);
$xan_cot = $xan_cot - 0.3;
$this->SetXY($xan_cot, $y0 + $this->hlogo - 0.3);
- $this->writeHTML('<strong>' . $an_cot . '</strong>', false, 0);
+ $this->writeHTML('<strong>' . $an_cot . '</strong>', false, false);
// Abbrev: Adapt font size to text length
$this->fixSize(
'B'
);
$this->SetXY($x0 + 27, $y0 + 12);
- $this->writeHTML('<strong>' . $this->abrev . '</strong>', true, 0);
+ $this->writeHTML('<strong>' . $this->abrev . '</strong>', true, false);
// Name: Adapt font size to text length
$this->SetTextColor(0);
);
$this->SetXY($x0 + 27, $this->getY() + 4);
//$this->setX($x0 + 27);
- $this->writeHTML('<strong>' . $nom_adh_ext . '</strong>', true, 0);
+ $this->writeHTML('<strong>' . $nom_adh_ext . '</strong>', true, false);
// Email (adapt too)
$this->fixSize(
'B'
);
$this->setX($x0 + 27);
- $this->writeHTML('<strong>' . $email . '</strong>', false, 0);
+ $this->writeHTML('<strong>' . $email . '</strong>', false, false);
// Lower colored strip with long text
$this->SetFillColor($fcol['R'], $fcol['G'], $fcol['B']);
0,
0,
'C',
- 1
+ true
);
// Draw a gray frame around the card
$this->preferences->pref_etiq_corps
);
// Print full address
- $this->writeHTMLCell($this->lw, $this->line_h, $x, $y, nl2br($full_address), 0, 0, 0, true, 'L', true);
+ $this->writeHTMLCell($this->lw, $this->line_h, $x, $y, nl2br($full_address), 0, 0, false, true, 'L', true);
// Next label
$nb_etiq++;
use Galette\DynamicFields\DynamicField;
use Galette\Entity\DynamicFieldsHandle;
use Analog\Analog;
-use Laminas\Db\Sql\Expression;
+use Laminas\Db\Sql\Predicate\Expression;
use Laminas\Db\Sql\Select;
use Laminas\Db\Sql\Predicate\PredicateSet;
use Laminas\Db\Sql\Predicate\Operator;
parameters:
parallel:
maximumNumberOfProcesses: 2
- level: 4
+ level: 5
paths:
- galette/lib/
scanFiles:
- '/Attribute class .*\\Inject does not exist./'
- '/Cannot access property .* on .*ArrayObject.*/'
- '/Access to an undefined property ArrayObject.*/'
+ - '/Parameter #3 \$right of class Laminas\\Db\\Sql\\Predicate\\Operator constructor expects bool\|float\|int\|string\|null, Laminas\\Db\\Sql\\Predicate\\Expression given./'