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

Add PHPStan and ensure PHP 8.2 support #2792

Merged
merged 9 commits into from
Sep 21, 2023
49 changes: 46 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
os: ['ubuntu-latest']

steps:
Expand All @@ -31,7 +31,46 @@ jobs:
tools: phpcs

- name: Setup dependencies
run: composer require -n --no-progress overtrue/phplint
run: |
composer require -n --no-progress overtrue/phplint phpunit/phpunit ipl/stdlib:@dev ipl/html:@dev
git clone --depth 1 https://github.com/Icinga/icingaweb2.git vendor/icingaweb2
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git vendor/icinga-php-thirdparty
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-cube.git vendor/cube

- name: Setup Incubator
run: |
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-incubator vendor/incubator
cd vendor/incubator
composer require --no-update \
"gipfl/calendar": "dev-master as 99.x-dev" \
"gipfl/cli": "dev-master as 99.x-dev" \
"gipfl/curl": "dev-master as 99.x-dev" \
"gipfl/data-type": "dev-master as 99.x-dev" \
"gipfl/db-migration": "dev-master as 99.x-dev" \
"gipfl/diff": "dev-master as 99.x-dev" \
"gipfl/format": "dev-master as 99.x-dev" \
"gipfl/icinga-bundles": "dev-master as 99.x-dev" \
"gipfl/icinga-cli-daemon": "dev-master as 99.x-dev" \
"gipfl/icingaweb2": "dev-master as 99.x-dev" \
"gipfl/influxdb": "dev-master as 99.x-dev" \
"gipfl/json": "dev-master as 99.x-dev" \
"gipfl/linux-health": "dev-master as 99.x-dev" \
"gipfl/log": "dev-master as 99.x-dev" \
"gipfl/process": "dev-master as 99.x-dev" \
"gipfl/protocol-jsonrpc": "dev-master as 99.x-dev" \
"gipfl/protocol-netstring": "dev-master as 99.x-dev" \
"gipfl/react-utils": "dev-master as 99.x-dev" \
"gipfl/simple-daemon": "dev-master as 99.x-dev" \
"gipfl/socket": "dev-master as 99.x-dev" \
"gipfl/stream": "dev-master as 99.x-dev" \
"gipfl/systemd": "dev-master as 99.x-dev" \
"gipfl/translation": "dev-master as 99.x-dev" \
"gipfl/web": "dev-master as 99.x-dev" \
"gipfl/zfdb": "dev-master as 99.x-dev" \
"gipfl/zfdbstore": "dev-master as 99.x-dev"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
bin/make-release.sh snapshot

- name: PHP Lint
if: ${{ ! cancelled() }}
Expand All @@ -41,6 +80,10 @@ jobs:
if: ${{ ! cancelled() }}
run: phpcs

- name: PHPStan
if: ${{ ! cancelled() }}
uses: php-actions/phpstan@v3

test:
name: Unit tests with php ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -51,7 +94,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
os: ['ubuntu-latest']
include:
- php: '7.2'
Expand Down
1 change: 1 addition & 0 deletions library/Director/Dashboard/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ protected function createTabForDashboard(Dashboard $dashboard)
]);
}

#[\ReturnTypeWillChange]
public function count()
{
return count($this->dashlets());
Expand Down
2 changes: 2 additions & 0 deletions library/Director/Data/Db/ServiceSetQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class ServiceSetQueryBuilder
/** @var \Zend_Db_Adapter_Abstract */
protected $db;

protected $searchColumns = [];

/**
* @param ?UuidInterface $uuid
*/
Expand Down
5 changes: 0 additions & 5 deletions library/Director/Db/Cache/CustomVariableCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,4 @@ public function getVarsForObject(IcingaObject $object)
return new CustomVariables();
}
}

public function __destruct()
{
unset($this->db);
}
}
1 change: 0 additions & 1 deletion library/Director/Objects/IcingaTemplateResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function setObject(IcingaObject $object)
{
$this->object = $object;
$this->type = $object->getShortTableName();
$this->table = $object->getTableName();
$this->connection = $object->getConnection();
$this->db = $this->connection->getDbAdapter();

Expand Down
4 changes: 2 additions & 2 deletions library/Director/StartupLogRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ function ($matches) use ($severity, $self) {
}

if ($time === null) {
$lines[] .= $line;
$lines[] = $line;
} else {
$lines[] .= "[$time] $line";
$lines[] = "[$time] $line";
}
}
return implode("\n", $lines);
Expand Down
2 changes: 2 additions & 0 deletions library/Director/Test/TestSuiteLint.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class TestSuiteLint extends TestSuite

protected $failed;

protected $result = [];

public function run()
{
$this->checked = $this->failed = array();
Expand Down
4 changes: 3 additions & 1 deletion library/Director/Test/TestSuiteUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

abstract class TestSuiteUnit
{
private $testdoxFile;

public function run()
{
}
Expand All @@ -15,7 +17,7 @@ public function __construct()
public function __destruct()
{
if ($this->testdoxFile && file_exists($this->testdoxFile)) {
unlink($this->testDoxfile);
unlink($this->testdoxFile);
}
}

Expand Down
236 changes: 0 additions & 236 deletions library/Director/Web/Controller/Extension/SingleObjectApiHandler.php

This file was deleted.

2 changes: 2 additions & 0 deletions library/Director/Web/Form/IplElement/ExtensibleSetElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class ExtensibleSetElement extends BaseHtmlElement

private $description;

private $descriptions;

private $multiOptions;

private $validOptions;
Expand Down
Loading