Skip to content
Draft
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
46 changes: 46 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: PHPStan

on: pull_request

concurrency:
group: phpstan-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
phpstan-static-analysis:
runs-on: ubuntu-latest

name: static-phpstan-analysis
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: Get php version
id: versions
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1

- name: Set up php${{ steps.versions.outputs.php-available }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
php-version: ${{ steps.versions.outputs.php-available }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: composer i

- name: Run static analysis
run: composer run phpstan
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"openapi": "generate-spec",
"phpstan": "vendor/bin/phpstan analyse -c phpstan.neon",
"psalm": "psalm --no-cache --threads=$(nproc)",
"psalm:dev": "@psalm",
"psalm:update-baseline": "psalm --threads=1 --update-baseline",
Expand Down
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/BackgroundJob/RetentionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function run($argument): void {

$offset = '';
$limit = 1000;
while ($offset !== null) {
while (true) {
$fileIds = $this->tagMapper->getObjectIdsForTags((string)$tag, 'files', $limit, $offset);
$this->logger->debug('Checking retention for ' . count($fileIds) . ' files in this chunk');

Expand Down
12 changes: 12 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
parameters:
level: 5
paths:
- lib
scanFiles:
- tests/stub.phpstub
scanDirectories:
- vendor/nextcloud/ocp
ignoreErrors:
- '#on an unknown class Doctrine\\DBAL\\Schema\\Table#'
10 changes: 10 additions & 0 deletions vendor-bin/phpstan/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"config": {
"platform": {
"php": "8.1"
}
},
"require-dev": {
"phpstan/phpstan": "^2.1.0"
}
}
80 changes: 80 additions & 0 deletions vendor-bin/phpstan/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading