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

Bump phan to 1.3.5 and enable on PHP 7.2 7.3 #35818

Merged
merged 6 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ local pipelines = [
depends_on=standard_deps
)
for php in [
'7.1',
'7.1', '7.2', '7.3',
]
] + [
#
Expand Down
162 changes: 162 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,166 @@ trigger:
depends_on:
- install-dependencies

---
kind: pipeline
name: phan-php7.2

platform:
os: linux
arch: amd64

steps:
- name: cache-restore
pull: always
image: plugins/s3-cache:1
settings:
access_key:
from_secret: cache_s3_access_key
endpoint:
from_secret: cache_s3_endpoint
restore: true
secret_key:
from_secret: cache_s3_secret_key
when:
instance:
- drone.owncloud.services
- drone.owncloud.com

- name: composer-install
pull: always
image: owncloudci/php:7.2
commands:
- make install-composer-deps
environment:
COMPOSER_HOME: /drone/src/.cache/composer

- name: vendorbin-install
pull: always
image: owncloudci/php:7.2
commands:
- make vendor-bin-deps
environment:
COMPOSER_HOME: /drone/src/.cache/composer

- name: yarn-install
pull: always
image: owncloudci/php:7.2
commands:
- make install-nodejs-deps
environment:
NPM_CONFIG_CACHE: /drone/src/.cache/npm
YARN_CACHE_FOLDER: /drone/src/.cache/yarn
bower_storage__packages: /drone/src/.cache/bower

- name: install-server
pull: always
image: owncloudci/php:7.2
commands:
- bash tests/drone/install-server.sh
- php occ a:l
- php occ config:system:set trusted_domains 1 --value=server
- php occ log:manage --level 2
- php occ config:list
- php occ security:certificates:import /drone/server.crt
- php occ security:certificates
environment:
DB_TYPE: sqlite

- name: php-phan
pull: always
image: owncloudci/php:7.2
commands:
- make test-php-phan

trigger:
ref:
- refs/heads/master
- refs/tags/**
- refs/pull/**

depends_on:
- install-dependencies

---
kind: pipeline
name: phan-php7.3

platform:
os: linux
arch: amd64

steps:
- name: cache-restore
pull: always
image: plugins/s3-cache:1
settings:
access_key:
from_secret: cache_s3_access_key
endpoint:
from_secret: cache_s3_endpoint
restore: true
secret_key:
from_secret: cache_s3_secret_key
when:
instance:
- drone.owncloud.services
- drone.owncloud.com

- name: composer-install
pull: always
image: owncloudci/php:7.3
commands:
- make install-composer-deps
environment:
COMPOSER_HOME: /drone/src/.cache/composer

- name: vendorbin-install
pull: always
image: owncloudci/php:7.3
commands:
- make vendor-bin-deps
environment:
COMPOSER_HOME: /drone/src/.cache/composer

- name: yarn-install
pull: always
image: owncloudci/php:7.3
commands:
- make install-nodejs-deps
environment:
NPM_CONFIG_CACHE: /drone/src/.cache/npm
YARN_CACHE_FOLDER: /drone/src/.cache/yarn
bower_storage__packages: /drone/src/.cache/bower

- name: install-server
pull: always
image: owncloudci/php:7.3
commands:
- bash tests/drone/install-server.sh
- php occ a:l
- php occ config:system:set trusted_domains 1 --value=server
- php occ log:manage --level 2
- php occ config:list
- php occ security:certificates:import /drone/server.crt
- php occ security:certificates
environment:
DB_TYPE: sqlite

- name: php-phan
pull: always
image: owncloudci/php:7.3
commands:
- make test-php-phan

trigger:
ref:
- refs/heads/master
- refs/tags/**
- refs/pull/**

depends_on:
- install-dependencies

---
kind: pipeline
name: stan-php7.1
Expand Down Expand Up @@ -12813,6 +12973,8 @@ depends_on:
- install-dependencies
- coding-standard
- phan-php7.1
- phan-php7.2
- phan-php7.3
- stan-php7.1
- test-javascript
- litmus-php7.1
Expand Down
6 changes: 6 additions & 0 deletions apps/dav/lib/CalDAV/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10
public function updateShares(array $add, array $remove) {
/** @var CalDavBackend $calDavBackend */
$calDavBackend = $this->caldavBackend;
'@phan-var CalDavBackend $calDavBackend';
$calDavBackend->updateShares($this, $add, $remove);
}

