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

Updates typehints based on expected values #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
name: Code Checks
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-code-checks
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ jobs:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 7.4, 8.0, 8.1 ]
php: [ 7.4, 8.0, 8.1, 8.2 ]
dependency-version: [ prefer-lowest, prefer-stable ]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand Down
13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"type": "library",
"require": {
"php": "^7.2|^8.0",
"guzzlehttp/guzzle": "^6.3|^7.0",
"guzzlehttp/guzzle": "^7.0",
"promphp/prometheus_client_php": "^1.0|^2.0"
},
"require-dev": {
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.5.4",
"phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.1.0",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "^9.4",
"squizlabs/php_codesniffer": "^3.6"
},
Expand All @@ -31,5 +31,10 @@
"psr-0": {
"Test\\PrometheusPushGateway\\": "tests/"
}
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}
14 changes: 7 additions & 7 deletions src/PrometheusPushGateway/PushGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

class PushGateway
{
const HTTP_PUT = "PUT";
const HTTP_POST = "POST";
const HTTP_DELETE = "DELETE";
public const HTTP_PUT = "PUT";
public const HTTP_POST = "POST";
public const HTTP_DELETE = "DELETE";
/**
* @var string
*/
Expand All @@ -42,7 +42,7 @@ public function __construct(string $address, ?ClientInterface $client = null)
* Uses HTTP PUT.
* @param CollectorRegistry $collectorRegistry
* @param string $job
* @param array<string> $groupingKey
* @param array<string,string> $groupingKey
* @throws GuzzleException
*/
public function push(CollectorRegistry $collectorRegistry, string $job, array $groupingKey = []): void
Expand All @@ -55,7 +55,7 @@ public function push(CollectorRegistry $collectorRegistry, string $job, array $g
* Uses HTTP POST.
* @param CollectorRegistry $collectorRegistry
* @param string $job
* @param array<string> $groupingKey
* @param array<string,string> $groupingKey
* @throws GuzzleException
*/
public function pushAdd(CollectorRegistry $collectorRegistry, string $job, array $groupingKey = []): void
Expand All @@ -67,7 +67,7 @@ public function pushAdd(CollectorRegistry $collectorRegistry, string $job, array
* Deletes metrics from the Push Gateway.
* Uses HTTP POST.
* @param string $job
* @param array<string> $groupingKey
* @param array<string,string> $groupingKey
* @throws GuzzleException
*/
public function delete(string $job, array $groupingKey = []): void
Expand All @@ -78,7 +78,7 @@ public function delete(string $job, array $groupingKey = []): void
/**
* @param CollectorRegistry|null $collectorRegistry
* @param string $job
* @param array<string> $groupingKey
* @param array<string,string> $groupingKey
* @param string $method
* @throws GuzzleException
*/
Expand Down