Qual: Update PHP-CS-Fixer configuration and DolibarrModules class
- Update PHP-CS-Fixer configuration to replace deprecated 'visibility_required' rule with 'modifier_keywords' - Update DolibarrModules class to use const instead of public const for PHP 7.0 compatibility (revert recent change)
This commit is contained in:
parent
8bcf8d472a
commit
0333daa8a8
2 changed files with 30 additions and 26 deletions
|
|
@ -1,20 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||||
|
*/
|
||||||
|
|
||||||
/* PHP 7.0 */
|
/* PHP 7.0 */
|
||||||
$finder = (new PhpCsFixer\Finder())
|
$finder = (new PhpCsFixer\Finder())
|
||||||
->in(__DIR__)
|
->in(__DIR__)
|
||||||
->exclude([
|
->exclude([
|
||||||
'core/includes',
|
'core/includes',
|
||||||
'custom',
|
'custom',
|
||||||
'documents',
|
'documents',
|
||||||
'doctemplates',
|
'doctemplates',
|
||||||
'vendor',
|
'vendor',
|
||||||
'install/doctemplates',
|
'install/doctemplates',
|
||||||
'htdocs/custom',
|
'htdocs/custom',
|
||||||
'htdocs/includes',
|
'htdocs/includes',
|
||||||
'htdocs/install/doctemplates',
|
'htdocs/install/doctemplates',
|
||||||
])
|
])
|
||||||
->notPath('vendor');
|
->notPath('vendor');
|
||||||
|
|
||||||
|
|
||||||
/* PHP 7.4+ */
|
/* PHP 7.4+ */
|
||||||
|
|
@ -43,8 +45,11 @@ return (new PhpCsFixer\Config())
|
||||||
// So we use target PHP70 for the moment.
|
// So we use target PHP70 for the moment.
|
||||||
'@PHP70Migration' => true,
|
'@PHP70Migration' => true,
|
||||||
//'@PHP71Migration' => true,
|
//'@PHP71Migration' => true,
|
||||||
// Avoid adding public to const (incompatible with PHP 7.0):
|
// Avoid adding public to const (incompatible with PHP 7.0):
|
||||||
'visibility_required' => ['elements'=>['property', 'method']],
|
'visibility_required' => ['elements' => ['property', 'method']],
|
||||||
|
// Replace deprecated 'visibility_required'
|
||||||
|
'modifier_keywords' => ['elements' => ['property', 'method']],
|
||||||
|
|
||||||
|
|
||||||
//'strict_param' => true,
|
//'strict_param' => true,
|
||||||
//'array_syntax' => ['syntax' => 'short'],
|
//'array_syntax' => ['syntax' => 'short'],
|
||||||
|
|
@ -59,5 +64,4 @@ return (new PhpCsFixer\Config())
|
||||||
->setIndent("\t")
|
->setIndent("\t")
|
||||||
// All files MUST use the Unix LF line ending only
|
// All files MUST use the Unix LF line ending only
|
||||||
// https://www.php-fig.org/psr/psr-12/#22-files
|
// https://www.php-fig.org/psr/psr-12/#22-files
|
||||||
->setLineEnding("\n")
|
->setLineEnding("\n");
|
||||||
;
|
|
||||||
|
|
|
||||||
|
|
@ -139,16 +139,16 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||||
*/
|
*/
|
||||||
public $rights_class;
|
public $rights_class;
|
||||||
|
|
||||||
public const URL_FOR_BLACKLISTED_MODULES = 'https://ping.dolibarr.org/modules-blacklist.txt';
|
const URL_FOR_BLACKLISTED_MODULES = 'https://ping.dolibarr.org/modules-blacklist.txt';
|
||||||
|
|
||||||
public const KEY_ID = 0;
|
const KEY_ID = 0;
|
||||||
public const KEY_LABEL = 1;
|
const KEY_LABEL = 1;
|
||||||
public const KEY_TYPE = 2; // deprecated
|
const KEY_TYPE = 2; // deprecated
|
||||||
public const KEY_DEFAULT = 3;
|
const KEY_DEFAULT = 3;
|
||||||
public const KEY_FIRST_LEVEL = 4;
|
const KEY_FIRST_LEVEL = 4;
|
||||||
public const KEY_SECOND_LEVEL = 5;
|
const KEY_SECOND_LEVEL = 5;
|
||||||
public const KEY_MODULE = 6;
|
const KEY_MODULE = 6;
|
||||||
public const KEY_ENABLED = 7;
|
const KEY_ENABLED = 7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array<array{commentgroup?:string,mainmenu:string,leftmenu:string,langs:string,enabled:int|string,target:string,titre:string,user:int,fk_menu:string,fk_parent:string,url:string,position:int,positionfull:int|string,perms:string,type:string}>|int<1,1> Module menu entries (1 means the menu entries are not declared into module descriptor but are hardcoded into menu manager)
|
* @var array<array{commentgroup?:string,mainmenu:string,leftmenu:string,langs:string,enabled:int|string,target:string,titre:string,user:int,fk_menu:string,fk_parent:string,url:string,position:int,positionfull:int|string,perms:string,type:string}>|int<1,1> Module menu entries (1 means the menu entries are not declared into module descriptor but are hardcoded into menu manager)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue