Skip to content

Commit

Permalink
Merge pull request #1316 from phil-davis/latest-php-cs-fixer-2.17.1
Browse files Browse the repository at this point in the history
Latest php cs fixer 2.17.1
  • Loading branch information
phil-davis authored Dec 13, 2020
2 parents d596e2b + 7c80064 commit d385f9b
Show file tree
Hide file tree
Showing 26 changed files with 33 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ matrix:
include:
- name: 'PHP8'
dist: bionic
php: nightly
php: 8.0
env:
- RUN_PHPCSFIXER="FALSE"
- REPORT_COVERAGE="FALSE"
Expand Down
8 changes: 4 additions & 4 deletions bin/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

if (!isset($tasks[$currentTask])) {
echo 'Task not found: ', $currentTask, "\n";
die(1);
exit(1);
}

// Creating the dependency graph
Expand All @@ -43,7 +43,7 @@
foreach ($oldTaskList as $task => $foo) {
if (!isset($tasks[$task])) {
echo 'Dependency not found: '.$task, "\n";
die(1);
exit(1);
}
$dependencies = $tasks[$task];

Expand Down Expand Up @@ -107,7 +107,7 @@ function test()
system(__DIR__.'/phpunit --configuration '.$baseDir.'/tests/phpunit.xml.dist --stop-on-failure', $code);
if (0 != $code) {
echo "PHPUnit reported error code $code\n";
die(1);
exit(1);
}
}

Expand Down Expand Up @@ -139,7 +139,7 @@ function buildzip()
system('cd build/SabreDAV; composer install -n', $code);
if (0 !== $code) {
echo "Composer reported error code $code\n";
die(1);
exit(1);
}

echo " Removing pointless files\n";
Expand Down
5 changes: 1 addition & 4 deletions bin/migrateto20.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
break;
default:
echo 'Error: unsupported driver: '.$driver."\n";
die(-1);
exit(-1);
}

