* Qual: Fix phpstan notice with cast * Qual: Fix initialiser (phpstan) and narrow some types * Qual: Fix typing for object->type field (phpstan) * Qual: Update preg_quote usage in step2.php # Qual: Ignore false phpstan positive for preg_match Add comment to ignore phpstan warning for preg_match argument * Qual: Extend accepted types for arrayoptions (phpstan) * Qual: Fix type hint typo * Qual: Fix type for contact_id assignment * Qual: Add menuonly as allowed reloadmode * Qual: Add PHPStan ignore comments for argument.type * Qual: Ignore unused parameter in constructors (PHPStan) * Qual: Add type hint for $TMsg (PHPStan) * Qual: Cast array values to match expected type (PHPStan) * Qual: Cast $remise_percent_ligne to float (PHPStan) * Qual: Add array specifier to GETPOST for correct type (PHPStan) * Qual: Update sumSituation() argument types * Qual: Cast value to string for printStdColumnContent (PHPStan) * Qual: Ignore PHPStan notice for autoload function return value * Qual: Fix type of argument to Menubase::recur (PHPStan) * Qual: Fix return type hint (PHPStan) * Qual: Add $dolibarr_main_db_type as default global * Qual: Update Phan baseline (due to PHPStan fix)
46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
/* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
|
|
*/
|
|
/**
|
|
* Simple autoloader, so we don't need Composer just for this.
|
|
*
|
|
* @phan-file-suppress PhanTypeMismatchArgumentInternal
|
|
*/
|
|
|
|
spl_autoload_register(
|
|
/**
|
|
* @param string $class Class to load
|
|
* @return bool If class could be loaded
|
|
*/
|
|
static function ($class) {
|
|
// @phpstan-ignore argument.type
|
|
if (preg_match('/^DebugBar/', $class)) {
|
|
$file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
|
|
//var_dump($class.' - '.file_exists($file).' - '.$file);
|
|
if (file_exists($file)) {
|
|
require_once $file;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) {
|
|
$file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
|
|
//var_dump($class.' - '.file_exists($file).' - '.$file);
|
|
if (file_exists($file)) {
|
|
require_once $file;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) {
|
|
$class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class);
|
|
$file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
|
|
if (file_exists($file)) {
|
|
require_once $file;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
);
|