Skip to content

Commit

Permalink
Update to php-cs-fixer 3.58
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Nov 5, 2024
1 parent 7d4272d commit 5615c3f
Show file tree
Hide file tree
Showing 60 changed files with 231 additions and 237 deletions.
2 changes: 1 addition & 1 deletion bin/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
'init' => [],
'composerupdate' => [],
];
];

$default = 'buildzip';

Expand Down
2 changes: 1 addition & 1 deletion bin/migrateto20.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
echo "Reading all old vcards and populating etag and size fields.\n";
$result = $pdo->query('SELECT id, carddata FROM cards');
$stmt = $pdo->prepare('UPDATE cards SET etag = ?, size = ? WHERE id = ?');
while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$stmt->execute([
md5($row['carddata']),
strlen($row['carddata']),
Expand Down
8 changes: 4 additions & 4 deletions bin/migrateto21.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
$addUid = false;
try {
$result = $pdo->query('SELECT * FROM calendarobjects LIMIT 1');
$row = $result->fetch(\PDO::FETCH_ASSOC);
$row = $result->fetch(PDO::FETCH_ASSOC);

if (!$row) {
echo "No data in table. Going to try to add the uid field anyway.\n";
Expand Down Expand Up @@ -111,10 +111,10 @@
$stmt = $pdo->prepare('UPDATE calendarobjects SET uid = ? WHERE id = ?');
$counter = 0;

while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
try {
$vobj = \Sabre\VObject\Reader::read($row['calendardata']);
} catch (\Exception $e) {
$vobj = Sabre\VObject\Reader::read($row['calendardata']);
} catch (Exception $e) {
echo "Warning! Item with id $row[id] could not be parsed!\n";
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions bin/migrateto30.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
$addValueType = false;
try {
$result = $pdo->query('SELECT * FROM propertystorage LIMIT 1');
$row = $result->fetch(\PDO::FETCH_ASSOC);
$row = $result->fetch(PDO::FETCH_ASSOC);

if (!$row) {
echo "No data in table. Going to re-create the table.\n";
Expand Down Expand Up @@ -146,7 +146,7 @@
$result = $pdo->query('SELECT id, uri, vcardurl FROM principals WHERE vcardurl IS NOT NULL');
$stmt1 = $pdo->prepare('INSERT INTO propertystorage (path, name, valuetype, value) VALUES (?, ?, 3, ?)');

while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
// Inserting the new record
$stmt1->execute([
'addressbooks/'.basename($row['uri']),
Expand Down
4 changes: 2 additions & 2 deletions bin/migrateto32.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
$addValueType = false;
try {
$result = $pdo->query('SELECT * FROM calendarinstances LIMIT 1');
$result->fetch(\PDO::FETCH_ASSOC);
$result->fetch(PDO::FETCH_ASSOC);
echo "calendarinstances exists. Assuming this part of the migration has already been done.\n";
} catch (Exception $e) {
echo "calendarinstances does not yet exist. Creating table and migrating data.\n";
Expand Down Expand Up @@ -190,7 +190,7 @@
}
try {
$result = $pdo->query('SELECT * FROM calendars LIMIT 1');
$row = $result->fetch(\PDO::FETCH_ASSOC);
$row = $result->fetch(PDO::FETCH_ASSOC);

if (!$row) {
echo "Source table is empty.\n";
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"require-dev" : {
"ext-sqlite3": "*",
"friendsofphp/php-cs-fixer": "^3.40",
"friendsofphp/php-cs-fixer": "^3.58",
"monolog/monolog": "^2.9",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-phpunit": "^1.4",
Expand Down
2 changes: 1 addition & 1 deletion examples/addressbookserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// Setting up the directory tree //
$nodes = [
new Sabre\DAVACL\PrincipalCollection($principalBackend),
// new Sabre\CalDAV\CalendarRoot($authBackend, $caldavBackend),
// new Sabre\CalDAV\CalendarRoot($authBackend, $caldavBackend),
new Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
];

Expand Down
18 changes: 9 additions & 9 deletions examples/fileserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,34 @@
require_once 'vendor/autoload.php';

// Create the root node
$root = new \Sabre\DAV\FS\Directory($publicDir);
$root = new Sabre\DAV\FS\Directory($publicDir);

// The rootnode needs in turn to be passed to the server class
$server = new \Sabre\DAV\Server($root);
$server = new Sabre\DAV\Server($root);

if (isset($baseUri)) {
$server->setBaseUri($baseUri);
}

// Support for LOCK and UNLOCK
$lockBackend = new \Sabre\DAV\Locks\Backend\File($tmpDir.'/locksdb');
$lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
$lockBackend = new Sabre\DAV\Locks\Backend\File($tmpDir.'/locksdb');
$lockPlugin = new Sabre\DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);

// Support for html frontend
$browser = new \Sabre\DAV\Browser\Plugin();
$browser = new Sabre\DAV\Browser\Plugin();
$server->addPlugin($browser);

// Automatically guess (some) contenttypes, based on extension
$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
$server->addPlugin(new Sabre\DAV\Browser\GuessContentType());

// Authentication backend
$authBackend = new \Sabre\DAV\Auth\Backend\File('.htdigest');
$auth = new \Sabre\DAV\Auth\Plugin($authBackend);
$authBackend = new Sabre\DAV\Auth\Backend\File('.htdigest');
$auth = new Sabre\DAV\Auth\Plugin($authBackend);
$server->addPlugin($auth);

// Temporary file filter
$tempFF = new \Sabre\DAV\TemporaryFileFilterPlugin($tmpDir);
$tempFF = new Sabre\DAV\TemporaryFileFilterPlugin($tmpDir);
$server->addPlugin($tempFF);

// And off we go!
Expand Down
44 changes: 22 additions & 22 deletions examples/groupwareserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Feel free to switch this to MySQL, it will definitely be better for higher
* concurrency.
*/
$pdo = new \PDO('sqlite:data/db.sqlite');
$pdo = new PDO('sqlite:data/db.sqlite');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// Autoloader
Expand All @@ -44,16 +44,16 @@
* This allows any developer to subclass just any of them and hook into their
* own backend systems.
*/
$authBackend = new \Sabre\DAV\Auth\Backend\PDO($pdo);
$principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($pdo);
$carddavBackend = new \Sabre\CardDAV\Backend\PDO($pdo);
$caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo);
$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
$principalBackend = new Sabre\DAVACL\PrincipalBackend\PDO($pdo);
$carddavBackend = new Sabre\CardDAV\Backend\PDO($pdo);
$caldavBackend = new Sabre\CalDAV\Backend\PDO($pdo);

/**
* PSR-3 Logging facility.
*/
$logger = new \Monolog\Logger('SabreDav');
$logger->pushHandler(new \Monolog\Handler\RotatingFileHandler(__DIR__.'/sabredav.log', 3, \Monolog\Logger::DEBUG, true, 0600));
$logger = new Monolog\Logger('SabreDav');
$logger->pushHandler(new Monolog\Handler\RotatingFileHandler(__DIR__.'/sabredav.log', 3, Monolog\Logger::DEBUG, true, 0600));

/**
* The directory tree.
Expand All @@ -63,15 +63,15 @@
*/
$nodes = [
// /principals
new \Sabre\CalDAV\Principal\Collection($principalBackend),
new Sabre\CalDAV\Principal\Collection($principalBackend),
// /calendars
new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend),
new Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend),
// /addressbook
new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
new Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
];

// The object tree needs in turn to be passed to the server class
$server = new \Sabre\DAV\Server($nodes);
$server = new Sabre\DAV\Server($nodes);
if (isset($baseUri)) {
$server->setBaseUri($baseUri);
}
Expand All @@ -81,21 +81,21 @@
// $server->debugExceptions = true; //enable this to include the stacktrace in exception responses

// Plugins
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new \Sabre\DAV\Browser\Plugin());
$server->addPlugin(new \Sabre\DAV\Sync\Plugin());
$server->addPlugin(new \Sabre\DAV\Sharing\Plugin());
$server->addPlugin(new \Sabre\DAVACL\Plugin());
$server->addPlugin(new Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new Sabre\DAV\Browser\Plugin());
$server->addPlugin(new Sabre\DAV\Sync\Plugin());
$server->addPlugin(new Sabre\DAV\Sharing\Plugin());
$server->addPlugin(new Sabre\DAVACL\Plugin());

// CalDAV plugins
$server->addPlugin(new \Sabre\CalDAV\Plugin());
$server->addPlugin(new \Sabre\CalDAV\Schedule\Plugin());
$server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
$server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
$server->addPlugin(new Sabre\CalDAV\Plugin());
$server->addPlugin(new Sabre\CalDAV\Schedule\Plugin());
$server->addPlugin(new Sabre\CalDAV\SharingPlugin());
$server->addPlugin(new Sabre\CalDAV\ICSExportPlugin());

// CardDAV plugins
$server->addPlugin(new \Sabre\CardDAV\Plugin());
$server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
$server->addPlugin(new Sabre\CardDAV\Plugin());
$server->addPlugin(new Sabre\CardDAV\VCFExportPlugin());

// And off we go!
$server->start();
20 changes: 10 additions & 10 deletions lib/CalDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function getCalendarsForUser($principalUri)

// read-only is for backwards compatibility. Might go away in
// the future.
$calendar['read-only'] = \Sabre\DAV\Sharing\Plugin::ACCESS_READ === (int) $row['access'];
$calendar['read-only'] = DAV\Sharing\Plugin::ACCESS_READ === (int) $row['access'];
}

foreach ($this->propertyMap as $xmlName => $dbName) {
Expand Down Expand Up @@ -341,7 +341,7 @@ public function deleteCalendar($calendarId)
$stmt->execute([$instanceId]);
$access = (int) $stmt->fetchColumn();

if (\Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $access) {
if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $access) {
/**
* If the user is the owner of the calendar, we delete all data and all
* instances.
Expand Down Expand Up @@ -461,7 +461,7 @@ public function getCalendarObject($calendarId, $objectUri)
'size' => (int) $row['size'],
'calendardata' => $row['calendardata'],
'component' => strtolower($row['componenttype']),
];
];
}

/**
Expand Down Expand Up @@ -619,7 +619,7 @@ protected function getDenormalizedData($calendarData)
}
}
if (!$componentType) {
throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
throw new DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
}
if ('VEVENT' === $componentType) {
$firstOccurence = $component->DTSTART->getDateTime()->getTimeStamp();
Expand Down Expand Up @@ -1234,7 +1234,7 @@ public function getSchedulingObject($principalUri, $objectUri)
'lastmodified' => $row['lastmodified'],
'etag' => '"'.$row['etag'].'"',
'size' => (int) $row['size'],
];
];
}

/**
Expand Down Expand Up @@ -1348,7 +1348,7 @@ public function updateInvites($calendarId, array $sharees)
FROM '.$this->calendarInstancesTableName.' WHERE id = ?');

foreach ($sharees as $sharee) {
if (\Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS === $sharee->access) {
if (DAV\Sharing\Plugin::ACCESS_NOACCESS === $sharee->access) {
// if access was set no NOACCESS, it means access for an
// existing sharee was removed.
$removeStmt->execute([$calendarId, $sharee->href]);
Expand All @@ -1358,11 +1358,11 @@ public function updateInvites($calendarId, array $sharees)
if (is_null($sharee->principal)) {
// If the server could not determine the principal automatically,
// we will mark the invite status as invalid.
$sharee->inviteStatus = \Sabre\DAV\Sharing\Plugin::INVITE_INVALID;
$sharee->inviteStatus = DAV\Sharing\Plugin::INVITE_INVALID;
} else {
// Because sabre/dav does not yet have an invitation system,
// every invite is automatically accepted for now.
$sharee->inviteStatus = \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED;
$sharee->inviteStatus = DAV\Sharing\Plugin::INVITE_ACCEPTED;
}

foreach ($currentInvites as $oldSharee) {
Expand All @@ -1387,10 +1387,10 @@ public function updateInvites($calendarId, array $sharees)
$calendarId,
$sharee->principal,
$sharee->access,
\Sabre\DAV\UUIDUtil::getUUID(),
DAV\UUIDUtil::getUUID(),
$sharee->href,
isset($sharee->properties['{DAV:}displayname']) ? $sharee->properties['{DAV:}displayname'] : null,
$sharee->inviteStatus ?: \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE,
$sharee->inviteStatus ?: DAV\Sharing\Plugin::INVITE_NORESPONSE,
$instanceId,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/CalDAV/Backend/SimplePDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function getCalendarObject($calendarId, $objectUri)
'calendarid' => $calendarId,
'size' => strlen($row['calendardata']),
'calendardata' => $row['calendardata'],
];
];
}

/**
Expand Down
2 changes: 0 additions & 2 deletions lib/CalDAV/Backend/SubscriptionSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ public function createSubscription($principalUri, $uri, array $properties);
* promise I can handle updating this property".
*
* Read the PropPatch documentation for more info and examples.
*
* @param \Sabre\DAV\PropPatch $propPatch
*/
public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch);

Expand Down
2 changes: 1 addition & 1 deletion lib/CalDAV/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function getProperties($requestedProperties)
*
* @param string $name
*
* @return \Sabre\CalDAV\ICalendarObject
* @return ICalendarObject
*/
public function getChild($name)
{
Expand Down
4 changes: 1 addition & 3 deletions lib/CalDAV/ICSExportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ class ICSExportPlugin extends DAV\ServerPlugin
/**
* Reference to Server class.
*
* @var \Sabre\DAV\Server
* @var DAV\Server
*/
protected $server;

/**
* Initializes the plugin and registers event handlers.
*
* @param \Sabre\DAV\Server $server
*/
public function initialize(DAV\Server $server)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/CalDAV/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function httpMkCalendar(RequestInterface $request, ResponseInterface $res
* resource are fetched. This allows us to add in any CalDAV specific
* properties.
*/
public function propFind(DAV\PropFind $propFind, DAV\INode $node)
public function propFind(DAV\PropFind $propFind, INode $node)
{
$ns = '{'.self::NS_CALDAV.'}';

Expand Down Expand Up @@ -932,7 +932,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege
*
* @return bool
*/
public function htmlActionsPanel(DAV\INode $node, &$output)
public function htmlActionsPanel(INode $node, &$output)
{
if (!$node instanceof CalendarHome) {
return;
Expand Down
Loading

0 comments on commit 5615c3f

Please sign in to comment.