foreach (['calendar', 'addressbook'] as $itemType) {
Expand Down Expand Up @@ -130,7 +130,6 @@
break;

case 'sqlite':

$pdo->exec("ALTER TABLE $tableName RENAME TO $tableNameOld");

switch ($itemType) {
Expand Down Expand Up @@ -370,7 +369,6 @@
break;

case 'sqlite':

$pdo->exec('
CREATE TABLE cards (
id integer primary key asc,
Expand All @@ -395,7 +393,6 @@
break;

case 'sqlite':

$pdo->exec('
ALTER TABLE cards ADD etag text;
ALTER TABLE cards ADD size integer;
Expand Down
2 changes: 1 addition & 1 deletion bin/migrateto21.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
break;
default:
echo 'Error: unsupported driver: '.$driver."\n";
die(-1);
exit(-1);
}

echo "Upgrading 'calendarobjects'\n";
Expand Down
2 changes: 1 addition & 1 deletion bin/migrateto30.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
break;
default:
echo 'Error: unsupported driver: '.$driver."\n";
die(-1);
exit(-1);
}

echo "Upgrading 'propertystorage'\n";
Expand Down
2 changes: 1 addition & 1 deletion bin/migrateto32.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
break;
default:
echo 'Error: unsupported driver: '.$driver."\n";
die(-1);
exit(-1);
}

echo "Creating 'calendarinstances'\n";
Expand Down
2 changes: 1 addition & 1 deletion bin/sabredav.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function log($msg)
$log = new CliLog();

if ('cli-server' !== php_sapi_name()) {
die('This script is intended to run on the built-in php webserver');
exit('This script is intended to run on the built-in php webserver');
}

// Finding composer
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"ext-json": "*"
},
"require-dev" : {
"friendsofphp/php-cs-fixer": "^2.16.7",
"friendsofphp/php-cs-fixer": "^2.17.1",
"phpstan/phpstan": "^0.12",
"phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0",
"evert/phpdoc-md" : "~0.1.0",
Expand Down
8 changes: 4 additions & 4 deletions lib/CalDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Sabre\CalDAV;
use Sabre\DAV;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\PropPatch;
use Sabre\DAV\Xml\Element\Sharee;
use Sabre\VObject;

Expand Down Expand Up @@ -289,7 +290,7 @@ public function createCalendar($principalUri, $calendarUri, array $properties)
*
* @param mixed $calendarId
*/
public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
public function updateCalendar($calendarId, PropPatch $propPatch)
{
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
Expand Down Expand Up @@ -1153,10 +1154,9 @@ public function createSubscription($principalUri, $uri, array $properties)
*
* Read the PropPatch documentation for more info and examples.
*
* @param mixed $subscriptionId
* @param \Sabre\DAV\PropPatch $propPatch
* @param mixed $subscriptionId
*/
public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch)
public function updateSubscription($subscriptionId, PropPatch $propPatch)
{
$supportedProperties = array_keys($this->subscriptionPropertyMap);
$supportedProperties[] = '{http://calendarserver.org/ns/}source';
Expand Down
2 changes: 0 additions & 2 deletions lib/CalDAV/CalendarQueryValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,9 @@ protected function validateTimeRange(VObject\Node $component, $start, $end)
case 'VEVENT':
case 'VTODO':
case 'VJOURNAL':

return $component->isInTimeRange($start, $end);

case 'VALARM':

// If the valarm is wrapped in a recurring event, we need to
// expand the recursions, and validate each.
//
Expand Down
4 changes: 0 additions & 4 deletions lib/CalDAV/SharingPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)
// Both the DAV:share-resource and CALENDARSERVER:share requests
// behave identically.
case '{'.Plugin::NS_CALENDARSERVER.'}share':

$sharingPlugin = $this->server->getPlugin('sharing');
$sharingPlugin->shareResource($path, $message->sharees);

Expand All @@ -228,7 +227,6 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)
// The invite-reply document is sent when the user replies to an
// invitation of a calendar share.
case '{'.Plugin::NS_CALENDARSERVER.'}invite-reply':

// This only works on the calendar-home-root node.
if (!$node instanceof CalendarHome) {
return;
Expand Down Expand Up @@ -272,7 +270,6 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)
return false;

case '{'.Plugin::NS_CALENDARSERVER.'}publish-calendar':

// We can only deal with IShareableCalendar objects
if (!$node instanceof ISharedCalendar) {
return;
Expand Down Expand Up @@ -300,7 +297,6 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)
return false;

case '{'.Plugin::NS_CALENDARSERVER.'}unpublish-calendar':

// We can only deal with IShareableCalendar objects
if (!$node instanceof ISharedCalendar) {
return;
Expand Down
1 change: 0 additions & 1 deletion lib/CalDAV/Xml/Filter/CalendarData.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public static function xmlDeserialize(Reader $reader)
foreach ($elems as $elem) {
switch ($elem['name']) {
case '{'.Plugin::NS_CALDAV.'}expand':

$result['expand'] = [
'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null,
'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
Expand Down
3 changes: 2 additions & 1 deletion lib/CardDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Sabre\CardDAV;
use Sabre\DAV;
use Sabre\DAV\PropPatch;

/**
* PDO CardDAV backend.
Expand Down Expand Up @@ -93,7 +94,7 @@ public function getAddressBooksForUser($principalUri)
*
* @param string $addressBookId
*/
public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
public function updateAddressBook($addressBookId, PropPatch $propPatch)
{
$supportedProperties = [
'{DAV:}displayname',
Expand Down
1 change: 0 additions & 1 deletion lib/CardDAV/Xml/Request/AddressBookQueryReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public static function xmlDeserialize(Reader $reader)
}
break;
case '{'.Plugin::NS_CARDDAV.'}filter':

if (!is_null($newProps['filters'])) {
throw new BadRequest('You can only include 1 {'.Plugin::NS_CARDDAV.'}filter element');
}
Expand Down
1 change: 0 additions & 1 deletion lib/DAV/Browser/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ public function httpPOST(RequestInterface $request, ResponseInterface $response)

// @codeCoverageIgnoreStart
case 'put':

if ($_FILES) {
$file = current($_FILES);
} else {
Expand Down
3 changes: 2 additions & 1 deletion lib/DAV/Exception/MethodNotAllowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Sabre\DAV\Exception;

use Sabre\DAV;
use Sabre\DAV\Server;

/**
* MethodNotAllowed.
Expand Down Expand Up @@ -34,7 +35,7 @@ public function getHTTPCode()
*
* @return array
*/
public function getHTTPHeaders(\Sabre\DAV\Server $server)
public function getHTTPHeaders(Server $server)
{
$methods = $server->getAllowedMethods($server->getRequestUri());

Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
*/
class Server implements LoggerAwareInterface, EmitterInterface
{
use WildcardEmitterTrait;
use LoggerAwareTrait;
use WildcardEmitterTrait;

/**
* Infinity is used for some request supporting the HTTP Depth header and indicates that the operation should traverse the entire tree.
Expand Down
1 change: 0 additions & 1 deletion lib/DAV/Sharing/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)

switch ($documentType) {
case '{DAV:}share-resource':

$this->shareResource($path, $message->sharees);
$response->setStatus(200);
// Adding this because sending a response body may cause issues,
Expand Down
3 changes: 1 addition & 2 deletions lib/DAV/Xml/Property/GetLastModified.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public function xmlSerialize(Writer $writer)
*/
public static function xmlDeserialize(Reader $reader)
{
return
new self(new DateTime($reader->parseInnerTree()));
return new self(new DateTime($reader->parseInnerTree()));
}
}
3 changes: 1 addition & 2 deletions lib/DAV/Xml/Property/ResourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public function add($type)
*/
public static function xmlDeserialize(Reader $reader)
{
return
new self(parent::xmlDeserialize($reader));
return new self(parent::xmlDeserialize($reader));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions tests/Sabre/CalDAV/Backend/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace Sabre\CalDAV\Backend;

use
Sabre\DAV\PropPatch;
use Sabre\DAV\PropPatch;

class AbstractTest extends \PHPUnit\Framework\TestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Sabre/CalDAV/Backend/Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Sabre\CalDAV;
use Sabre\DAV;
use Sabre\DAV\PropPatch;

class Mock extends AbstractBackend
{
Expand Down Expand Up @@ -95,7 +96,7 @@ public function createCalendar($principalUri, $calendarUri, array $properties)
*
* @param mixed $calendarId
*/
public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
public function updateCalendar($calendarId, PropPatch $propPatch)
{
$propPatch->handleRemaining(function ($props) use ($calendarId) {
foreach ($this->calendars as $k => $calendar) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Sabre/DAV/HttpGetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function testGet404()
$this->assertEquals(404, $response->getStatus());
}

public function testGet404_aswell()
public function testGet404AsWell()
{
$request = new HTTP\Request('GET', '/file1/subfile');
$response = $this->request($request);
Expand Down
7 changes: 4 additions & 3 deletions tests/Sabre/DAV/Mock/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Sabre\DAV\Mock;

use Sabre\DAV;
use Sabre\DAV\INode;

/**
* Mock Collection.
Expand Down Expand Up @@ -41,7 +42,7 @@ public function __construct($name, array $children = [], Collection $parent = nu
$this->children[] = new File($key, $value, $this);
} elseif (is_array($value)) {
$this->children[] = new self($key, $value, $this);
} elseif ($value instanceof \Sabre\DAV\INode) {
} elseif ($value instanceof INode) {
$this->children[] = $value;
} else {
throw new \InvalidArgumentException('Unknown value passed in $children');
Expand Down Expand Up @@ -113,7 +114,7 @@ public function createDirectory($name)
/**
* Returns an array with all the child nodes.
*
* @return \Sabre\DAV\INode[]
* @return INode[]
*/
public function getChildren()
{
Expand All @@ -123,7 +124,7 @@ public function getChildren()
/**
* Adds an already existing node to this collection.
*/
public function addNode(\Sabre\DAV\INode $node)
public function addNode(INode $node)
{
$this->children[] = $node;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Sabre/DAV/StringUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testBadMatchType()
StringUtil::textMatch('foobar', 'foo', 'i;octet', 'booh');
}

public function testEnsureUTF8_ascii()
public function testEnsureUTF8Ascii()
{
$inputString = 'harkema';
$outputString = 'harkema';
Expand All @@ -95,7 +95,7 @@ public function testEnsureUTF8_ascii()
);
}

public function testEnsureUTF8_latin1()
public function testEnsureUTF8Latin1()
{
$inputString = "m\xfcnster";
$outputString = 'münster';
Expand All @@ -106,7 +106,7 @@ public function testEnsureUTF8_latin1()
);
}

public function testEnsureUTF8_utf8()
public function testEnsureUTF8UTF8()
{
$inputString = "m\xc3\xbcnster";
$outputString = 'münster';
Expand Down
Loading

0 comments on commit d385f9b

Please sign in to comment.