diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 19853b705..b27c01c76 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -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: @@ -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() }} @@ -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 }} @@ -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' diff --git a/library/Director/Dashboard/Dashboard.php b/library/Director/Dashboard/Dashboard.php index de8970c7f..3f1fc38b7 100644 --- a/library/Director/Dashboard/Dashboard.php +++ b/library/Director/Dashboard/Dashboard.php @@ -149,6 +149,7 @@ protected function createTabForDashboard(Dashboard $dashboard) ]); } + #[\ReturnTypeWillChange] public function count() { return count($this->dashlets()); diff --git a/library/Director/Data/Db/ServiceSetQueryBuilder.php b/library/Director/Data/Db/ServiceSetQueryBuilder.php index 7841d1eee..597fe0e68 100644 --- a/library/Director/Data/Db/ServiceSetQueryBuilder.php +++ b/library/Director/Data/Db/ServiceSetQueryBuilder.php @@ -27,6 +27,8 @@ class ServiceSetQueryBuilder /** @var \Zend_Db_Adapter_Abstract */ protected $db; + protected $searchColumns = []; + /** * @param ?UuidInterface $uuid */ diff --git a/library/Director/Db/Cache/CustomVariableCache.php b/library/Director/Db/Cache/CustomVariableCache.php index 243ecae94..ee2b9ef74 100644 --- a/library/Director/Db/Cache/CustomVariableCache.php +++ b/library/Director/Db/Cache/CustomVariableCache.php @@ -76,9 +76,4 @@ public function getVarsForObject(IcingaObject $object) return new CustomVariables(); } } - - public function __destruct() - { - unset($this->db); - } } diff --git a/library/Director/Objects/IcingaTemplateResolver.php b/library/Director/Objects/IcingaTemplateResolver.php index 61122a00d..7f149672c 100644 --- a/library/Director/Objects/IcingaTemplateResolver.php +++ b/library/Director/Objects/IcingaTemplateResolver.php @@ -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(); diff --git a/library/Director/StartupLogRenderer.php b/library/Director/StartupLogRenderer.php index bc7b3ea45..d9b532a74 100644 --- a/library/Director/StartupLogRenderer.php +++ b/library/Director/StartupLogRenderer.php @@ -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); diff --git a/library/Director/Test/TestSuiteLint.php b/library/Director/Test/TestSuiteLint.php index 41941eb59..0010c2868 100644 --- a/library/Director/Test/TestSuiteLint.php +++ b/library/Director/Test/TestSuiteLint.php @@ -10,6 +10,8 @@ class TestSuiteLint extends TestSuite protected $failed; + protected $result = []; + public function run() { $this->checked = $this->failed = array(); diff --git a/library/Director/Test/TestSuiteUnit.php b/library/Director/Test/TestSuiteUnit.php index 8156ebaaf..93dc69255 100644 --- a/library/Director/Test/TestSuiteUnit.php +++ b/library/Director/Test/TestSuiteUnit.php @@ -4,6 +4,8 @@ abstract class TestSuiteUnit { + private $testdoxFile; + public function run() { } @@ -15,7 +17,7 @@ public function __construct() public function __destruct() { if ($this->testdoxFile && file_exists($this->testdoxFile)) { - unlink($this->testDoxfile); + unlink($this->testdoxFile); } } diff --git a/library/Director/Web/Controller/Extension/SingleObjectApiHandler.php b/library/Director/Web/Controller/Extension/SingleObjectApiHandler.php deleted file mode 100644 index bc515482a..000000000 --- a/library/Director/Web/Controller/Extension/SingleObjectApiHandler.php +++ /dev/null @@ -1,236 +0,0 @@ -type = $type; - $this->request = $request; - $this->response = $response; - $this->params = $request->getUrl()->getParams(); - } - - public function runFailSafe() - { - try { - $this->loadObject(); - $this->run(); - } catch (NotFoundError $e) { - $this->sendJsonError($e->getMessage(), 404); - } catch (Exception $e) { - $response = $this->response; - if ($response->getHttpResponseCode() === 200) { - $response->setHttpResponseCode(500); - } - - $this->sendJsonError($e->getMessage()); - } - } - - protected function retrieveObject() - { - $this->requireObject(); - $this->sendJson( - $this->object->toPlainObject( - $this->params->shift('resolved'), - ! $this->params->shift('withNull'), - $this->params->shift('properties') - ) - ); - } - - protected function deleteObject() - { - $this->requireObject(); - $obj = $this->object->toPlainObject(false, true); - $form = new IcingaDeleteObjectForm(); - $form->setObject($this->object) - ->setRequest($this->request) - ->onSuccess(); - - $this->sendJson($obj); - } - - protected function storeObject() - { - $data = json_decode($this->request->getRawBody()); - - if ($data === null) { - $this->response->setHttpResponseCode(400); - throw new IcingaException( - 'Invalid JSON: %s' . $this->request->getRawBody(), - $this->getLastJsonError() - ); - } else { - $data = (array) $data; - } - - if ($object = $this->object) { - if ($this->request->getMethod() === 'POST') { - $object->setProperties($data); - } else { - $data = array_merge([ - 'object_type' => $object->object_type, - 'object_name' => $object->object_name - ], $data); - $object->replaceWith( - IcingaObject::createByType($this->type, $data, $db) - ); - } - } else { - $object = IcingaObject::createByType($this->type, $data, $db); - } - - if ($object->hasBeenModified()) { - $status = $object->hasBeenLoadedFromDb() ? 200 : 201; - $object->store(); - $this->response->setHttpResponseCode($status); - } else { - $this->response->setHttpResponseCode(304); - } - - $this->sendJson($object->toPlainObject(false, true)); - } - - public function run() - { - switch ($this->request->getMethod()) { - case 'DELETE': - $this->deleteObject(); - break; - - case 'POST': - case 'PUT': - $this->storeObject(); - break; - - case 'GET': - $this->retrieveObject(); - break; - - default: - $this->response->setHttpResponseCode(400); - throw new IcingaException( - 'Unsupported method: %s', - $this->request->getMethod() - ); - } - } - - protected function requireObject() - { - if (! $this->object) { - $this->response->setHttpResponseCode(404); - if (! $this->params->get('name')) { - throw new NotFoundError('You need to pass a "name" parameter to access a specific object'); - } else { - throw new NotFoundError('No such object available'); - } - } - } - - // TODO: just return json_last_error_msg() for PHP >= 5.5.0 - protected function getLastJsonError() - { - switch (json_last_error()) { - case JSON_ERROR_DEPTH: - return 'The maximum stack depth has been exceeded'; - case JSON_ERROR_CTRL_CHAR: - return 'Control character error, possibly incorrectly encoded'; - case JSON_ERROR_STATE_MISMATCH: - return 'Invalid or malformed JSON'; - case JSON_ERROR_SYNTAX: - return 'Syntax error'; - case JSON_ERROR_UTF8: - return 'Malformed UTF-8 characters, possibly incorrectly encoded'; - default: - return 'An error occured when parsing a JSON string'; - } - } - - protected function sendJson($object) - { - $this->response->setHeader('Content-Type', 'application/json', true); - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - echo json_encode($object, JSON_PRETTY_PRINT) . "\n"; - } - - protected function sendJsonError($message, $code = null) - { - $response = $this->response; - - if ($code !== null) { - $response->setHttpResponseCode((int) $code); - } - - $this->sendJson((object) ['error' => $message]); - } - - protected function loadObject() - { - if ($this->object === null) { - if ($name = $this->params->get('name')) { - $this->object = IcingaObject::loadByType( - $this->type, - $name, - $this->db() - ); - - if (! $this->allowsObject($this->object)) { - $this->object = null; - throw new NotFoundError('No such object available'); - } - } elseif ($id = $this->params->get('id')) { - $this->object = IcingaObject::loadByType( - $this->type, - (int) $id, - $this->db() - ); - } elseif ($this->request->isApiRequest()) { - if ($this->request->isGet()) { - $this->response->setHttpResponseCode(422); - - throw new InvalidPropertyException( - 'Cannot load object, missing parameters' - ); - } - } - } - - return $this->object; - } - - protected function allowsObject(IcingaObject $object) - { - return true; - } -} diff --git a/library/Director/Web/Form/IplElement/ExtensibleSetElement.php b/library/Director/Web/Form/IplElement/ExtensibleSetElement.php index a4dbb2075..5df4983ea 100644 --- a/library/Director/Web/Form/IplElement/ExtensibleSetElement.php +++ b/library/Director/Web/Form/IplElement/ExtensibleSetElement.php @@ -26,6 +26,8 @@ class ExtensibleSetElement extends BaseHtmlElement private $description; + private $descriptions; + private $multiOptions; private $validOptions; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..0d91fb260 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,716 @@ +parameters: + ignoreErrors: + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: application/controllers/BranchController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: application/controllers/BranchController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Table\\\\ObjectsTable\\:\\:setType\\(\\)\\.$#" + count: 1 + path: application/controllers/CommandsController.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: application/controllers/ConfigController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: application/controllers/ConfigController.php + + - + message: "#^Call to an undefined method Icinga\\\\Web\\\\View\\:\\:formSelect\\(\\)\\.$#" + count: 2 + path: application/controllers/ConfigController.php + + - + message: "#^Variable \\$config might not be defined\\.$#" + count: 1 + path: application/controllers/ConfigController.php + + - + message: "#^Call to an undefined method Icinga\\\\Data\\\\Filter\\\\Filter\\:\\:filters\\(\\)\\.$#" + count: 2 + path: application/controllers/HostsController.php + + - + message: "#^PHPDoc tag @var has invalid value \\(\\$filter FilterChain\\)\\: Unexpected token \"\\$filter\", expected type at offset 9$#" + count: 2 + path: application/controllers/HostsController.php + + - + message: "#^PHPDoc tag @var has invalid value \\(\\$sub FilterChain\\)\\: Unexpected token \"\\$sub\", expected type at offset 9$#" + count: 2 + path: application/controllers/HostsController.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: application/controllers/ImportsourceController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: application/controllers/ImportsourceController.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: application/controllers/JobController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: application/controllers/JobController.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: application/controllers/KickstartController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: application/controllers/KickstartController.php + + - + message: "#^Variable \\$tab in PHPDoc tag @var does not exist\\.$#" + count: 1 + path: application/controllers/NotificationController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\DirectorObjectForm\\:\\:createApplyRuleFor\\(\\)\\.$#" + count: 1 + path: application/controllers/ServiceController.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: application/controllers/SyncruleController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: application/controllers/SyncruleController.php + + - + message: "#^Variable \\$after might not be defined\\.$#" + count: 3 + path: application/controllers/SyncruleController.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: application/controllers/TemplatechoiceController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: application/controllers/TemplatechoiceController.php + + - + message: "#^Call to an undefined method Zend_View_Interface\\:\\:icon\\(\\)\\.$#" + count: 1 + path: application/forms/DeployConfigForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getSettings\\(\\)\\.$#" + count: 2 + path: application/forms/DirectorDatafieldForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getSettings\\(\\)\\.$#" + count: 1 + path: application/forms/DirectorJobForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getObjectName\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaAddServiceSetForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getResolvedProperty\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaAddServiceSetForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:setImports\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaDependencyForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getAppliedGroups\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaHostForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getGroups\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaHostForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Forms\\\\IcingaImportObjectForm\\:\\:addNote\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaImportObjectForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getUrlParams\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaScheduledDowntimeForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:isApplyRule\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaScheduledDowntimeForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:isApplyRule\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaServiceDictionaryMemberForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:isApplyRule\\(\\)\\.$#" + count: 2 + path: application/forms/IcingaServiceForm.php + + - + message: "#^Cannot cast Icinga\\\\Data\\\\Filter\\\\Filter to string\\.$#" + count: 1 + path: application/forms/IcingaServiceForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getResolvedProperty\\(\\)\\.$#" + count: 1 + path: application/forms/IcingaServiceSetForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getSetting\\(\\)\\.$#" + count: 1 + path: application/forms/ImportRowModifierForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getSettings\\(\\)\\.$#" + count: 1 + path: application/forms/ImportRowModifierForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getSettings\\(\\)\\.$#" + count: 1 + path: application/forms/ImportSourceForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Forms\\\\RestoreBasketForm\\:\\:Window\\(\\)\\.$#" + count: 1 + path: application/forms/RestoreBasketForm.php + + - + message: "#^Function translate not found\\.$#" + count: 8 + path: application/locale/translateMe.php + + - + message: "#^Call to an undefined method Zend_View_Interface\\:\\:formIplExtensibleSet\\(\\)\\.$#" + count: 1 + path: application/views/helpers/FormDataFilter.php + + - + message: "#^Call to an undefined method Zend_View_Interface\\:\\:formSelect\\(\\)\\.$#" + count: 1 + path: application/views/helpers/FormDataFilter.php + + - + message: "#^Call to an undefined method Zend_View_Interface\\:\\:formSubmit\\(\\)\\.$#" + count: 1 + path: application/views/helpers/FormDataFilter.php + + - + message: "#^Call to an undefined method Zend_View_Interface\\:\\:formText\\(\\)\\.$#" + count: 4 + path: application/views/helpers/FormDataFilter.php + + - + message: "#^Call to an undefined method Zend_View_Interface\\:\\:translate\\(\\)\\.$#" + count: 1 + path: application/views/helpers/FormDataFilter.php + + - + message: "#^Variable \\$id might not be defined\\.$#" + count: 1 + path: application/views/helpers/FormStoredPassword.php + + - + message: "#^Binary operation \"\\*\\=\" between string and 1024 results in an error\\.$#" + count: 1 + path: library/Director/Application/MemoryLimit.php + + - + message: "#^Constructor of class Icinga\\\\Module\\\\Director\\\\Core\\\\RestApiClient has an unused parameter \\$cn\\.$#" + count: 1 + path: library/Director/Core/RestApiClient.php + + - + message: "#^Binary operation \"\\*\" between string and 1000 results in an error\\.$#" + count: 1 + path: library/Director/Daemon/DaemonUtil.php + + - + message: "#^Anonymous function has an unused use \\$id\\.$#" + count: 2 + path: library/Director/Daemon/JobRunner.php + + - + message: "#^Variable \\$hook in PHPDoc tag @var does not exist\\.$#" + count: 1 + path: library/Director/Dashboard/BranchesDashboard.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Restriction\\\\HostgroupRestriction\\:\\:applyToHostGroupsQuery\\(\\)\\.$#" + count: 1 + path: library/Director/Dashboard/Dashboard.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbConnection\\:\\:db\\(\\)\\.$#" + count: 1 + path: library/Director/Data/Db/DbConnection.php + + - + message: "#^Call to an undefined method Icinga\\\\Data\\\\Filter\\\\Filter\\:\\:filters\\(\\)\\.$#" + count: 1 + path: library/Director/Data/Db/IcingaObjectFilterRenderer.php + + - + message: "#^Variable \\$filter in PHPDoc tag @var does not match any variable in the foreach loop\\: \\$sub$#" + count: 1 + path: library/Director/Data/Db/IcingaObjectFilterRenderer.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\IcingaObjectQuery\\:\\:tableAliases\\(\\)\\.$#" + count: 1 + path: library/Director/Data/Db/IcingaObjectQuery.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getObjectName\\(\\)\\.$#" + count: 1 + path: library/Director/Data/Db/ServiceSetQueryBuilder.php + + - + message: "#^Access to an undefined property object\\:\\:\\$datalist\\.$#" + count: 1 + path: library/Director/Data/Exporter.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$id$#" + count: 1 + path: library/Director/Data/FieldReferenceLoader.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:toPlainObject\\(\\)\\.$#" + count: 1 + path: library/Director/Data/HostServiceLoader.php + + - + message: "#^Call to an undefined static method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:fromPlainObject\\(\\)\\.$#" + count: 1 + path: library/Director/Data/HostServiceLoader.php + + - + message: "#^PHPDoc tag @param for parameter \\$implementation with type class\\-string\\|Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject is not subtype of native type string\\.$#" + count: 1 + path: library/Director/Data/ObjectImporter.php + + - + message: "#^Access to an undefined property object\\:\\:\\$format\\.$#" + count: 1 + path: library/Director/Data/PropertiesFilter/ArrayCustomVariablesFilter.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$object$#" + count: 1 + path: library/Director/Data/SerializableValue.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\QuickForm\\:\\:getDb\\(\\)\\.$#" + count: 1 + path: library/Director/DataType/DataTypeDatalist.php + + - + message: "#^Call to an undefined method Icinga\\\\Application\\\\ApplicationBootstrap\\:\\:getRequest\\(\\)\\.$#" + count: 1 + path: library/Director/Db/Branch/Branch.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$db$#" + count: 1 + path: library/Director/Db/Branch/Branch.php + + - + message: "#^PHPDoc tag @var has invalid value \\(@var string\\)\\: Unexpected token \"@var\", expected type at offset 9$#" + count: 1 + path: library/Director/Db/Branch/Branch.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Db\\\\Branch\\\\Branch\\:\\:getBytes\\(\\)\\.$#" + count: 1 + path: library/Director/Db/Branch/BranchMerger.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:toPlainObject\\(\\)\\.$#" + count: 1 + path: library/Director/Db/Branch/BranchedObject.php + + - + message: "#^Call to an undefined method Zend_Db_Adapter_Abstract\\:\\:exec\\(\\)\\.$#" + count: 4 + path: library/Director/Db/Housekeeping.php + + - + message: "#^Variable \\$helper in PHPDoc tag @var does not exist\\.$#" + count: 1 + path: library/Director/Db/MembershipHousekeeping.php + + - + message: "#^Variable \\$object in PHPDoc tag @var does not exist\\.$#" + count: 2 + path: library/Director/DirectorObject/Automation/BasketSnapshot.php + + - + message: "#^Access to an undefined property object\\:\\:\\$datalist_id\\.$#" + count: 1 + path: library/Director/DirectorObject/Automation/BasketSnapshotFieldResolver.php + + - + message: "#^Binary operation \"\\|\" between string\\|false and string results in an error\\.$#" + count: 1 + path: library/Director/Filter/CidrExpression.php + + - + message: "#^Class Icinga\\\\Module\\\\Director\\\\Db\\\\Branch\\\\BranchStore referenced with incorrect case\\: Icinga\\\\Module\\\\Director\\\\Db\\\\Branch\\\\BranchSTore\\.$#" + count: 3 + path: library/Director/Hook/BranchSupportHook.php + + - + message: "#^Call to an undefined method Icinga\\\\Application\\\\ApplicationBootstrap\\:\\:getRequest\\(\\)\\.$#" + count: 1 + path: library/Director/IcingaConfig/AgentWizard.php + + - + message: "#^Binary operation \"\\*\" between string and 3600 results in an error\\.$#" + count: 1 + path: library/Director/IcingaConfig/IcingaConfigHelper.php + + - + message: "#^Binary operation \"\\*\" between string and 60 results in an error\\.$#" + count: 1 + path: library/Director/IcingaConfig/IcingaConfigHelper.php + + - + message: "#^Binary operation \"\\*\" between string and 86400 results in an error\\.$#" + count: 1 + path: library/Director/IcingaConfig/IcingaConfigHelper.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\QuickForm\\:\\:getSentOrObjectSetting\\(\\)\\.$#" + count: 3 + path: library/Director/Import/ImportSourceRestApi.php + + - + message: "#^Access to an undefined property object\\:\\:\\$order\\.$#" + count: 1 + path: library/Director/Objects/IcingaCommandArgument.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Objects\\\\IcingaService\\:\\:assignments\\(\\)\\.$#" + count: 1 + path: library/Director/Objects/IcingaDependency.php + + - + message: "#^Call to an undefined static method Icinga\\\\Module\\\\Director\\\\Objects\\\\IcingaObject\\:\\:renderAssignments\\(\\)\\.$#" + count: 1 + path: library/Director/Objects/IcingaDependency.php + + - + message: "#^Default value of the parameter \\#2 \\$preserve \\(array\\) of method Icinga\\\\Module\\\\Director\\\\Objects\\\\IcingaObject\\:\\:replaceWith\\(\\) is incompatible with type null\\.$#" + count: 1 + path: library/Director/Objects/IcingaObject.php + + - + message: "#^Static call to instance method stdClass\\:\\:getKeyColumnName\\(\\)\\.$#" + count: 1 + path: library/Director/Objects/IcingaObject.php + + - + message: "#^Variable \\$imports in PHPDoc tag @var does not exist\\.$#" + count: 1 + path: library/Director/Objects/IcingaObject.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$filter$#" + count: 1 + path: library/Director/Objects/IcingaObjectField.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Objects\\\\IcingaRanges\\:\\:\\$objectIdColumn\\.$#" + count: 3 + path: library/Director/Objects/IcingaRanges.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Objects\\\\IcingaRanges\\:\\:\\$rangeClass\\.$#" + count: 1 + path: library/Director/Objects/IcingaRanges.php + + - + message: "#^Call to protected method getRelationObjectClass\\(\\) of class Icinga\\\\Module\\\\Director\\\\Objects\\\\IcingaObject\\.$#" + count: 1 + path: library/Director/Objects/IcingaRelatedObject.php + + - + message: "#^Undefined variable\\: \\$object$#" + count: 2 + path: library/Director/Objects/IcingaRelatedObject.php + + - + message: "#^Undefined variable\\: \\$name$#" + count: 1 + path: library/Director/Objects/IcingaTemplateResolver.php + + - + message: "#^Undefined variable\\: \\$type$#" + count: 2 + path: library/Director/Objects/IcingaTemplateResolver.php + + - + message: "#^Variable \\$obj in PHPDoc tag @var does not exist\\.$#" + count: 1 + path: library/Director/Objects/ImportRowModifier.php + + - + message: "#^Call to an undefined method Icinga\\\\Data\\\\Filter\\\\Filter\\:\\:filters\\(\\)\\.$#" + count: 1 + path: library/Director/Objects/ObjectApplyMatches.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\QuickForm\\:\\:getDb\\(\\)\\.$#" + count: 1 + path: library/Director/PropertyModifier/PropertyModifierMap.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\QuickForm\\:\\:getSetting\\(\\)\\.$#" + count: 1 + path: library/Director/PropertyModifier/PropertyModifierMap.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\QuickForm\\:\\:getSetting\\(\\)\\.$#" + count: 1 + path: library/Director/PropertyModifier/PropertyModifierRejectOrSelect.php + + - + message: "#^Call to an undefined method ipl\\\\Stdlib\\\\Filter\\\\Rule\\:\\:getValue\\(\\)\\.$#" + count: 3 + path: library/Director/ProvidedHook/IcingaDbCubeLinks.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Test\\\\TestSuiteUnit\\:\\:newTempfile\\(\\)\\.$#" + count: 1 + path: library/Director/Test/TestSuiteUnit.php + + - + message: "#^Access to an undefined property Zend_Controller_Action_HelperBroker\\:\\:\\$viewRenderer\\.$#" + count: 1 + path: library/Director/Web/Controller/ActionController.php + + - + message: "#^Access to an undefined property Zend_View_Interface\\:\\:\\$compact\\.$#" + count: 1 + path: library/Director/Web/Controller/ActionController.php + + - + message: "#^Access to an undefined property Zend_View_Interface\\:\\:\\$controls\\.$#" + count: 1 + path: library/Director/Web/Controller/ActionController.php + + - + message: "#^Call to an undefined method Zend_Controller_Action_HelperBroker\\:\\:layout\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Controller/ActionController.php + + - + message: "#^Call to an undefined method Zend_Controller_Request_Abstract\\:\\:getHeader\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Controller/ActionController.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: library/Director/Web/Controller/ObjectController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Controller/ObjectController.php + + - + message: "#^Access to an undefined property Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:\\$branch\\.$#" + count: 1 + path: library/Director/Web/Controller/ObjectsController.php + + - + message: "#^Call to an undefined method Icinga\\\\Data\\\\Filter\\\\Filter\\:\\:filters\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Controller/ObjectsController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getObjectName\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Controller/ObjectsController.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Controller\\\\ActionController\\:\\:getBranchStore\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Controller/ObjectsController.php + + - + message: "#^PHPDoc tag @var has invalid value \\(\\$ex FilterChain\\|FilterExpression\\)\\: Unexpected token \"\\$ex\", expected type at offset 9$#" + count: 1 + path: library/Director/Web/Controller/ObjectsController.php + + - + message: "#^PHPDoc tag @var has invalid value \\(\\$filter FilterChain\\)\\: Unexpected token \"\\$filter\", expected type at offset 9$#" + count: 1 + path: library/Director/Web/Controller/ObjectsController.php + + - + message: "#^PHPDoc tag @var has invalid value \\(\\$sub FilterChain\\)\\: Unexpected token \"\\$sub\", expected type at offset 9$#" + count: 1 + path: library/Director/Web/Controller/ObjectsController.php + + - + message: "#^Undefined variable\\: \\$elementValue$#" + count: 1 + path: library/Director/Web/Form/CsrfToken.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:getShortTableName\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Form/DirectorObjectForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:listImportNames\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Form/DirectorObjectForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:ranges\\(\\)\\.$#" + count: 2 + path: library/Director/Web/Form/DirectorObjectForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:supportsApplyRules\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Form/DirectorObjectForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Data\\\\Db\\\\DbObject\\:\\:supportsImports\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Form/DirectorObjectForm.php + + - + message: "#^Class Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\Element\\\\Boolean referenced with incorrect case\\: Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\Element\\\\boolean\\.$#" + count: 1 + path: library/Director/Web/Form/Element/InstanceSummary.php + + - + message: "#^Class Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\Element\\\\Boolean referenced with incorrect case\\: Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\Element\\\\boolean\\.$#" + count: 1 + path: library/Director/Web/Form/Element/SimpleNote.php + + - + message: "#^Variable \\$file might not be defined\\.$#" + count: 1 + path: library/Director/Web/Form/FormLoader.php + + - + message: "#^PHPDoc tag @var has invalid value \\(\\$filter FilterChain\\|FilterExpression\\)\\: Unexpected token \"\\$filter\", expected type at offset 9$#" + count: 1 + path: library/Director/Web/Form/IcingaObjectFieldLoader.php + + - + message: "#^Variable \\$hook in PHPDoc tag @var does not match assigned variable \\$type\\.$#" + count: 1 + path: library/Director/Web/Form/IcingaObjectFieldLoader.php + + - + message: "#^PHPDoc tag @var above assignment does not specify variable name\\.$#" + count: 1 + path: library/Director/Web/Form/QuickBaseForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Application\\\\ApplicationBootstrap\\:\\:getFrontController\\(\\)\\.$#" + count: 4 + path: library/Director/Web/Form/QuickForm.php + + - + message: "#^Variable \\$req in PHPDoc tag @var does not exist\\.$#" + count: 1 + path: library/Director/Web/Form/QuickForm.php + + - + message: "#^Call to an undefined method Icinga\\\\Application\\\\ApplicationBootstrap\\:\\:getRequest\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Navigation/Renderer/ConfigHealthItemRenderer.php + + - + message: "#^PHPDoc tag @var has invalid value \\(\\$app Web\\)\\: Unexpected token \"\\$app\", expected type at offset 9$#" + count: 1 + path: library/Director/Web/Navigation/Renderer/ConfigHealthItemRenderer.php + + - + message: "#^Method gipfl\\\\IcingaWeb2\\\\Widget\\\\ControlsAndContent\\:\\:addTitle\\(\\) invoked with 2 parameters, 1 required\\.$#" + count: 1 + path: library/Director/Web/ObjectPreview.php + + - + message: "#^Access to an undefined property object\\:\\:\\$object_name\\.$#" + count: 2 + path: library/Director/Web/Table/GroupMemberTable.php + + - + message: "#^Comparison operation \"\\<\" between \\(array\\|float\\|int\\) and int\\<1, max\\> results in an error\\.$#" + count: 1 + path: library/Director/Web/Table/JobTable.php + + - + message: "#^Method ipl\\\\Html\\\\BaseHtmlElement\\:\\:tag\\(\\) invoked with 3 parameters, 0 required\\.$#" + count: 1 + path: library/Director/Web/Table/PropertymodifierTable.php + + - + message: "#^Call to an undefined method Icinga\\\\Application\\\\ApplicationBootstrap\\:\\:getViewRenderer\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Table/QuickTable.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Table\\\\QuickTable\\:\\:renderAdditionalActions\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Table/QuickTable.php + + - + message: "#^Call to an undefined method Icinga\\\\Web\\\\Widget\\\\AbstractWidget\\:\\:setColumns\\(\\)\\.$#" + count: 1 + path: library/Director/Web/Table/QuickTable.php + + - + message: "#^Variable \\$file might not be defined\\.$#" + count: 1 + path: library/Director/Web/Table/TableLoader.php + + - + message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Widget\\\\IcingaObjectInspection\\:\\:db\\(\\)\\.$#" + count: 2 + path: library/Director/Web/Widget/IcingaObjectInspection.php diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..a3df34c06 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,32 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 2 + + checkFunctionNameCase: false + checkInternalClassCaseSensitivity: false + treatPhpDocTypesAsCertain: false + + paths: + - application + - library/Director + + ignoreErrors: + - '#Unsafe usage of new static\(\)#' + - '#. but return statement is missing#' + + scanDirectories: + - vendor + - library/Director/Test + excludePaths: + - library/Director/CoreBeta + + universalObjectCratesClasses: + - Icinga\Module\Director\Data\Db\DbObject + - Icinga\Data\ConfigObject + - Icinga\Web\View + - Icinga\Module\Monitoring\Object\MonitoredObject + - Icinga\Module\Monitoring\DataView\DataView + - Icinga\Web\Session\SessionNamespace + - Icinga\User\Preferences