Skip to content

Commit b18db1c

Browse files
authored
php: Streamline vendor file location with local dev-env (#961)
2 parents 274b903 + b928705 commit b18db1c

File tree

78 files changed

+1042
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1042
-568
lines changed

Diff for: .github/workflows/php.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232

3333
- name: Setup dependencies
3434
run: |
35-
composer require -n --no-progress overtrue/phplint
36-
git clone --depth 1 https://github.com/Icinga/icingaweb2.git vendor/icingaweb2
37-
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-reporting.git vendor/reporting
38-
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-x509.git vendor/x509
39-
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-pdfexport.git vendor/pdfexport
40-
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git vendor/icinga-php-library
41-
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git vendor/icinga-php-thirdparty
35+
composer require -n --no-progress overtrue/phplint phpstan/phpstan
36+
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2.git /icingaweb2
37+
sudo git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git /usr/share/icinga-php/ipl
38+
sudo git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git /usr/share/icinga-php/vendor
39+
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2-module-reporting.git /usr/share/icingaweb2-modules/reporting
40+
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2-module-pdfexport.git /usr/share/icingaweb2-modules/pdfexport
41+
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2-module-x509.git /usr/share/icingaweb2-modules/x509
4242
4343
- name: PHP Lint
4444
if: ${{ ! cancelled() }}
@@ -50,7 +50,7 @@ jobs:
5050

5151
- name: PHPStan
5252
if: ${{ ! cancelled() }}
53-
uses: php-actions/phpstan@v3
53+
run: ./vendor/bin/phpstan analyse
5454

5555
test:
5656
name: Unit tests with php ${{ matrix.php }} on ${{ matrix.os }}

Diff for: application/clicommands/MigrateCommand.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,8 @@ public function dashboardAction(): void
496496
);
497497

