Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update friendsofphp/php-cs-fixer requirement from ^2.19 to ^3.40 #1520

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ bin/vobject
bin/generate_vcards
bin/phpdocmd

# Assuming every .php file in the root is for testing
/*.php

# Other testing stuff
/tmpdata
/data
Expand All @@ -37,4 +34,4 @@ build.properties
docs/api
docs/wikidocs

.php_cs.cache
.php-cs-fixer.cache
13 changes: 13 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$config = new PhpCsFixer\Config();
$config->getFinder()
->exclude('vendor')
->in(__DIR__);
$config->setRules([
'@PSR1' => true,
'@Symfony' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true]
]);

return $config;
12 changes: 0 additions & 12 deletions .php_cs.dist

This file was deleted.

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
4 changes: 2 additions & 2 deletions bin/migrateto20.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

HELLO;

exit();
exit;
}

// There's a bunch of places where the autoloader could be, so we'll try all of
Expand Down 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
10 changes: 5 additions & 5 deletions bin/migrateto21.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

HELLO;

exit();
exit;
}

// There's a bunch of places where the autoloader could be, so we'll try all of
Expand Down 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)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the leading \ removed? Is the speed benefit on lookup no longer of interest? 😕

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
6 changes: 3 additions & 3 deletions bin/migrateto30.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

HELLO;

exit();
exit;
}

// There's a bunch of places where the autoloader could be, so we'll try all of
Expand Down 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
14 changes: 7 additions & 7 deletions bin/migrateto32.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

HELLO;

exit();
exit;
}

// There's a bunch of places where the autoloader could be, so we'll try all of
Expand Down 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 @@ -110,7 +110,7 @@
UNIQUE(calendarid, share_href)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
SQL
);
);
$pdo->exec('
INSERT INTO calendarinstances
(
Expand Down Expand Up @@ -159,7 +159,7 @@
UNIQUE (calendarid, share_href)
);
SQL
);
);
$pdo->exec('
INSERT INTO calendarinstances
(
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 Expand Up @@ -233,7 +233,7 @@
components VARBINARY(21)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SQL
);
);
break;
case 'sqlite':
$pdo->exec(<<<SQL
Expand All @@ -243,7 +243,7 @@
components text NOT NULL
);
SQL
);
);
break;
}

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": "^2.19",
"friendsofphp/php-cs-fixer": "^3.58",
"monolog/monolog": "^2.9",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-phpunit": "^1.4",
Expand Down
6 changes: 3 additions & 3 deletions examples/addressbookserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
$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);
// $caldavBackend = new Sabre\CalDAV\Backend\PDO($pdo);

// 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 All @@ -42,7 +42,7 @@
// Plugins
$server->addPlugin(new Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new Sabre\DAV\Browser\Plugin());
//$server->addPlugin(new Sabre\CalDAV\Plugin());
// $server->addPlugin(new Sabre\CalDAV\Plugin());
$server->addPlugin(new Sabre\CardDAV\Plugin());
$server->addPlugin(new Sabre\DAVACL\Plugin());
$server->addPlugin(new Sabre\DAV\Sync\Plugin());
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
46 changes: 23 additions & 23 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,39 +63,39 @@
*/
$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);
}

// Logging
$server->setLogger($logger);
//$server->debugExceptions = true; //enable this to include the stacktrace in exception responses
// $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();
6 changes: 0 additions & 6 deletions lib/CalDAV/Backend/AbstractBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ abstract class AbstractBackend implements BackendInterface
* promise I can handle updating this property".
*
* Read the PropPatch documentation for more info and examples.
*
* @param mixed $calendarId
*/
public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
{
Expand All @@ -44,8 +42,6 @@ public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
*
* If the backend supports this, it may allow for some speed-ups.
*
* @param mixed $calendarId
*
* @return array
*/
public function getMultipleCalendarObjects($calendarId, array $uris)
Expand Down Expand Up @@ -100,8 +96,6 @@ public function getMultipleCalendarObjects($calendarId, array $uris)
* as possible, so it gives you a good idea on what type of stuff you need
* to think of.
*
* @param mixed $calendarId
*
* @return array
*/
public function calendarQuery($calendarId, array $filters)
Expand Down