diff --git a/.phpcs.xml b/.phpcs.xml deleted file mode 100644 index 037cac58d..000000000 --- a/.phpcs.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - Sniff our code a while - - ./ - - vendor/* - - - - - - - - - - - - - - - - - - - diff --git a/application/forms/Command/Object/ToggleObjectFeaturesForm.php b/application/forms/Command/Object/ToggleObjectFeaturesForm.php index 8b2d2d251..d9977587f 100644 --- a/application/forms/Command/Object/ToggleObjectFeaturesForm.php +++ b/application/forms/Command/Object/ToggleObjectFeaturesForm.php @@ -16,7 +16,7 @@ class ToggleObjectFeaturesForm extends CommandForm { use Auth; - const LEAVE_UNCHANGED = 'noop'; + public const LEAVE_UNCHANGED = 'noop'; protected $features; diff --git a/library/Icingadb/Command/Instance/ToggleInstanceFeatureCommand.php b/library/Icingadb/Command/Instance/ToggleInstanceFeatureCommand.php index d275d9b30..ed54852fa 100644 --- a/library/Icingadb/Command/Instance/ToggleInstanceFeatureCommand.php +++ b/library/Icingadb/Command/Instance/ToggleInstanceFeatureCommand.php @@ -14,32 +14,32 @@ class ToggleInstanceFeatureCommand extends IcingaCommand /** * Feature for enabling or disabling active host checks on an Icinga instance */ - const FEATURE_ACTIVE_HOST_CHECKS = 'active_host_checks_enabled'; + public const FEATURE_ACTIVE_HOST_CHECKS = 'active_host_checks_enabled'; /** * Feature for enabling or disabling active service checks on an Icinga instance */ - const FEATURE_ACTIVE_SERVICE_CHECKS = 'active_service_checks_enabled'; + public const FEATURE_ACTIVE_SERVICE_CHECKS = 'active_service_checks_enabled'; /** * Feature for enabling or disabling host and service event handlers on an Icinga instance */ - const FEATURE_EVENT_HANDLERS = 'event_handlers_enabled'; + public const FEATURE_EVENT_HANDLERS = 'event_handlers_enabled'; /** * Feature for enabling or disabling host and service flap detection on an Icinga instance */ - const FEATURE_FLAP_DETECTION = 'flap_detection_enabled'; + public const FEATURE_FLAP_DETECTION = 'flap_detection_enabled'; /** * Feature for enabling or disabling host and service notifications on an Icinga instance */ - const FEATURE_NOTIFICATIONS = 'notifications_enabled'; + public const FEATURE_NOTIFICATIONS = 'notifications_enabled'; /** * Feature for enabling or disabling the processing of host and service performance data on an Icinga instance */ - const FEATURE_PERFORMANCE_DATA = 'process_performance_data'; + public const FEATURE_PERFORMANCE_DATA = 'process_performance_data'; /** * Feature that is to be enabled or disabled diff --git a/library/Icingadb/Command/Object/ProcessCheckResultCommand.php b/library/Icingadb/Command/Object/ProcessCheckResultCommand.php index 3d7e956e5..02581db87 100644 --- a/library/Icingadb/Command/Object/ProcessCheckResultCommand.php +++ b/library/Icingadb/Command/Object/ProcessCheckResultCommand.php @@ -12,32 +12,32 @@ class ProcessCheckResultCommand extends ObjectCommand /** * Host up */ - const HOST_UP = 0; + public const HOST_UP = 0; /** * Host down */ - const HOST_DOWN = 1; + public const HOST_DOWN = 1; /** * Service ok */ - const SERVICE_OK = 0; + public const SERVICE_OK = 0; /** * Service warning */ - const SERVICE_WARNING = 1; + public const SERVICE_WARNING = 1; /** * Service critical */ - const SERVICE_CRITICAL = 2; + public const SERVICE_CRITICAL = 2; /** * Service unknown */ - const SERVICE_UNKNOWN = 3; + public const SERVICE_UNKNOWN = 3; /** * Status code of the host or service check result diff --git a/library/Icingadb/Command/Object/ToggleObjectFeatureCommand.php b/library/Icingadb/Command/Object/ToggleObjectFeatureCommand.php index 699a11339..77446387b 100644 --- a/library/Icingadb/Command/Object/ToggleObjectFeatureCommand.php +++ b/library/Icingadb/Command/Object/ToggleObjectFeatureCommand.php @@ -12,31 +12,31 @@ class ToggleObjectFeatureCommand extends ObjectCommand /** * Feature for enabling or disabling active checks of a host or service */ - const FEATURE_ACTIVE_CHECKS = 'active_checks_enabled'; + public const FEATURE_ACTIVE_CHECKS = 'active_checks_enabled'; /** * Feature for enabling or disabling passive checks of a host or service */ - const FEATURE_PASSIVE_CHECKS = 'passive_checks_enabled'; + public const FEATURE_PASSIVE_CHECKS = 'passive_checks_enabled'; /** * Feature for enabling or disabling notifications for a host or service * * Notifications will be sent out only if notifications are enabled on a program-wide basis as well. */ - const FEATURE_NOTIFICATIONS = 'notifications_enabled'; + public const FEATURE_NOTIFICATIONS = 'notifications_enabled'; /** * Feature for enabling or disabling event handler for a host or service */ - const FEATURE_EVENT_HANDLER = 'event_handler_enabled'; + public const FEATURE_EVENT_HANDLER = 'event_handler_enabled'; /** * Feature for enabling or disabling flap detection for a host or service. * * In order to enable flap detection flap detection must be enabled on a program-wide basis as well. */ - const FEATURE_FLAP_DETECTION = 'flapping_enabled'; + public const FEATURE_FLAP_DETECTION = 'flapping_enabled'; /** * Feature that is to be enabled or disabled diff --git a/library/Icingadb/Command/Transport/ApiCommandTransport.php b/library/Icingadb/Command/Transport/ApiCommandTransport.php index 674a33973..164be4b71 100644 --- a/library/Icingadb/Command/Transport/ApiCommandTransport.php +++ b/library/Icingadb/Command/Transport/ApiCommandTransport.php @@ -22,7 +22,7 @@ class ApiCommandTransport implements CommandTransportInterface /** * Transport identifier */ - const TRANSPORT = 'api'; + public const TRANSPORT = 'api'; /** * API host diff --git a/library/Icingadb/Common/HostStates.php b/library/Icingadb/Common/HostStates.php index b3a9473ee..0863ba0c4 100644 --- a/library/Icingadb/Common/HostStates.php +++ b/library/Icingadb/Common/HostStates.php @@ -9,13 +9,13 @@ */ class HostStates { - const UP = 0; + public const UP = 0; - const DOWN = 1; + public const DOWN = 1; - const UNREACHABLE = 2; + public const UNREACHABLE = 2; - const PENDING = 99; + public const PENDING = 99; /** * Get the integer value of the given textual host state diff --git a/library/Icingadb/Common/Icons.php b/library/Icingadb/Common/Icons.php index cac9f3249..1a2380a75 100644 --- a/library/Icingadb/Common/Icons.php +++ b/library/Icingadb/Common/Icons.php @@ -6,25 +6,25 @@ class Icons { - const COMMENT = 'comment'; + public const COMMENT = 'comment'; - const HOST_DOWN = 'sitemap'; + public const HOST_DOWN = 'sitemap'; - const IN_DOWNTIME = 'plug'; + public const IN_DOWNTIME = 'plug'; - const IS_ACKNOWLEDGED = 'check'; + public const IS_ACKNOWLEDGED = 'check'; - const IS_FLAPPING = 'bolt'; + public const IS_FLAPPING = 'bolt'; - const IS_PERSISTENT = 'thumbtack'; + public const IS_PERSISTENT = 'thumbtack'; - const NOTIFICATION = 'bell'; + public const NOTIFICATION = 'bell'; - const REMOVE = 'trash'; + public const REMOVE = 'trash'; - const USER = 'user'; + public const USER = 'user'; - const USERGROUP = 'users'; + public const USERGROUP = 'users'; - const WARNING = 'exclamation-triangle'; + public const WARNING = 'exclamation-triangle'; } diff --git a/library/Icingadb/Common/ServiceStates.php b/library/Icingadb/Common/ServiceStates.php index 526f95ebe..27ee18311 100644 --- a/library/Icingadb/Common/ServiceStates.php +++ b/library/Icingadb/Common/ServiceStates.php @@ -9,15 +9,15 @@ */ class ServiceStates { - const OK = 0; + public const OK = 0; - const WARNING = 1; + public const WARNING = 1; - const CRITICAL = 2; + public const CRITICAL = 2; - const UNKNOWN = 3; + public const UNKNOWN = 3; - const PENDING = 99; + public const PENDING = 99; /** * Get the integer value of the given textual service state diff --git a/library/Icingadb/Compat/UrlMigrator.php b/library/Icingadb/Compat/UrlMigrator.php index 6eef3cad0..2f3ebf041 100644 --- a/library/Icingadb/Compat/UrlMigrator.php +++ b/library/Icingadb/Compat/UrlMigrator.php @@ -11,13 +11,13 @@ class UrlMigrator { - const NO_YES = ['n', 'y']; - const USE_EXPR = 'use-expr'; - const SORT_ONLY = 'sort-only'; - const LOWER_EXPR = 'lower-expr'; - const DROP = 'drop'; + public const NO_YES = ['n', 'y']; + public const USE_EXPR = 'use-expr'; + public const SORT_ONLY = 'sort-only'; + public const LOWER_EXPR = 'lower-expr'; + public const DROP = 'drop'; - const SUPPORTED_PATHS = [ + public const SUPPORTED_PATHS = [ 'monitoring/list/hosts' => ['hosts', 'icingadb/hosts'], 'monitoring/hosts/show' => ['multipleHosts', 'icingadb/hosts/details'], 'monitoring/host/show' => ['host', 'icingadb/host'], diff --git a/library/Icingadb/Data/PivotTable.php b/library/Icingadb/Data/PivotTable.php index 2819e11b5..7afc7540f 100644 --- a/library/Icingadb/Data/PivotTable.php +++ b/library/Icingadb/Data/PivotTable.php @@ -11,7 +11,7 @@ class PivotTable { - const SORT_ASC = 'asc'; + public const SORT_ASC = 'asc'; /** * The query to fetch as pivot table diff --git a/library/Icingadb/Hook/ExtensionHook/BaseExtensionHook.php b/library/Icingadb/Hook/ExtensionHook/BaseExtensionHook.php index dfefdcdec..13c436708 100644 --- a/library/Icingadb/Hook/ExtensionHook/BaseExtensionHook.php +++ b/library/Icingadb/Hook/ExtensionHook/BaseExtensionHook.php @@ -11,38 +11,38 @@ abstract class BaseExtensionHook use HookUtils; /** @var int Used as default return value for {@see BaseExtensionHook::getLocation()} */ - const IDENTIFY_LOCATION_BY_SECTION = -1; + public const IDENTIFY_LOCATION_BY_SECTION = -1; /** @var string Output section, right at the top */ - const OUTPUT_SECTION = 'output'; + public const OUTPUT_SECTION = 'output'; /** @var string Graph section, below output */ - const GRAPH_SECTION = 'graph'; + public const GRAPH_SECTION = 'graph'; /** @var string Detail section, below graphs */ - const DETAIL_SECTION = 'detail'; + public const DETAIL_SECTION = 'detail'; /** @var string Action section, below action and note urls */ - const ACTION_SECTION = 'action'; + public const ACTION_SECTION = 'action'; /** @var string Problem section, below comments and downtimes */ - const PROBLEM_SECTION = 'problem'; + public const PROBLEM_SECTION = 'problem'; /** @var string Related section, below groups and notification recipients */ - const RELATED_SECTION = 'related'; + public const RELATED_SECTION = 'related'; /** @var string State section, below check statistics and performance data */ - const STATE_SECTION = 'state'; + public const STATE_SECTION = 'state'; /** @var string Config section, below custom variables and feature toggles */ - const CONFIG_SECTION = 'config'; + public const CONFIG_SECTION = 'config'; /** * Base locations for all known sections * * @var array */ - const BASE_LOCATIONS = [ + public const BASE_LOCATIONS = [ self::OUTPUT_SECTION => 1000, self::GRAPH_SECTION => 1100, self::DETAIL_SECTION => 1200, diff --git a/library/Icingadb/Hook/IcingadbSupportHook.php b/library/Icingadb/Hook/IcingadbSupportHook.php index cd43a5ac8..416dcf2c5 100644 --- a/library/Icingadb/Hook/IcingadbSupportHook.php +++ b/library/Icingadb/Hook/IcingadbSupportHook.php @@ -13,7 +13,7 @@ abstract class IcingadbSupportHook use HookUtils; /** @var string key name of preference */ - const PREFERENCE_NAME = 'icingadb.as_backend'; + public const PREFERENCE_NAME = 'icingadb.as_backend'; /** * Return whether your module supports IcingaDB or not diff --git a/library/Icingadb/Model/Behavior/ReRoute.php b/library/Icingadb/Model/Behavior/ReRoute.php index d054f00e3..a7a3fb124 100644 --- a/library/Icingadb/Model/Behavior/ReRoute.php +++ b/library/Icingadb/Model/Behavior/ReRoute.php @@ -17,7 +17,7 @@ class ReRoute implements RewriteFilterBehavior, RewritePathBehavior * * @var string[] */ - const MIXED_TYPE_RELATIONS = ['downtime', 'comment', 'history', 'notification_history']; + public const MIXED_TYPE_RELATIONS = ['downtime', 'comment', 'history', 'notification_history']; public function __construct(array $routes) { diff --git a/library/Icingadb/ProvidedHook/Reporting/SlaReport.php b/library/Icingadb/ProvidedHook/Reporting/SlaReport.php index b5898fd83..2b2fe5165 100644 --- a/library/Icingadb/ProvidedHook/Reporting/SlaReport.php +++ b/library/Icingadb/ProvidedHook/Reporting/SlaReport.php @@ -29,10 +29,10 @@ abstract class SlaReport extends ReportHook use Database; /** @var float If an SLA value is lower than the threshold, it is considered not ok */ - const DEFAULT_THRESHOLD = 99.5; + public const DEFAULT_THRESHOLD = 99.5; /** @var int The amount of decimal places for the report result */ - const DEFAULT_REPORT_PRECISION = 2; + public const DEFAULT_REPORT_PRECISION = 2; /** * Create and return a {@link ReportData} container diff --git a/library/Icingadb/Util/PerfData.php b/library/Icingadb/Util/PerfData.php index 2d83c5408..a7d2c188a 100644 --- a/library/Icingadb/Util/PerfData.php +++ b/library/Icingadb/Util/PerfData.php @@ -11,9 +11,9 @@ class PerfData { - const PERFDATA_OK = 'ok'; - const PERFDATA_WARNING = 'warning'; - const PERFDATA_CRITICAL = 'critical'; + public const PERFDATA_OK = 'ok'; + public const PERFDATA_WARNING = 'warning'; + public const PERFDATA_CRITICAL = 'critical'; /** * The performance data value being parsed diff --git a/library/Icingadb/Util/PluginOutput.php b/library/Icingadb/Util/PluginOutput.php index 2d8b9d7d5..0651b5822 100644 --- a/library/Icingadb/Util/PluginOutput.php +++ b/library/Icingadb/Util/PluginOutput.php @@ -21,7 +21,7 @@ class PluginOutput extends HtmlString { /** @var string[] Patterns to be replaced in plain text plugin output */ - const TEXT_PATTERNS = [ + public const TEXT_PATTERNS = [ '~\\\t~', '~\\\n~', '~(\[|\()OK(\]|\))~', @@ -34,7 +34,7 @@ class PluginOutput extends HtmlString ]; /** @var string[] Replacements for {@see PluginOutput::TEXT_PATTERNS} */ - const TEXT_REPLACEMENTS = [ + public const TEXT_REPLACEMENTS = [ "\t", "\n", '', @@ -47,13 +47,13 @@ class PluginOutput extends HtmlString ]; /** @var string[] Patterns to be replaced in html plugin output */ - const HTML_PATTERNS = [ + public const HTML_PATTERNS = [ '~\\\t~', '~\\\n~' ]; /** @var string[] Replacements for {@see PluginOutput::HTML_PATTERNS} */ - const HTML_REPLACEMENTS = [ + public const HTML_REPLACEMENTS = [ "\t", "\n" ]; diff --git a/library/Icingadb/Web/Control/ViewModeSwitcher.php b/library/Icingadb/Web/Control/ViewModeSwitcher.php index 669bc326d..94f14ec92 100644 --- a/library/Icingadb/Web/Control/ViewModeSwitcher.php +++ b/library/Icingadb/Web/Control/ViewModeSwitcher.php @@ -22,10 +22,10 @@ class ViewModeSwitcher extends Form ]; /** @var string Default view mode */ - const DEFAULT_VIEW_MODE = 'common'; + public const DEFAULT_VIEW_MODE = 'common'; /** @var string Default view mode param */ - const DEFAULT_VIEW_MODE_PARAM = 'view'; + public const DEFAULT_VIEW_MODE_PARAM = 'view'; /** @var array View mode-icon pairs */ public static $viewModes = [ diff --git a/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php b/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php index bebc6be80..ed1fcd49f 100644 --- a/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php +++ b/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php @@ -18,8 +18,8 @@ abstract class ProblemsBadge extends NavigationItemRenderer { use Database; - const STATE_CRITICAL = 'critical'; - const STATE_UNKNOWN = 'unknown'; + public const STATE_CRITICAL = 'critical'; + public const STATE_UNKNOWN = 'unknown'; /** @var int Count cache */ protected $count; diff --git a/library/Icingadb/Widget/ItemList/HostListItemDetailed.php b/library/Icingadb/Widget/ItemList/HostListItemDetailed.php index 48060b904..d6fbabf5f 100644 --- a/library/Icingadb/Widget/ItemList/HostListItemDetailed.php +++ b/library/Icingadb/Widget/ItemList/HostListItemDetailed.php @@ -20,7 +20,7 @@ class HostListItemDetailed extends BaseHostListItem use ListItemDetailedLayout; /** @var int Max pie charts to be shown */ - const PIE_CHART_LIMIT = 5; + public const PIE_CHART_LIMIT = 5; protected function getStateBallSize(): string { diff --git a/library/Icingadb/Widget/ItemList/ServiceListItemDetailed.php b/library/Icingadb/Widget/ItemList/ServiceListItemDetailed.php index 1f93ed482..4091a5393 100644 --- a/library/Icingadb/Widget/ItemList/ServiceListItemDetailed.php +++ b/library/Icingadb/Widget/ItemList/ServiceListItemDetailed.php @@ -20,7 +20,7 @@ class ServiceListItemDetailed extends BaseServiceListItem use ListItemDetailedLayout; /** @var int Max pie charts to be shown */ - const PIE_CHART_LIMIT = 5; + public const PIE_CHART_LIMIT = 5; protected function getStateBallSize(): string { diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 000000000..37e0e27dc --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,15 @@ + + + + ./ + + vendor/* + + + + + + + + + diff --git a/test/php/library/Icingadb/Common/MacrosTest.php b/test/php/library/Icingadb/Common/MacrosTest.php index dd01a01f3..b8891dbd7 100644 --- a/test/php/library/Icingadb/Common/MacrosTest.php +++ b/test/php/library/Icingadb/Common/MacrosTest.php @@ -15,7 +15,7 @@ class MacrosTest extends TestCase { use Macros; - const VARS = [ + public const VARS = [ 'os' => "Ubuntu", 'days[0]' => 'mo', 'days[1]' => 'tue',