498498
$changed = false;
499-
/** @var ConfigObject $dashboardConfig */
499+
/** @var ConfigObject<string> $dashboardConfig */
500500
foreach ($dashboardsConfig->getConfigObject() as $name => $dashboardConfig) {
501-
/** @var ?string $dashboardUrlString */
502501
$dashboardUrlString = $dashboardConfig->get('url');
503502
if ($dashboardUrlString !== null) {
504503
$dashBoardUrl = Url::fromPath($dashboardUrlString, [], new Request());
@@ -595,9 +594,8 @@ public function filterAction(): void
595594
private function transformNavigationItems(Config $config, string $owner, int &$rc): bool
596595
{
597596
$updated = false;
598-
/** @var ConfigObject $newConfigObject */
597+
/** @var ConfigObject<string> $newConfigObject */
599598
foreach ($config->getConfigObject() as $section => $newConfigObject) {
600-
/** @var string $configOwner */
601599
$configOwner = $newConfigObject->get('owner') ?? '';
602600
if ($configOwner && $configOwner !== $owner) {
603601
continue;
@@ -686,9 +684,8 @@ private function migrateNavigationItems(Config $config, string $owner, string $p
686684
$newConfig = $config->getConfigFile() === $path ? $config : $this->readFromIni($path, $rc);
687685

688686
$updated = false;
689-
/** @var ConfigObject $configObject */
687+
/** @var ConfigObject<string> $configObject */
690688
foreach ($config->getConfigObject() as $configObject) {
691-
/** @var string $configOwner */
692689
$configOwner = $configObject->get('owner') ?? '';
693690
if ($configOwner && $configOwner !== $owner) {
694691
continue;

Diff for: library/Icingadb/Command/Transport/CommandTransport.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function getConfig(): Config
5050
/**
5151
* Create a transport from config
5252
*
53-
* @param ConfigObject $config
53+
* @param ConfigObject<string> $config
5454
*
5555
* @return ApiCommandTransport
5656
*
@@ -59,7 +59,7 @@ public static function getConfig(): Config
5959
public static function createTransport(ConfigObject $config): ApiCommandTransport
6060
{
6161
$config = clone $config;
62-
switch (strtolower($config->transport)) {
62+
switch (strtolower($config->transport ?? '')) {
6363
case ApiCommandTransport::TRANSPORT:
6464
$transport = new ApiCommandTransport();
6565
break;

Diff for: library/Icingadb/Compat/CompatObject.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,14 @@ protected function getDataView()
361361
*/
362362
private function getBoolType($value)
363363
{
364-
switch ($value) {
365-
case false:
366-
return 0;
367-
case true:
368-
return 1;
369-
case 'sticky':
370-
return 2;
364+
if ($value === 'sticky') {
365+
return 2;
371366
}
367+
368+
if (is_string($value)) {
369+
return null;
370+
}
371+
372+
return (int) $value;
372373
}
373374
}

Diff for: library/Icingadb/Model/AcknowledgementHistory.php

+16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Icinga\Module\Icingadb\Model;
66

7+
use DateTime;
78
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
89
use ipl\Orm\Behavior\Binary;
910
use ipl\Orm\Behavior\MillisecondTimestamp;
@@ -16,6 +17,21 @@
1617
*
1718
* Please note that using this model will fetch history entries for decommissioned services. To avoid this, the query
1819
* needs a `acknowledgement_history.service_id IS NULL OR acknowledgement_history_service.id IS NOT NULL` where.
20+
*
21+
* @property string $id
22+
* @property string $environment_id
23+
* @property ?string $endpoint_id
24+
* @property string $object_type
25+
* @property string $host_id
26+
* @property ?string $service_id
27+
* @property DateTime $set_time
28+
* @property ?DateTime $clear_time
29+
* @property ?string $author
30+
* @property ?string $cleared_by
31+
* @property ?string $comment
32+
* @property ?DateTime $expire_time
33+
* @property ?bool $is_sticky
34+
* @property ?bool $is_persistent
1935
*/
2036
class AcknowledgementHistory extends Model
2137
{

Diff for: library/Icingadb/Model/ActionUrl.php

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
use ipl\Orm\Model;
1111
use ipl\Orm\Relations;
1212

13+
/**
14+
* @property string $id
15+
* @property string[] $action_url
16+
* @property string $environment_id
17+
*/
1318
class ActionUrl extends Model
1419
{
1520
public function getTableName()

Diff for: library/Icingadb/Model/Checkcommand.php

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010
use ipl\Orm\Model;
1111
use ipl\Orm\Relations;
1212

13+
/**
14+
* @property string $id
15+
* @property ?string $zone_id
16+
* @property string $environment_id
17+
* @property string $name_checksum
18+
* @property string $properties_checksum
19+
* @property string $name
20+
* @property string $name_ci
21+
* @property string $command
22+
* @property int $timeout
23+
*/
1324
class Checkcommand extends Model
1425
{
1526
public function getTableName()

Diff for: library/Icingadb/Model/CheckcommandArgument.php

+17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@
99
use ipl\Orm\Model;
1010
use ipl\Orm\Relations;
1111

12+
/**
13+
* @property string $id
14+
* @property string $checkcommand_id
15+
* @property string $argument_key
16+
* @property string $environment_id
17+
* @property string $properties_checksum
18+
* @property ?string $argument_value
19+
* @property ?int $argument_order
20+
* @property ?string $description
21+
* @property ?string $argument_key_override
22+
* @property string $repeat_key
23+
* @property string $required
24+
* @property ?string $set_if
25+
* @property ?string $separator
26+
* @property string $skip_key
27+
*/
1228
class CheckcommandArgument extends Model
1329
{
1430
public function getTableName()
@@ -35,6 +51,7 @@ public function getColumns()
3551
'repeat_key',
3652
'required',
3753
'set_if',
54+
'separator',
3855
'skip_key'
3956
];
4057
}

Diff for: library/Icingadb/Model/CheckcommandCustomvar.php

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
use ipl\Orm\Model;
1010
use ipl\Orm\Relations;
1111

12+
/**
13+
* @property string $id
14+
* @property string $checkcommand_id
15+
* @property string $customvar_id
16+
* @property string $environment_id
17+
*/
1218
class CheckcommandCustomvar extends Model
1319
{
1420
public function getTableName()

Diff for: library/Icingadb/Model/CheckcommandEnvvar.php

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
use ipl\Orm\Model;
1010
use ipl\Orm\Relations;
1111

12+
/**
13+
* @property string $id
14+
* @property string $checkcommand_id
15+
* @property string $envvar_key
16+
* @property string $environment_id
17+
* @property string $properties_checksum
18+
* @property string $envvar_value
19+
*/
1220
class CheckcommandEnvvar extends Model
1321
{
1422
public function getTableName()

Diff for: library/Icingadb/Model/Comment.php

+19
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Icinga\Module\Icingadb\Model;
66

7+
use DateTime;
78
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
89
use Icinga\Module\Icingadb\Model\Behavior\ReRoute;
910
use ipl\Orm\Behavior\Binary;
@@ -12,6 +13,24 @@
1213
use ipl\Orm\Model;
1314
use ipl\Orm\Relations;
1415

16+
/**
17+
* @property string $id
18+
* @property string $environment_id
19+
* @property string $object_type
20+
* @property string $host_id
21+
* @property ?string $service_id
22+
* @property string $name_checksum
23+
* @property string $properties_checksum
24+
* @property string $name
25+
* @property string $author
26+
* @property string $text
27+
* @property string $entry_type
28+
* @property DateTime $entry_time
29+
* @property bool $is_persistent
30+
* @property bool $is_sticky
31+
* @property ?DateTime $expire_time
32+
* @property ?string $zone_id
33+
*/
1534
class Comment extends Model
1635
{
1736
public function getTableName()

Diff for: library/Icingadb/Model/CommentHistory.php

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Icinga\Module\Icingadb\Model;
66

7+
use DateTime;
78
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
89
use ipl\Orm\Behavior\Binary;
910
use ipl\Orm\Behavior\MillisecondTimestamp;
@@ -16,6 +17,23 @@
1617
*
1718
* Please note that using this model will fetch history entries for decommissioned services. To avoid this,
1819
* the query needs a `comment_history.service_id IS NULL OR comment_history_service.id IS NOT NULL` where.
20+
*
21+
* @property string $comment_id
22+
* @property string $environment_id
23+
* @property ?string $endpoint_id
24+
* @property string $object_type
25+
* @property string $host_id
26+
* @property ?string $service_id
27+
* @property DateTime $entry_time
28+
* @property string $author
29+
* @property ?string $removed_by
30+
* @property string $comment
31+
* @property string $entry_type
32+
* @property bool $is_persistent
33+
* @property bool $is_sticky
34+
* @property ?DateTime $expire_time
35+
* @property ?DateTime $remove_time
36+
* @property bool $has_been_removed
1937
*/
2038
class CommentHistory extends Model
2139
{

Diff for: library/Icingadb/Model/Customvar.php

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
use ipl\Orm\Model;
1010
use ipl\Orm\Relations;
1111

12+
/**
13+
* @property string $id
14+
* @property string $environment_id
15+
* @property string $name_checksum
16+
* @property string $name
17+
* @property string $value
18+
*/
1219
class Customvar extends Model
1320
{
1421
public function getTableName()

Diff for: library/Icingadb/Model/CustomvarFlat.php

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
use ipl\Orm\Relations;
1212
use Traversable;
1313

14+
/**
15+
* @property string $id
16+
* @property string $environment_id
17+
* @property string $customvar_id
18+
* @property string $flatname_checksum
19+
* @property string $flatname
20+
* @property ?string $flatvalue
21+
*/
1422
class CustomvarFlat extends Model
1523
{
1624
public function getTableName()

Diff for: library/Icingadb/Model/Downtime.php

+27
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Icinga\Module\Icingadb\Model;
66

7+
use DateTime;
78
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
89
use Icinga\Module\Icingadb\Model\Behavior\ReRoute;
910
use ipl\Orm\Behavior\Binary;
@@ -12,6 +13,32 @@
1213
use ipl\Orm\Model;
1314
use ipl\Orm\Relations;
1415

16+
/**
17+
* @property string $id
18+
* @property string $environment_id
19+
* @property ?string $triggered_by_id
20+
* @property ?string $parent_id
21+
* @property string $object_type
22+
* @property string $host_id
23+
* @property ?string $service_id
24+
* @property string $name_checksum
25+
* @property string $properties_checksum
26+
* @property string $name
27+
* @property string $author
28+
* @property string $comment
29+
* @property DateTime $entry_time
30+
* @property DateTime $scheduled_start_time
31+
* @property DateTime $scheduled_end_time
32+
* @property int $scheduled_duration
33+
* @property bool $is_flexible
34+
* @property int $flexible_duration
35+
* @property bool $is_in_effect
36+
* @property ?DateTime $start_time
37+
* @property ?DateTime $end_time
38+
* @property int $duration
39+
* @property ?string $scheduled_by
40+
* @property ?string $zone_id
41+
*/
1542
class Downtime extends Model
1643
{
1744
public function getTableName()

0 commit comments

Comments
 (0)