Merge pull request #1229 from sabre-io/dependabot/composer/friendsofphp/php-cs-fixer-3.45.0

Update friendsofphp/php-cs-fixer requirement from 3.3.2 to 3.45.0
This commit is contained in:
ByteHamster 2024-02-04 21:37:14 +01:00 committed by GitHub
commit bca95f4817
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 71 additions and 67 deletions

View file

@ -12,12 +12,12 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0'] php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
cs-fixer: [ true ] cs-fixer: [ true ]
include: include:
- php-versions: '8.1' - php-versions: '7.2'
cs-fixer: false cs-fixer: false
- php-versions: '8.2' - php-versions: '7.3'
cs-fixer: false cs-fixer: false
steps: steps:
- name: Checkout - name: Checkout

View file

@ -8,12 +8,16 @@ $config->setRules([
'@PSR2' => true, '@PSR2' => true,
'@Symfony' => true, '@Symfony' => true,
'binary_operator_spaces' => [], 'binary_operator_spaces' => [],
'braces' => ['position_after_functions_and_oop_constructs' => 'same'], 'braces_position' => [
'functions_opening_brace' => 'same_line',
'classes_opening_brace' => 'same_line'],
'concat_space' => ['spacing' => 'one'], 'concat_space' => ['spacing' => 'one'],
'fully_qualified_strict_types' => false,
'no_superfluous_phpdoc_tags' => false, 'no_superfluous_phpdoc_tags' => false,
'no_unneeded_control_parentheses' => false, 'no_unneeded_control_parentheses' => false,
'phpdoc_align' => false, 'phpdoc_align' => false,
'single_line_comment_style' => false, 'single_line_comment_style' => false,
'single_line_comment_spacing' => false,
'single_quote' => false, 'single_quote' => false,
'trailing_comma_in_multiline' => true, 'trailing_comma_in_multiline' => true,
'visibility_required' => false, 'visibility_required' => false,

View file

@ -27,7 +27,6 @@
namespace Baikal\Core; namespace Baikal\Core;
use PDO;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
/** /**
@ -71,7 +70,7 @@ class Server {
/** /**
* Reference to Database object. * Reference to Database object.
* *
* @var PDO * @var \PDO
*/ */
protected $pdo; protected $pdo;
@ -96,10 +95,10 @@ class Server {
* @param bool $enableCardDAV * @param bool $enableCardDAV
* @param string $authType * @param string $authType
* @param string $authRealm * @param string $authRealm
* @param PDO $pdo * @param \PDO $pdo
* @param string $baseUri * @param string $baseUri
*/ */
function __construct($enableCalDAV, $enableCardDAV, $authType, $authRealm, PDO $pdo, $baseUri) { function __construct($enableCalDAV, $enableCardDAV, $authType, $authRealm, \PDO $pdo, $baseUri) {
$this->enableCalDAV = $enableCalDAV; $this->enableCalDAV = $enableCalDAV;
$this->enableCardDAV = $enableCardDAV; $this->enableCardDAV = $enableCardDAV;
$this->authType = $authType; $this->authType = $authType;

View file

@ -246,7 +246,7 @@ class Calendar extends \Flake\Core\Model\Db {
$rSql = $GLOBALS["DB"]->exec_SELECTquery( $rSql = $GLOBALS["DB"]->exec_SELECTquery(
"count(*)", "count(*)",
"calendarinstances", "calendarinstances",
"calendarid" . "='" . $this->aData["calendarid"] . "'" "calendarid='" . $this->aData["calendarid"] . "'"
); );
if (($aRs = $rSql->fetch()) === false) { if (($aRs = $rSql->fetch()) === false) {

View file

@ -40,7 +40,7 @@ class Calendar extends \Flake\Core\Model\Db {
$rSql = $GLOBALS["DB"]->exec_SELECTquery( $rSql = $GLOBALS["DB"]->exec_SELECTquery(
"count(*)", "count(*)",
"calendarinstances", "calendarinstances",
"calendarid" . "='" . $this->aData["id"] . "'" "calendarid='" . $this->aData["id"] . "'"
); );
if (($aRs = $rSql->fetch()) === false) { if (($aRs = $rSql->fetch()) === false) {

View file

@ -68,9 +68,9 @@ abstract class Config extends \Flake\Core\Model\NoDb {
function writable() { function writable() {
return ( return (
@file_exists(PROJECT_PATH_CONFIG . "baikal.yaml") && @file_exists(PROJECT_PATH_CONFIG . "baikal.yaml")
@is_file(PROJECT_PATH_CONFIG . "baikal.yaml") && && @is_file(PROJECT_PATH_CONFIG . "baikal.yaml")
@is_writable(PROJECT_PATH_CONFIG . "baikal.yaml") && @is_writable(PROJECT_PATH_CONFIG . "baikal.yaml")
); );
} }

View file

@ -39,7 +39,7 @@ class User extends \Flake\Core\Model\Db {
"digesta1" => "", "digesta1" => "",
]; ];
protected $oIdentityPrincipal = null; protected $oIdentityPrincipal;
function initByPrimary($sPrimary) { function initByPrimary($sPrimary) {
parent::initByPrimary($sPrimary); parent::initByPrimary($sPrimary);

View file

@ -108,7 +108,7 @@ class Initialize extends \Flake\Core\Controller {
exit(0); exit(0);
#$sMessage = "<p>Baïkal is now configured. You may <a class='btn btn-success' href='" . PROJECT_URI . "admin/'>Access the Baïkal admin</a></p>"; #$sMessage = "<p>Baïkal is now configured. You may <a class='btn btn-success' href='" . PROJECT_URI . "admin/'>Access the Baïkal admin</a></p>";
#$sForm = ""; #$sForm = "";
} else { } else {
$sMessage = ""; $sMessage = "";
$sForm = $this->oForm->render(); $sForm = $this->oForm->render();

View file

@ -387,7 +387,7 @@ CREATE TABLE calendarinstances (
UNIQUE (calendarid, share_href) UNIQUE (calendarid, share_href)
); );
SQL SQL
); );
$this->aSuccess[] = 'Created calendarinstances table'; $this->aSuccess[] = 'Created calendarinstances table';
$pdo->exec(' $pdo->exec('
INSERT INTO calendarinstances INSERT INTO calendarinstances
@ -426,7 +426,7 @@ CREATE TABLE calendars (
components text NOT NULL components text NOT NULL
); );
SQL SQL
); );
$this->aSuccess[] = 'Created new calendars table'; $this->aSuccess[] = 'Created new calendars table';
} else { // mysql } else { // mysql
$pdo->exec(<<<SQL $pdo->exec(<<<SQL
@ -450,7 +450,7 @@ CREATE TABLE calendarinstances (
UNIQUE(calendarid, share_href) UNIQUE(calendarid, share_href)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
SQL SQL
); );
$this->aSuccess[] = 'Created calendarinstances table'; $this->aSuccess[] = 'Created calendarinstances table';
$pdo->exec(' $pdo->exec('
INSERT INTO calendarinstances INSERT INTO calendarinstances
@ -489,14 +489,14 @@ CREATE TABLE calendars (
components VARBINARY(21) components VARBINARY(21)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SQL SQL
); );
$this->aSuccess[] = 'Created new calendars table'; $this->aSuccess[] = 'Created new calendars table';
} }
$pdo->exec(<<<SQL $pdo->exec(<<<SQL
INSERT INTO calendars (id, synctoken, components) SELECT id, COALESCE(synctoken,1) as synctoken, COALESCE(components,"VEVENT,VTODO,VJOURNAL") as components FROM $calendarBackup INSERT INTO calendars (id, synctoken, components) SELECT id, COALESCE(synctoken,1) as synctoken, COALESCE(components,"VEVENT,VTODO,VJOURNAL") as components FROM $calendarBackup
SQL SQL
); );
$this->aSuccess[] = 'Migrated calendars table'; $this->aSuccess[] = 'Migrated calendars table';
} }
if (version_compare($sVersionFrom, '0.9.4', '<')) { if (version_compare($sVersionFrom, '0.9.4', '<')) {

View file

@ -48,9 +48,9 @@ class Topbar extends \Flake\Core\Controller {
$sActiveHome = "active"; $sActiveHome = "active";
} }
if ( if (
$sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\Users") || $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\Users")
$sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\Calendars") || || $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\Calendars")
$sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\AddressBooks") || $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\AddressBooks")
) { ) {
$sActiveUsers = "active"; $sActiveUsers = "active";
} }

View file

@ -171,8 +171,8 @@ class Database extends \Flake\Core\Controller {
} catch (\Exception $e) { } catch (\Exception $e) {
$oForm->declareError( $oForm->declareError(
$oMorpho->element("sqlite_file"), $oMorpho->element("sqlite_file"),
"Baïkal was not able to establish a connexion to the SQLite database as configured.<br />SQLite says: " . $e->getMessage() . (string) $e "Baïkal was not able to establish a connexion to the SQLite database as configured.<br />SQLite says: " . $e->getMessage() . (string) $e
); );
} }
} }
} }

