compat php8.2
This commit is contained in:
parent
c88277a6d6
commit
a03de2a099
|
@ -49,7 +49,7 @@ class c {
|
|||
* s'assurer que la valeur est une chaine si elle n'est pas nulle et que ce
|
||||
* n'est pas déjà une instance de {@link IPrintable} ou {@link IContent}
|
||||
*/
|
||||
private static final function _strval($value) {
|
||||
private static function _strval($value) {
|
||||
if ($value === null) { #NOP
|
||||
} elseif ($value instanceof IPrintable) { #NOP
|
||||
} elseif ($value instanceof IContent) { #NOP
|
||||
|
@ -58,7 +58,7 @@ class c {
|
|||
}
|
||||
|
||||
/** fusionner deux valeurs */
|
||||
private static final function _merge($pvalue, $value) {
|
||||
private static function _merge($pvalue, $value) {
|
||||
if (!$pvalue) {
|
||||
# prendre $value
|
||||
if (!is_iterable($value)) $value = self::_strval($value);
|
||||
|
|
|
@ -45,7 +45,7 @@ class EnvConfig extends DynConfig {
|
|||
protected $config;
|
||||
|
||||
/** analyser $name et retourner [$pkey, $profile] */
|
||||
private static final function parse_pkey_profile($name): array {
|
||||
private static function parse_pkey_profile($name): array {
|
||||
$i = strpos($name, "_");
|
||||
if ($i === false) return [false, false];
|
||||
$profile = substr($name, 0, $i);
|
||||
|
@ -55,7 +55,7 @@ class EnvConfig extends DynConfig {
|
|||
return [$pkey, $profile];
|
||||
}
|
||||
|
||||
private static final function invalid_json_data(string $pkey, string $profile, ?string $prefix, ?Throwable $e): ConfigException {
|
||||
private static function invalid_json_data(string $pkey, string $profile, ?string $prefix, ?Throwable $e): ConfigException {
|
||||
if ($prefix !== null) $prefix = "$prefix: ";
|
||||
return new ConfigException("${prefix}invalid json data for $profile:$pkey", 0, $e);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class InterpTemplate extends SimpleContext implements ITemplate {
|
|||
* - si $quote===false ou null, ne pas la mettre en échappement
|
||||
* - sinon, ce doit être une fonction qui met la valeur en échappement
|
||||
*/
|
||||
private static final function quote($value, $quote) {
|
||||
private static function quote($value, $quote) {
|
||||
if (A::is_array($value)) $value = print_r(A::with($value), true);
|
||||
elseif (!is_string($value)) $value = strval($value);
|
||||
if ($quote === true) return htmlspecialchars($value);
|
||||
|
@ -61,7 +61,7 @@ class InterpTemplate extends SimpleContext implements ITemplate {
|
|||
* décider comment traiter la valeur et sa valeur par défaut est true.
|
||||
* - Sinon prendre la valeur $quote telle quelle
|
||||
*/
|
||||
private static final function quote_nv(string $name, $value, $quote) {
|
||||
private static function quote_nv(string $name, $value, $quote) {
|
||||
if (is_array($quote)) {
|
||||
if (isset($quote[$name])) {
|
||||
$value = self::quote($value, $quote[$name]);
|
||||
|
|
|
@ -271,7 +271,7 @@ class func {
|
|||
const METHOD_PS = ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_STATIC;
|
||||
const METHOD_P = ReflectionMethod::IS_PUBLIC;
|
||||
|
||||
private static final function matches(string $name, array $includes, array $excludes): bool {
|
||||
private static function matches(string $name, array $includes, array $excludes): bool {
|
||||
if ($includes) {
|
||||
$matches = false;
|
||||
foreach ($includes as $include) {
|
||||
|
|
|
@ -10,7 +10,7 @@ class interp {
|
|||
/** @var InterpTemplate */
|
||||
private static $t;
|
||||
|
||||
private static final function t(): InterpTemplate {
|
||||
private static function t(): InterpTemplate {
|
||||
if (self::$t === null) self::$t = new InterpTemplate();
|
||||
return self::$t;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use nur\str;
|
|||
* Class Assoc2CsvHelper: outils pour écrire un flux au format CSV
|
||||
*/
|
||||
class Assoc2CsvHelper {
|
||||
private static final function is_different(array $h1, array $h2): bool {
|
||||
private static function is_different(array $h1, array $h2): bool {
|
||||
sort($h1);
|
||||
sort($h2);
|
||||
return $h1 != $h2;
|
||||
|
|
|
@ -18,7 +18,7 @@ use Traversable;
|
|||
* Class iter: gestion des itérateurs
|
||||
*/
|
||||
class iter {
|
||||
private static final function unexpected_type($object): ValueException {
|
||||
private static function unexpected_type($object): ValueException {
|
||||
return ValueException::unexpected_type("iterable", $object);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class Assoc2CsvMapper extends AbstractCsvMapper {
|
|||
/** @var bool faut-il afficher les en-têtes en sortie? */
|
||||
protected $ppOutputHeaders = true;
|
||||
|
||||
private static final function is_different(array $h1, array $h2): bool {
|
||||
private static function is_different(array $h1, array $h2): bool {
|
||||
sort($h1);
|
||||
sort($h2);
|
||||
return $h1 != $h2;
|
||||
|
|
|
@ -40,7 +40,7 @@ class Assoc2SeqMapper extends Mapper {
|
|||
/** @var bool faut-il afficher les en-têtes en sortie? */
|
||||
protected $ppOutputKeys;
|
||||
|
||||
private static final function is_different(array $h1, array $h2): bool {
|
||||
private static function is_different(array $h1, array $h2): bool {
|
||||
sort($h1);
|
||||
sort($h2);
|
||||
return $h1 != $h2;
|
||||
|
|
|
@ -215,7 +215,7 @@ class md {
|
|||
}
|
||||
}
|
||||
|
||||
private static final function _ensure_array_item(&$item, ?array $schema, $item_key): void {
|
||||
private static function _ensure_array_item(&$item, ?array $schema, $item_key): void {
|
||||
if ($item_key !== null) {
|
||||
if (is_array($item)) {
|
||||
if ($schema !== null) {
|
||||
|
@ -235,7 +235,7 @@ class md {
|
|||
}
|
||||
}
|
||||
|
||||
private static final function _ensure_schema_recursive(&$item, array $schema, ?array $indexes=null): void {
|
||||
private static function _ensure_schema_recursive(&$item, array $schema, ?array $indexes=null): void {
|
||||
self::_ensure_schema($item, $schema, $indexes);
|
||||
foreach ($schema as $key => $sfield) {
|
||||
$schema2 = $sfield["schema"];
|
||||
|
@ -340,7 +340,7 @@ class md {
|
|||
* les types simples sont reconnus. s'il s'agit d'un type complexe, la valeur
|
||||
* n'est pas vérifiée ni modifiée
|
||||
*/
|
||||
private static final function _ensure_type(?string $type, &$value, $default, bool $exists): void {
|
||||
private static function _ensure_type(?string $type, &$value, $default, bool $exists): void {
|
||||
if (self::_check_known_type($type, $value, $default, $exists)) {
|
||||
self::_convert_value($type, $value);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace nur;
|
|||
* @see \nur\v\vo
|
||||
*/
|
||||
class out {
|
||||
private static final function _print(?string $prefix, string $sep, array $values, ?string $suffix): void {
|
||||
private static function _print(?string $prefix, string $sep, array $values, ?string $suffix): void {
|
||||
if ($prefix !== null) echo $prefix;
|
||||
echo implode($sep, $values);
|
||||
if ($suffix !== null) echo $suffix;
|
||||
|
|
|
@ -51,7 +51,7 @@ class prop {
|
|||
return self::_set($c, $object, $property, $value, $method);
|
||||
}
|
||||
|
||||
private static final function _set(ReflectionClass $c, object $object, string $property, $value, ?string $method) {
|
||||
private static function _set(ReflectionClass $c, object $object, string $property, $value, ?string $method) {
|
||||
if ($method === null) $method = self::get_setter_name($property);
|
||||
try {
|
||||
$m = $c->getMethod($method);
|
||||
|
|
|
@ -53,7 +53,7 @@ class shell {
|
|||
return implode(" ", $parts);
|
||||
}
|
||||
|
||||
private static final function add_redir(string &$cmd, ?string $redir, ?string $input, ?string $output): void {
|
||||
private static function add_redir(string &$cmd, ?string $redir, ?string $input, ?string $output): void {
|
||||
if ($redir !== null) {
|
||||
switch ($redir) {
|
||||
case "outonly":
|
||||
|
|
|
@ -104,7 +104,7 @@ class txt {
|
|||
return implode("", $ucwords);
|
||||
}
|
||||
|
||||
private static final function _starts_with(string $prefix, string $s, ?int $min_len=null): bool {
|
||||
private static function _starts_with(string $prefix, string $s, ?int $min_len=null): bool {
|
||||
if ($prefix === $s) return true;
|
||||
$len = mb_strlen($prefix);
|
||||
if ($min_len !== null && ($len < $min_len || $len > mb_strlen($s))) return false;
|
||||
|
@ -163,7 +163,7 @@ class txt {
|
|||
$s = self::with_prefix($prefix, $s, null, $unless_exists);
|
||||
}
|
||||
|
||||
private static final function _ends_with(?string $suffix, string $s, ?int $min_len=null): bool {
|
||||
private static function _ends_with(?string $suffix, string $s, ?int $min_len=null): bool {
|
||||
if ($suffix === $s) return true;
|
||||
$len = mb_strlen($suffix);
|
||||
if ($min_len !== null && ($len < $min_len || $len > mb_strlen($s))) return false;
|
||||
|
|
|
@ -52,7 +52,7 @@ class RouteManager implements IRouteManager {
|
|||
/** @var array routes pour des préfixes de chemin */
|
||||
protected $proutes;
|
||||
|
||||
private static final function get_package(?string $class): ?string {
|
||||
private static function get_package(?string $class): ?string {
|
||||
if ($class === null) return null;
|
||||
str::del_prefix($class, "\\");
|
||||
if (($pos = strrpos($class, "\\")) === false) return "";
|
||||
|
|
|
@ -43,7 +43,7 @@ class Bs3NavbarManager extends TagsManager implements INavbarManager {
|
|||
return [$class, $style];
|
||||
}
|
||||
|
||||
private static final function get_align_class($align): ?string {
|
||||
private static function get_align_class($align): ?string {
|
||||
if ($align === null) return null;
|
||||
switch ($align) {
|
||||
case "navbar-left":
|
||||
|
|
|
@ -171,7 +171,7 @@ class page {
|
|||
http::download_as($filename, $disposition);
|
||||
}
|
||||
|
||||
private static final function _get_url($dest): string {
|
||||
private static function _get_url($dest): string {
|
||||
if ($dest === null) $url = self::self();
|
||||
elseif ($dest === true || is_array($dest)) $url = self::self($dest);
|
||||
else $url = self::bu($dest);
|
||||
|
|
|
@ -51,7 +51,7 @@ class sh {
|
|||
return implode(" ", $parts);
|
||||
}
|
||||
|
||||
private static final function add_redir(string &$cmd, ?string $redir, ?string $input, ?string $output): void {
|
||||
private static function add_redir(string &$cmd, ?string $redir, ?string $input, ?string $output): void {
|
||||
if ($redir !== null) {
|
||||
switch ($redir) {
|
||||
case "outonly":
|
||||
|
|
|
@ -26,7 +26,7 @@ class c {
|
|||
}
|
||||
const nq = [self::class, "nq"];
|
||||
|
||||
private static final function add_static_content(array &$dest, iterable $values, $key, bool $seq): void {
|
||||
private static function add_static_content(array &$dest, iterable $values, $key, bool $seq): void {
|
||||
$sindex = 0;
|
||||
foreach ($values as $skey => $svalue) {
|
||||
if ($skey === $sindex) {
|
||||
|
@ -102,14 +102,14 @@ class c {
|
|||
}
|
||||
const resolve = [self::class, "resolve"];
|
||||
|
||||
private static final function wend(?string $value): bool {
|
||||
private static function wend(?string $value): bool {
|
||||
return $value !== null && preg_match('/(\w|\w\.)$/', $value);
|
||||
}
|
||||
private static final function startw(?string $value): bool {
|
||||
private static function startw(?string $value): bool {
|
||||
return $value !== null && preg_match('/^\w/', $value);
|
||||
}
|
||||
|
||||
private static final function to_values($content, ?array &$values=null): void {
|
||||
private static function to_values($content, ?array &$values=null): void {
|
||||
$pvalue = cl::last($values);
|
||||
$wend = self::wend($pvalue);
|
||||
foreach ($content as $value) {
|
||||
|
|
|
@ -53,7 +53,7 @@ class mprop {
|
|||
return self::_set($c, $object, $property, $value, $method);
|
||||
}
|
||||
|
||||
private static final function _set(ReflectionClass $c, object $object, string $property, $value, ?string $method) {
|
||||
private static function _set(ReflectionClass $c, object $object, string $property, $value, ?string $method) {
|
||||
if ($method === null) $method = self::get_setter_name($property);
|
||||
try {
|
||||
$m = $c->getMethod($method);
|
||||
|
|
|
@ -267,7 +267,7 @@ class nur_func {
|
|||
const METHOD_PS = ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_STATIC;
|
||||
const METHOD_P = ReflectionMethod::IS_PUBLIC;
|
||||
|
||||
private static final function matches(string $name, array $includes, array $excludes): bool {
|
||||
private static function matches(string $name, array $includes, array $excludes): bool {
|
||||
if ($includes) {
|
||||
$matches = false;
|
||||
foreach ($includes as $include) {
|
||||
|
|
Loading…
Reference in New Issue