-
Notifications
You must be signed in to change notification settings - Fork 350
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
phpstan level 1 and other fixes #1329
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -292,6 +292,8 @@ protected function copyNode(INode $source, ICollection $destinationParent, $dest | |
$destinationName = $source->getName(); | ||
} | ||
|
||
$destination = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. phpstan reports that |
||
|
||
if ($source instanceof IFile) { | ||
$data = $source->get(); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,6 @@ class Href implements Element, HtmlOutput | |
* | ||
* You must either pass a string for a single href, or an array of hrefs. | ||
* | ||
* If auto-prefix is set to false, the hrefs will be treated as absolute | ||
* and not relative to the servers base uri. | ||
* | ||
Comment on lines
-42
to
-44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constructor had the 2nd parameter removed some time ago. So remove the PHPdoc. And fix the old calls in the test code... |
||
* @param string|string[] $hrefs | ||
*/ | ||
public function __construct($hrefs) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
parameters: | ||
level: 0 | ||
level: 1 | ||
bootstrapFiles: | ||
- tests/bootstrap.php |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,7 +75,6 @@ public function testInvalidArg1() | |
$this->expectException('InvalidArgumentException'); | ||
$obj = new SchedulingObject( | ||
new Backend\MockScheduling([], []), | ||
[], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
[] | ||
); | ||
} | ||
|
@@ -85,7 +84,6 @@ public function testInvalidArg2() | |
$this->expectException('InvalidArgumentException'); | ||
$obj = new SchedulingObject( | ||
new Backend\MockScheduling([], []), | ||
[], | ||
['calendarid' => '1'] | ||
); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,8 @@ public function getDb() | |
throw new \Exception('You must set the $driver public property'); | ||
} | ||
|
||
$pdo = null; | ||
|
||
if (array_key_exists($this->driver, DbCache::$cache)) { | ||
$pdo = DbCache::$cache[$this->driver]; | ||
if (null === $pdo) { | ||
|
@@ -58,6 +60,11 @@ public function getDb() | |
} | ||
break; | ||
} | ||
|
||
if (null === $pdo) { | ||
$this->markTestSkipped($this->driver.' was not recognised'); | ||
} | ||
|
||
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. phpstan reported that |
||
} catch (PDOException $e) { | ||
$this->markTestSkipped($this->driver.' was not enabled or not correctly configured. Error message: '.$e->getMessage()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,6 +131,8 @@ public function setGroupMemberSet($path, array $members) | |
public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) | ||
{ | ||
$value = null; | ||
$principal = false; | ||
$principalIndex = null; | ||
Comment on lines
+134
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. phpstan reports that these might not be defined, so initiialize them just in case the |
||
foreach ($this->principals as $principalIndex => $value) { | ||
if ($value['uri'] === $path) { | ||
$principal = $value; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phpstan reported that
$f
might not be defined below.If the caller passes something other than
1
2
or3
what should we do?(I made it do gthe same thing as if they passed in
1
)