Update php styling for 7.4

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ 2022-04-09 17:27:34 +02:00
parent 4525bc2b42
commit be2a1097cf
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
8 changed files with 1292 additions and 336 deletions

36
.github/workflows/psalm.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: Static analysis
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
static-psalm-analysis:
runs-on: ubuntu-latest
strategy:
matrix:
ocp-version: [ 'dev-master' ]
name: Nextcloud ${{ matrix.ocp-version }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
- name: Install dependencies
run: composer i
- name: Install dependencies
run: composer require --dev christophwurst/nextcloud:${{ matrix.ocp-version }}
- name: Run coding standards check
run: composer run psalm

View File

@ -1,26 +0,0 @@
name: Static analysis
on: [pull_request]
jobs:
static-psalm-analysis:
runs-on: ubuntu-latest
strategy:
matrix:
ocp-version: [ 'dev-master' ]
name: Nextcloud ${{ matrix.ocp-version }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up php
uses: shivammathur/setup-php@master
with:
php-version: 7.4
tools: composer:v1
coverage: none
- name: Install dependencies
run: composer i
- name: Install dependencies
run: composer require --dev christophwurst/nextcloud:${{ matrix.ocp-version }}
- name: Run coding standards check
run: composer run psalm

View File

@ -11,11 +11,12 @@
"cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
"psalm": "psalm.phar"
"psalm": "psalm",
"psalm:update-baseline": "psalm --update-baseline"
},
"require-dev": {
"nextcloud/coding-standard": "^0.5.0",
"phpunit/phpunit": "^9",
"psalm/phar": "^4.3"
"vimeo/psalm": "^4.22"
}
}

1454
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -40,20 +40,16 @@ use OCP\IPreview;
use OCP\IRequest;
class AlbumsController extends Controller {
private string $userId;
private IRootFolder $rootFolder;
private IPreview $previewManager;
/** @var string */
private $userId;
/** @var IRootFolder */
private $rootFolder;
/** @var IPreview */
private $previewManager;
public function __construct(string $userId,
IRequest $request,
IRootFolder $rootFolder,
IPreview $previewManager) {
public function __construct(
string $userId,
IRequest $request,
IRootFolder $rootFolder,
IPreview $previewManager
) {
parent::__construct(Application::APP_ID, $request);
$this->userId = $userId;

View File

@ -36,16 +36,14 @@ use OCP\IRequest;
use OCP\IUserSession;
class ApiController extends Controller {
private IConfig $config;
private IUserSession $userSession;
/** @var IConfig */
private $config;
/** @var IUserSession */
private $userSession;
public function __construct(IRequest $request,
IConfig $config,
IUserSession $userSession) {
public function __construct(
IRequest $request,
IConfig $config,
IUserSession $userSession
) {
parent::__construct(Application::APP_ID, $request);
$this->config = $config;

View File

@ -27,8 +27,6 @@ namespace OCA\Photos\Controller;
use OC\Files\Search\SearchBinaryOperator;
use OC\Files\Search\SearchComparison;
use OCP\Files\Search\ISearchBinaryOperator;
use OCP\Files\Search\ISearchComparison;
use OC\Files\Search\SearchQuery;
use OC\User\NoUserException;
use OCA\Files\Event\LoadSidebar;
@ -36,14 +34,17 @@ use OCA\Photos\AppInfo\Application;
use OCA\Viewer\Event\LoadViewer;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\InvalidPathException;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\Search\ISearchBinaryOperator;
use OCP\Files\Search\ISearchComparison;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
@ -53,46 +54,27 @@ use OCP\Util;
use Psr\Log\LoggerInterface;
class PageController extends Controller {
/** @var IAppManager */
private $appManager;
private IAppManager $appManager;
private IEventDispatcher $eventDispatcher;
private IConfig $config;
private IInitialStateService $initialStateService;
private IUserSession $userSession;
private IRootFolder $rootFolder;
private ICacheFactory $cacheFactory;
private ICache $nomediaPathsCache;
private LoggerInterface $logger;
/** @var IEventDispatcher */
private $eventDispatcher;
/** @var IConfig */
private $config;
/** @var IInitialStateService */
private $initialStateService;
/** @var IUserSession */
private $userSession;
/**
* @var \OCP\Files\IRootFolder
*/
private $rootFolder;
/**
* @var \OCP\ICacheFactory
*/
private $cacheFactory;
/**
* @var \OCP\ICache
*/
private $nomediaPathsCache;
/**
* @var \Psr\Log\LoggerInterface
*/
private $logger;
public function __construct(IRequest $request,
IAppManager $appManager,
IEventDispatcher $eventDispatcher,
IConfig $config,
IInitialStateService $initialStateService,
IUserSession $userSession,
IRootFolder $rootFolder,
ICacheFactory $cacheFactory,
LoggerInterface $logger) {
public function __construct(
IRequest $request,
IAppManager $appManager,
IEventDispatcher $eventDispatcher,
IConfig $config,
IInitialStateService $initialStateService,
IUserSession $userSession,
IRootFolder $rootFolder,
ICacheFactory $cacheFactory,
LoggerInterface $logger
) {
parent::__construct(Application::APP_ID, $request);
$this->appManager = $appManager;

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
<files psalm-version="4.23.0@f1fe6ff483bf325c803df9f510d09a03fd796f88">
<file src="lib/Controller/AlbumsController.php">
<MissingDependency occurrences="4">
<code>$this-&gt;rootFolder</code>
@ -16,7 +16,6 @@
<MissingDependency occurrences="3">
<code>$this-&gt;rootFolder</code>
<code>IRootFolder</code>
<code>\OCP\Files\IRootFolder</code>
</MissingDependency>
<UndefinedClass occurrences="10">
<code>$e</code>