Expand All @@ -78,6 +79,7 @@ public function updateShares(array $add, array $remove) {
public function getShares() {
/** @var CalDavBackend $calDavBackend */
$calDavBackend = $this->caldavBackend;
'@phan-var CalDavBackend $calDavBackend';
return $calDavBackend->getShares($this->getResourceId());
}

Expand Down Expand Up @@ -139,6 +141,7 @@ public function getACL() {

/** @var CalDavBackend $calDavBackend */
$calDavBackend = $this->caldavBackend;
'@phan-var CalDavBackend $calDavBackend';
return $calDavBackend->applyShareAcl($this->getResourceId(), $acl);
}

Expand Down Expand Up @@ -166,6 +169,7 @@ public function delete() {

/** @var CalDavBackend $calDavBackend */
$calDavBackend = $this->caldavBackend;
'@phan-var CalDavBackend $calDavBackend';
$calDavBackend->updateShares($this, [], [
$principal
]);
Expand Down Expand Up @@ -253,6 +257,7 @@ public function calendarQuery(array $filters) {
* @return string|null
*/
public function setPublishStatus($value) {
'@phan-var CalDavBackend $this->calDavBackend';
$publicUri = $this->caldavBackend->setPublishStatus($value, $this);
$this->calendarInfo['publicuri'] = $publicUri;
return $publicUri;
Expand All @@ -262,6 +267,7 @@ public function setPublishStatus($value) {
* @return mixed $value
*/
public function getPublishStatus() {
'@phan-var CalDavBackend $this->calDavBackend';
return $this->caldavBackend->getPublishStatus($this);
}

Expand Down
2 changes: 2 additions & 0 deletions apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)

// If there's no ACL support, we allow everything
if ($acl) {
'@phan-var \OCA\DAV\Connector\Sabre\DavAclPlugin $acl';
$acl->checkPrivileges($path, '{DAV:}write');
}

Expand Down Expand Up @@ -209,6 +210,7 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)

// If there's no ACL support, we allow everything
if ($acl) {
'@phan-var \OCA\DAV\Connector\Sabre\DavAclPlugin $acl';
$acl->checkPrivileges($path, '{DAV:}write');
}

Expand Down
23 changes: 14 additions & 9 deletions apps/dav/lib/CardDAV/AddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
* @return void
*/
public function updateShares(array $add, array $remove) {
/** @var CardDavBackend $carddavBackend */
$carddavBackend = $this->carddavBackend;
$carddavBackend->updateShares($this, $add, $remove);
/** @var CardDavBackend $cardDavBackend */
$cardDavBackend = $this->carddavBackend;
'@phan-var CardDavBackend $cardDavBackend';
$cardDavBackend->updateShares($this, $add, $remove);
}

/**
Expand All @@ -65,9 +66,10 @@ public function updateShares(array $add, array $remove) {
* @return array
*/
public function getShares() {
/** @var CardDavBackend $carddavBackend */
$carddavBackend = $this->carddavBackend;
return $carddavBackend->getShares($this->getResourceId());
/** @var CardDavBackend $cardDavBackend */
$cardDavBackend = $this->carddavBackend;
'@phan-var CardDavBackend $cardDavBackend';
return $cardDavBackend->getShares($this->getResourceId());
}

public function getACL() {
Expand Down Expand Up @@ -104,9 +106,10 @@ public function getACL() {
];
}

/** @var CardDavBackend $carddavBackend */
$carddavBackend = $this->carddavBackend;
return $carddavBackend->applyShareAcl($this->getResourceId(), $acl);
/** @var CardDavBackend $cardDavBackend */
$cardDavBackend = $this->carddavBackend;
'@phan-var CardDavBackend $cardDavBackend';
return $cardDavBackend->applyShareAcl($this->getResourceId(), $acl);
}

public function getChildACL() {
Expand Down Expand Up @@ -149,6 +152,7 @@ public function delete() {

/** @var CardDavBackend $cardDavBackend */
$cardDavBackend = $this->carddavBackend;
'@phan-var CardDavBackend $cardDavBackend';
$cardDavBackend->updateShares($this, [], [
$principal
]);
Expand All @@ -167,6 +171,7 @@ public function propPatch(PropPatch $propPatch) {
public function getContactsGroups() {
/** @var CardDavBackend $cardDavBackend */
$cardDavBackend = $this->carddavBackend;
'@phan-var CardDavBackend $cardDavBackend';

return $cardDavBackend->collectCardProperties($this->getResourceId(), 'CATEGORIES');
}
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/CardDAV/ImageExportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function httpGet(RequestInterface $request, ResponseInterface $response)
// Checking ACL, if available.
if ($aclPlugin = $this->server->getPlugin('acl')) {
/** @var \Sabre\DAVACL\Plugin $aclPlugin */
'@phan-var \Sabre\DAVACL\Plugin $aclPlugin';
$aclPlugin->checkPrivileges($path, '{DAV:}read');
}

Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Connector/Sabre/AutorenamePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function handlePut(RequestInterface $request, ResponseInterface $response
return;
}

'@phan-var ObjectTree $this->server->tree';
$view = $this->server->tree->getView();
list($nodePath, $nodeName) = \Sabre\Uri\split($node->getPath());
$newName = \OC_Helper::buildNotExistingFileNameForView($nodePath, $nodeName, $view);
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Connector/Sabre/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ public function getSharePermissions($user) {

if ($storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) {
/** @var \OCA\Files_Sharing\SharedStorage $storage */
'@phan-var \OCA\Files_Sharing\SharedStorage $storage';
$permissions = (int)$storage->getShare()->getPermissions();
} else {
$permissions = $storage->getPermissions($path);
Expand Down
2 changes: 2 additions & 0 deletions apps/dav/lib/Connector/Sabre/QuotaPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ public function handleBeforeMove($source, $destination) {
// get target node for proper path conversion
if ($this->server->tree->nodeExists($destination)) {
$destinationNode = $this->server->tree->getNodeForPath($destination);
'@phan-var Node $destinationNode';
$path = $destinationNode->getPath();
} else {
$parentNode = $this->server->tree->getNodeForPath(\dirname($destination));
'@phan-var Node $parentNode';
$path = $parentNode->getPath();
}

Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Connector/Sabre/ServerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function createServer($baseUri,
// ensure the skeleton is copied
// Try to obtain User Folder
$userFolder = \OC::$server->getUserFolder();
'@phan-var \OCA\DAV\Connector\Sabre\Node $userFolder';

/** @var \OC\Files\View $view */
$view = $viewCallBack($server);
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Connector/Sabre/TagsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public function handleGetProperties(
$folderContent = $node->getChildren();
$fileIds[] = (int)$node->getId();
foreach ($folderContent as $info) {
'@phan-var \OCA\DAV\Connector\Sabre\Node $info';
$fileIds[] = (int)$info->getId();
}
$tags = $this->getTagger()->getTagsForObjects($fileIds);
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/DAV/CopyPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function httpCopy(RequestInterface $request, ResponseInterface $response)
return false;
}

'@phan-var ICopySource $sourceNode';
$sourceNode->copy($destinationNode->getFileInfo()->getPath());

$this->server->emit('afterBind', [$copyInfo['destination']]);
Expand Down
4 changes: 4 additions & 0 deletions apps/dav/lib/DAV/FileCustomPropertiesBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class FileCustomPropertiesBackend extends AbstractCustomPropertiesBackend {
public function beforeDelete($path) {
try {
$node = $this->getNodeForPath($path);
'@phan-var \OCA\DAV\Connector\Sabre\Node $node';
if ($node !== null && $node->getId()) {
if ($this->deletedItemsCache === null) {
$this->deletedItemsCache = new CappedMemoryCache();
Expand Down Expand Up @@ -137,6 +138,7 @@ public function move($source, $destination) {
* @inheritdoc
*/
protected function getProperties($path, INode $node, array $requestedProperties) {
'@phan-var \OCA\DAV\Connector\Sabre\Node $node';
$fileId = $node->getId();
if ($this->offsetGet($fileId) === null) {
// TODO: chunking if more than 1000 properties
Expand All @@ -162,6 +164,7 @@ protected function getProperties($path, INode $node, array $requestedProperties)
*/
protected function updateProperties($path, INode $node, $changedProperties) {
$existingProperties = $this->getProperties($path, $node, []);
'@phan-var \OCA\DAV\Connector\Sabre\Node $node';
$fileId = $node->getId();
$deleteStatement = self::DELETE_BY_ID_AND_NAME_STMT;
$insertStatement = self::INSERT_BY_ID_STMT;
Expand Down Expand Up @@ -232,6 +235,7 @@ protected function loadChildrenProperties(INode $node, $requestedProperties) {
$childrenIds = [];
// pre-fill cache
foreach ($childNodes as $childNode) {
'@phan-var \OCA\DAV\Connector\Sabre\Node $childNode';
$childId = $childNode->getId();
if ($childId) {
$childrenIds[] = $childId;
Expand Down
Loading