View file

@ -456,7 +456,7 @@ CSS;
CSS; CSS;
} }
$sCss = "\n" . "/* " . count($aSprites) . " glyphs, generated on " . strftime("%Y-%m-%d %H:%M:%S") . "; C=" . $iCols . "; R=" . $iRows . "; W=" . $iPngWidth . "; H=" . $iPngHeight . "; PREFIX=" . $sClassPrefix . " */\n" . $sCss; $sCss = "\n/* " . count($aSprites) . " glyphs, generated on " . strftime("%Y-%m-%d %H:%M:%S") . "; C=" . $iCols . "; R=" . $iRows . "; W=" . $iPngWidth . "; H=" . $iPngHeight . "; PREFIX=" . $sClassPrefix . " */\n" . $sCss;
return $sCss; return $sCss;
} }

View file

@ -90,9 +90,9 @@ class Cli extends \Flake\Core\Render\Container {
function header($sMsg) { function header($sMsg) {
$sStr = "\n" . str_repeat("#", 80); $sStr = "\n" . str_repeat("#", 80);
$sStr .= "\n" . "#" . str_repeat(" ", 78) . "#"; $sStr .= "\n#" . str_repeat(" ", 78) . "#";
$sStr .= "\n" . "#" . str_pad(strtoupper($sMsg), 78, " ", STR_PAD_BOTH) . "#"; $sStr .= "\n#" . str_pad(strtoupper($sMsg), 78, " ", STR_PAD_BOTH) . "#";
$sStr .= "\n" . "#" . str_repeat(" ", 78) . "#"; $sStr .= "\n#" . str_repeat(" ", 78) . "#";
$sStr .= "\n" . str_repeat("#", 80); $sStr .= "\n" . str_repeat("#", 80);
$sStr .= "\n"; $sStr .= "\n";

View file

@ -175,14 +175,14 @@ class Collection extends \Flake\Core\FLObject implements \Iterator {
function &__call($sName, $aArguments) { function &__call($sName, $aArguments) {
if ( if (
strlen($sName) > 7 && strlen($sName) > 7
$sName[0] === "s" && && $sName[0] === "s"
$sName[1] === "e" && && $sName[1] === "e"
$sName[2] === "t" && && $sName[2] === "t"
$sName[3] === "M" && && $sName[3] === "M"
$sName[4] === "e" && && $sName[4] === "e"
$sName[5] === "t" && && $sName[5] === "t"
$sName[6] === "a" && $sName[6] === "a"
) { ) {
$sKey = strtolower(substr($sName, 7, 1)) . substr($sName, 8); $sKey = strtolower(substr($sName, 7, 1)) . substr($sName, 8);
$mValue = &$aArguments[0]; $mValue = &$aArguments[0];
@ -199,14 +199,14 @@ class Collection extends \Flake\Core\FLObject implements \Iterator {
return $res; # To avoid 'Notice: Only variable references should be returned by reference' return $res; # To avoid 'Notice: Only variable references should be returned by reference'
} elseif ( } elseif (
strlen($sName) > 7 && strlen($sName) > 7
$sName[0] === "g" && && $sName[0] === "g"
$sName[1] === "e" && && $sName[1] === "e"
$sName[2] === "t" && && $sName[2] === "t"
$sName[3] === "M" && && $sName[3] === "M"
$sName[4] === "e" && && $sName[4] === "e"
$sName[5] === "t" && && $sName[5] === "t"
$sName[6] === "a" && $sName[6] === "a"
) { ) {
$sKey = strtolower(substr($sName, 7, 1)) . substr($sName, 8); $sKey = strtolower(substr($sName, 7, 1)) . substr($sName, 8);
if (array_key_exists($sKey, $this->aMeta)) { if (array_key_exists($sKey, $this->aMeta)) {

View file

@ -46,6 +46,7 @@ abstract class Controller extends \Flake\Core\FLObject {
# TODO: il faut remplacer le mécanisme basé sur un nombre variable de paramètres en un mécanisme basé sur un seul paramètre "tableau" # TODO: il faut remplacer le mécanisme basé sur un nombre variable de paramètres en un mécanisme basé sur un seul paramètre "tableau"
#$aParams = func_get_args(); #$aParams = func_get_args();
$sController = "\\" . get_called_class(); $sController = "\\" . get_called_class();
#array_unshift($aParams, $sController); # Injecting current controller as first param #array_unshift($aParams, $sController); # Injecting current controller as first param
#return call_user_func_array($GLOBALS["ROUTER"] . "::buildRouteForController", $aParams); #return call_user_func_array($GLOBALS["ROUTER"] . "::buildRouteForController", $aParams);
return $GLOBALS["ROUTER"]::buildRouteForController($sController, $aParams); return $GLOBALS["ROUTER"]::buildRouteForController($sController, $aParams);

View file

@ -28,7 +28,7 @@
namespace Flake\Core\Database; namespace Flake\Core\Database;
class Statement extends \Flake\Core\FLObject { class Statement extends \Flake\Core\FLObject {
protected $stmt = null; protected $stmt;
function __construct($stmt) { function __construct($stmt) {
$this->stmt = $stmt; $this->stmt = $stmt;

View file

@ -28,8 +28,8 @@
namespace Flake\Core\Datastructure; namespace Flake\Core\Datastructure;
abstract class ChainLink implements \Flake\Core\Datastructure\Chainable { abstract class ChainLink implements \Flake\Core\Datastructure\Chainable {
protected $__container = null; protected $__container;
protected $__key = null; protected $__key;
function chain(Chain $container, $key) { function chain(Chain $container, $key) {
$this->__container = $container; $this->__container = $container;

View file

@ -211,7 +211,7 @@ class Framework extends \Flake\Core\Framework {
if (isset($config["system"]["base_uri"]) && $config["system"]["base_uri"] !== "") { if (isset($config["system"]["base_uri"]) && $config["system"]["base_uri"] !== "") {
// SabreDAV needs a "/" at the beginning of BASEURL // SabreDAV needs a "/" at the beginning of BASEURL
define("PROJECT_BASEURI", define("PROJECT_BASEURI",
self::prependSlash(self::appendSlash($config["system"]["base_uri"]))); self::prependSlash(self::appendSlash($config["system"]["base_uri"])));
define("PROJECT_URI", \Flake\Util\Tools::getCurrentProtocol() . "://" define("PROJECT_URI", \Flake\Util\Tools::getCurrentProtocol() . "://"
. $_SERVER["HTTP_HOST"] . PROJECT_BASEURI); . $_SERVER["HTTP_HOST"] . PROJECT_BASEURI);

View file

@ -342,10 +342,10 @@ class Tools extends \Flake\Core\FLObject {
</html> </html>
TEST; TEST;
$sHeaders = "From: " . $sFromName . "<" . $sFromAddress . ">" . "\r\n"; $sHeaders = "From: " . $sFromName . "<" . $sFromAddress . ">\r\n";
$sHeaders .= "Reply-To: " . $sReplyToName . "<" . $sReplyToAddress . ">" . "\r\n"; $sHeaders .= "Reply-To: " . $sReplyToName . "<" . $sReplyToAddress . ">\r\n";
$sHeaders .= "Bcc: " . $sReplyToName . "<" . $sReplyToAddress . ">" . "\r\n"; $sHeaders .= "Bcc: " . $sReplyToName . "<" . $sReplyToAddress . ">\r\n";
$sHeaders .= "Content-Type: text/html" . "\r\n"; $sHeaders .= "Content-Type: text/html\r\n";
mail($sToAddress, $sSubject, $sMessage, $sHeaders); mail($sToAddress, $sSubject, $sMessage, $sHeaders);
} }
@ -761,14 +761,14 @@ TEST;
$data = ""; $data = "";
if ($bodylen > 0) { if ($bodylen > 0) {
switch ($method) { switch ($method) {
case 8: case 8:
// Currently the only supported compression method: // Currently the only supported compression method:
$data = gzinflate($body, $maxlength); $data = gzinflate($body, $maxlength);
break; break;
default: default:
$error = "Unknown compression method."; $error = "Unknown compression method.";
return false; return false;
} }
} // zero-byte body content is allowed } // zero-byte body content is allowed
// Verifiy CRC32 // Verifiy CRC32

View file

@ -38,15 +38,15 @@ class Form {
"hook.validation" => false, "hook.validation" => false,
"hook.morphology" => false, "hook.morphology" => false,
]; ];
protected $oModelInstance = null; protected $oModelInstance;
protected $oElements = null; protected $oElements;
protected $aErrors = []; protected $aErrors = [];
protected $bPersisted = null; # TRUE when form has persisted; available only after execute protected $bPersisted; # TRUE when form has persisted; available only after execute
protected $sDisplayTitle = ""; # Displayed form title; generated in setModelInstance() protected $sDisplayTitle = ""; # Displayed form title; generated in setModelInstance()
protected $sDisplayMessage = ""; # Displayed confirm message; generated in execute() protected $sDisplayMessage = ""; # Displayed confirm message; generated in execute()
protected $oMorpho = null; protected $oMorpho;
function __construct($sModelClass, $aOptions = []) { function __construct($sModelClass, $aOptions = []) {
$this->sModelClass = $sModelClass; $this->sModelClass = $sModelClass;

View file

@ -28,7 +28,7 @@
namespace Formal\Form; namespace Formal\Form;
class Morphology { class Morphology {
protected $oElements = null; protected $oElements;
function __construct() { function __construct() {
$this->oElements = new \Flake\Core\CollectionTyped("\Formal\Element"); $this->oElements = new \Flake\Core\CollectionTyped("\Formal\Element");

View file

@ -17,8 +17,8 @@
"ext-zlib" : "*" "ext-zlib" : "*"
}, },
"require-dev" : { "require-dev" : {
"friendsofphp/php-cs-fixer": "3.3.2", "friendsofphp/php-cs-fixer": "3.45.0",
"phpstan/phpstan": "^1.2" "phpstan/phpstan": "^1.10"
}, },
"replace" : { "replace" : {
"jeromeschneider/baikal" : "self.version" "jeromeschneider/baikal" : "self.version"