From 6fdec131f46a30706025cb83ddaf1b7692a3dbd3 Mon Sep 17 00:00:00 2001 From: Kim Pepper Date: Wed, 6 Jan 2021 16:14:11 +1100 Subject: [PATCH] Adds symfony 5 support (#3) * Adds symfony 5 support * Fix lint errors --- composer.json | 6 +++--- src/Counter.php | 4 +--- src/Metric.php | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 95b4a37..746df5b 100644 --- a/composer.json +++ b/composer.json @@ -9,10 +9,10 @@ } ], "require": { - "php": "^7.1", + "php": "^7.2", "ext-json": "*", - "symfony/property-access": "^3.4||^4.4", - "symfony/serializer": "^3.4||^4.4" + "symfony/property-access": "^3.4||^4.4||^5.0", + "symfony/serializer": "^3.4||^4.4||^5.0" }, "require-dev": { "drupal/coder": "^8.3.8", diff --git a/src/Counter.php b/src/Counter.php index c97e1eb..62829ee 100644 --- a/src/Counter.php +++ b/src/Counter.php @@ -2,8 +2,6 @@ namespace PNX\Prometheus; -use InvalidArgumentException; - /** * Value object representing a Prometheus counter type. */ @@ -31,7 +29,7 @@ public function getType(): string { */ public function set($value, array $labels = []) { if (!$this->isValidValue($value)) { - throw new InvalidArgumentException("A count value must be a positive integer."); + throw new \InvalidArgumentException("A count value must be a positive integer."); } $key = $this->getKey($labels); $this->labelledValues[$key] = new LabelledValue($this->getName(), $value, $labels); diff --git a/src/Metric.php b/src/Metric.php index 006a08c..2468948 100644 --- a/src/Metric.php +++ b/src/Metric.php @@ -2,8 +2,6 @@ namespace PNX\Prometheus; -use InvalidArgumentException; - /** * Value object to represent a prometheus metric. */ @@ -98,7 +96,7 @@ public function getLabelledValues() { */ protected function validateName($name): void { if (!preg_match(self::METRIC_NAME_REGEX, $name)) { - throw new InvalidArgumentException("Invalid name: '" . $name . "'"); + throw new \InvalidArgumentException("Invalid name: '" . $name . "'"); } }