Skip to content

Commit

Permalink
symfony6 (#7)
Browse files Browse the repository at this point in the history
* Support Symfony 6
* Update deps
* Allow plugin
* Fix phpunit

---------

Co-authored-by: Gálik Pál <[email protected]>
Co-authored-by: Nick Schuch <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2023
1 parent ce75c40 commit 139abd9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
type: string
default: ""
docker:
- image: skpr/php-circleci:7.4-1.x
- image: skpr/php-circleci:8.1-v2-latest
working_directory: /data
steps:
- checkout
Expand All @@ -25,7 +25,7 @@ jobs:
- deps-{{ arch }}
- run:
name: "Install Dependencies"
command: composer update --prefer-dist --no-progress --no-suggest --no-interaction <<parameters.composer_args>>
command: composer update --prefer-dist --no-progress --no-interaction <<parameters.composer_args>>
- save_cache:
key: deps-{{ arch }}
paths:
Expand Down
18 changes: 11 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
}
],
"require": {
"php": "^7.2||^8.0",
"php": "^8.1|^8.2",
"ext-json": "*",
"symfony/property-access": "^3.4||^4.4||^5.0",
"symfony/serializer": "^3.4||^4.4||^5.0"
"symfony/property-access": "^4.4|^5.4|^6.2",
"symfony/serializer": "^4.4|^5.4|^6.2"
},
"require-dev": {
"drupal/coder": "^8.3.8",
"phpunit/phpunit": "^8.5.4",
"symfony/phpunit-bridge": "^4.4.8"
"drupal/coder": "^8.3.16",
"phpunit/phpunit": "^9.5.28",
"phpspec/prophecy": "^1.16",
"symfony/phpunit-bridge": "^5.4"
},
"autoload": {
"psr-4": {"PNX\\Prometheus\\": "src/"}
Expand All @@ -30,6 +31,9 @@
"preferred-install": {
"*": "dist"
},
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
28 changes: 10 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
<!-- PHPUnit expects functional tests to be run with either a privileged user
or your current system user. See core/tests/README.md and
https://www.drupal.org/node/2116263 for details.
-->
<phpunit bootstrap="tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" colors="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" beStrictAboutChangesToGlobalState="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./src</directory>
</include>
<exclude>
<directory suffix="Test.php">./</directory>
<directory suffix="TestBase.php">./</directory>
</exclude>
</coverage>
<php>
<!-- Set error reporting to E_ALL. -->
<ini name="error_reporting" value="32767"/>
Expand All @@ -20,23 +25,10 @@
<testsuite name="unit">
<directory>./tests/Unit</directory>
</testsuite>
<testsuite name="functional">
<directory>./tests/Functional</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
</listener>
</listeners>
<!-- Filter for coverage reports. -->
<filter>
<whitelist>
<directory>./src</directory>
<!-- By definition test classes have no tests. -->
<exclude>
<directory suffix="Test.php">./</directory>
<directory suffix="TestBase.php">./</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
4 changes: 2 additions & 2 deletions src/Serializer/PrometheusEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ class PrometheusEncoder implements EncoderInterface {
/**
* {@inheritdoc}
*/
public function supportsEncoding($format) {
public function supportsEncoding($format): bool {
return $format == self::ENCODING;
}

/**
* {@inheritdoc}
*/
public function encode($data, $format, array $context = []) {
public function encode($data, $format, array $context = []): string {
$output = [];
$output[] = '# HELP ' . $data['name'] . ' ' . $data['help'];
$output[] = '# TYPE ' . $data['name'] . ' ' . $data['type'];
Expand Down

0 comments on commit 139abd9

Please sign in to comment.