Skip to content

Commit

Permalink
Switching to PHP 8.0 as minimum requirement (#2746)
Browse files Browse the repository at this point in the history
* php min version 8.0
* Constructor property promotion
* Named Arguments
  • Loading branch information
dartcafe authored Feb 24, 2023
1 parent a073c67 commit 8b45506
Show file tree
Hide file tree
Showing 111 changed files with 465 additions and 1,649 deletions.
4 changes: 2 additions & 2 deletions .github/actions/get-polls-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ runs:
steps:
- name: Get app version from appinfo/info.xml
id: appinfo
uses: mavrosxristoforos/get-xml-info@1.0
uses: mavrosxristoforos/get-xml-info@1
with:
xml-file: 'appinfo/info.xml'
xpath: '//info//version'
Expand All @@ -31,7 +31,7 @@ runs:

- name: Compare versions
if: ${{ !inputs.skip-version && format('v{0}', steps.appinfo.outputs.info) != steps.gettag.outputs.VERSION }}
uses: actions/github-script@v3
uses: actions/github-script@v6
with:
script: |
core.setFailed('App version ${{ format('v{0}', steps.appinfo.outputs.info) }} is not equal to tag name ${{ steps.gettag.outputs.VERSION }}!')
6 changes: 3 additions & 3 deletions .github/actions/setup-composer/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Setup composer and PHP
inputs:
php-version:
description: 'PHP version (default: 7.4)'
description: 'PHP version (default: 8.0)'
required: false
default: '7.4'
default: '8.0'
php-tools:
description: 'Additional php tools'
required: false
Expand Down Expand Up @@ -45,7 +45,7 @@ runs:
${{ runner.os }}-
- name: Set up php ${{ inputs.php-version }}
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
tools: ${{ inputs.php-tools }}
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/setup-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ inputs:
description: 'App to checkout (default: polls)'
php-version:
required: false
default: '7.4'
description: 'PHP version (default: 7.4)'
default: '8.0'
description: 'PHP version (default: 8.0)'
php-tools:
description: 'Additional php tools'
required: false
Expand Down Expand Up @@ -58,7 +58,7 @@ runs:
using: "composite"
steps:
- name: Checkout server ${{ inputs.server-version }}
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: ${{ inputs.server-path }}
repository: nextcloud/server
Expand All @@ -73,7 +73,7 @@ runs:
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Checkout ${{ inputs.app-name }}
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: ${{ inputs.server-path }}/apps/${{ inputs.app-name }}

Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['8.0', '8.1']

name: PHP-CS

Expand Down Expand Up @@ -41,8 +41,6 @@ jobs:

- name: Setup node
uses: ./.github/actions/setup-node
with:
node-version: '16'

- name: Run eslint
run: npm run lint
Expand All @@ -58,8 +56,6 @@ jobs:

- name: Setup node
uses: ./.github/actions/setup-node
with:
node-version: '16'

- name: Run stylelint
run: npm run stylelint
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['8.0', '8.1']
php-versions: ['8.0']
server-versions: ['master']

name: SQLite
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.0']
php-versions: ['8.1']
server-versions: ['master']

name: MySQL
Expand Down Expand Up @@ -104,8 +104,8 @@ jobs:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['7.4']
server-versions: ['stable25']
php-versions: ['8.1']
server-versions: ['master']

name: PostgreSQL

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ocp-version: ['stable25']
php-versions: ['7.4', '8.0', '8.1']
ocp-version: ['master']
php-versions: ['8.0', '8.1']

name: Psalm

Expand Down
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>Polls</name>
<summary>A polls app, similar to Doodle/Dudle with the possibility to restrict access.</summary>
<description>A polls app, similar to Doodle/Dudle with the possibility to restrict access (members, certain groups/users, hidden and public).</description>
<version>4.1.4</version>
<version>5.0.0-beta1</version>
<licence>agpl</licence>
<author>Vinzenz Rosenkranz</author>
<author>René Gieling</author>
Expand All @@ -22,7 +22,7 @@
<screenshot>https://raw.githubusercontent.com/nextcloud/polls/master/screenshots/vote.png</screenshot>
<screenshot>https://raw.githubusercontent.com/nextcloud/polls/master/screenshots/edit-poll.png</screenshot>
<dependencies>
<php min-version="7.4"/>
<php min-version="8.0"/>
<nextcloud min-version="25" max-version="26" />
</dependencies>
<activity>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"config": {
"platform": {
"php": "7.4.0"
"php": "8.0"
}
},
"autoload-dev": {
Expand Down
51 changes: 26 additions & 25 deletions composer.lock

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

16 changes: 2 additions & 14 deletions lib/Activity/PollChanges.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,10 @@
use OCP\IURLGenerator;

class PollChanges implements IFilter {
/** @var IL10N */
protected $l10n;

/** @var IURLGenerator */
protected $urlGenerator;

/**
* @param IL10N $l10n
* @param IURLGenerator $urlGenerator
*/
public function __construct(
IL10N $l10n,
IURLGenerator $urlGenerator
protected IL10N $l10n,
protected IURLGenerator $urlGenerator
) {
$this->l10n = $l10n;
$this->urlGenerator = $urlGenerator;
}

public function getIdentifier() : string {
Expand Down
23 changes: 6 additions & 17 deletions lib/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,12 @@
class Command extends \Symfony\Component\Console\Command\Command {
protected const NAME_PREFIX = 'polls:';

/** @var OutputInterface */
protected $output;

/** @var InputInterface */
protected $input;

/** @var string */
protected $name = '';

/** @var string */
protected $description = '';

/** @var mixed */
protected $helper;

/** @var ConfirmationQuestion */
protected $question;
protected OutputInterface $output;
protected InputInterface $input;
protected string $name = '';
protected string $description = '';
protected mixed $helper;
protected ConfirmationQuestion $question;

public function __construct() {
parent::__construct();
Expand Down
15 changes: 3 additions & 12 deletions lib/Command/Db/CleanMigrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,11 @@
use OCA\Polls\Command\Command;

class CleanMigrations extends Command {
/** @var TableManager */
private $tableManager;
protected string $name = self::NAME_PREFIX . 'db:clean-migrations';
protected string $description = 'Remove old migrations entries from Nextcloud\'s migration table';

/** @var string */
protected $name = self::NAME_PREFIX . 'db:clean-migrations';

/** @var string */
protected $description = 'Remove old migrations entries from Nextcloud\'s migration table';

public function __construct(
TableManager $tableManager
) {
public function __construct(private TableManager $tableManager) {
parent::__construct();
$this->tableManager = $tableManager;
}

protected function runCommands(): int {
Expand Down
Loading

0 comments on commit 8b45506

Please sign in to comment.