-
Notifications
You must be signed in to change notification settings - Fork 4
chore: modernize tooling and add strict typing #11
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c8dcffd
chore: modernize tooling and add strict typing
kimpepper 7db3b18
chore: require minimum Symfony 6.4.32 and 7.4.8 patch versions
kimpepper 107220e
chore: normalize composer version constraints
kimpepper a0ab544
feat: allow Stringable for help parameter
kimpepper e4c4418
chore: add declare(strict_types=1) to all PHP files
kimpepper 0bdbe84
docs: add @throws annotations for InvalidArgumentException
kimpepper 514b757
chore: remove and ignore .phpunit.result.cache
kimpepper bc81ad8
docs: fix Counter throws description to include zero
kimpepper 406d4c2
docs: fix typo in bootstrap.php (Boostrap → Bootstrap)
kimpepper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: 🏗 Build | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| prefer_lowest: ["", "--prefer-lowest"] | ||
| php: ["8.2", "8.5"] | ||
| container: | ||
| image: skpr/php-cli:${{ matrix.php }}-dev-v2-stable | ||
| options: | ||
| --pull always | ||
| --user 1001:1001 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| show-progress: false | ||
| - name: Composer Update | ||
| run: composer update --with-all-dependencies --prefer-dist --no-progress --no-interaction ${{ matrix.prefer_lowest }} | ||
| - name: PHPCS | ||
| # Convert emacs format (file:line:col: severity - message) to GitHub annotations (::severity file=,line=,col=::message) | ||
| run: | | ||
| ./bin/phpcs --report=emacs -q | sed -E 's/^([^:]+):([0-9]+):([0-9]+): (error|warning) - (.*)$/::\4 file=\1,line=\2,col=\3::\5/' || true | ||
| ./bin/phpcs --report=full | ||
| - name: PHPStan | ||
| run: ./bin/phpstan --error-format=github analyse | ||
| - name: Add PHPUnit matcher | ||
| run: | | ||
| cat << 'EOF' > .github/phpunit-failure.json | ||
| {"problemMatcher":[{"owner":"phpunit-failure","severity":"error","pattern":[{"regexp":"##teamcity\\[testFailed[^\\]]*message='([^']*)'[^\\]]*details='/data/([^:]+):(\\d+)","message":1,"file":2,"line":3}]}]} | ||
| EOF | ||
| echo "::add-matcher::.github/phpunit-failure.json" | ||
| - name: Run Tests | ||
| run: ./bin/phpunit --teamcity | ||
| - name: Remove PHPUnit matcher | ||
| if: always() | ||
| run: echo "::remove-matcher owner=phpunit-failure::" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| /bin | ||
| /vendor | ||
| /composer.lock | ||
| .phpunit.cache | ||
| .phpunit.result.cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <ruleset name="php-prometheus"> | ||
| <description>PHP CodeSniffer configuration for PHP Prometheus</description> | ||
| <!-- folders to scan --> | ||
| <file>./src</file> | ||
| <file>./tests</file> | ||
| <!-- extensions to scan --> | ||
| <arg name="extensions" value="php"/> | ||
| <!-- additional arguments --> | ||
| <arg name="report" value="full"/> | ||
| <!-- inherit from coder --> | ||
| <rule ref="./vendor/drupal/coder/coder_sniffer/Drupal"/> | ||
| <!-- Additional detailed sniff configuration --> | ||
| <!-- You can determine sniff names by running with -s flag --> | ||
| <!-- Example 1 - ignore Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps | ||
| <rule ref="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"> | ||
| <severity>0</severity> | ||
| </rule> | ||
| // End example 1 --> | ||
| <!-- Example 2 - ignore rule for specific files | ||
| <rule ref="Drupal.NamingConventions.ValidVariableName.LowerCamelName"> | ||
| <exclude-pattern>OfferNormalizerTrait.php</exclude-pattern> | ||
| <exclude-pattern>TimeOfUseValidationTrait.php</exclude-pattern> | ||
| </rule> | ||
| // End example 2 --> | ||
| <rule ref="Drupal"/> | ||
| </ruleset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| parameters: | ||
| level: 6 | ||
| paths: | ||
| - src | ||
| - tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,24 @@ | ||
| <?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 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> | ||
| <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd" | ||
| bootstrap="tests/bootstrap.php" | ||
| cacheDirectory=".phpunit.cache" | ||
| colors="true" | ||
| beStrictAboutTestsThatDoNotTestAnything="true" | ||
| beStrictAboutOutputDuringTests="true" | ||
| beStrictAboutChangesToGlobalState="true"> | ||
| <php> | ||
| <!-- Set error reporting to E_ALL. --> | ||
| <ini name="error_reporting" value="32767"/> | ||
| <!-- Do not limit the amount of memory tests take to run. --> | ||
| <ini name="memory_limit" value="-1"/> | ||
| <const name="BOOTSTRAP_IS_PHPUNIT" value="true"/> | ||
| </php> | ||
| <testsuites> | ||
| <testsuite name="unit"> | ||
| <directory>./tests/Unit</directory> | ||
| </testsuite> | ||
| </testsuites> | ||
| <listeners> | ||
| <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"> | ||
| </listener> | ||
| </listeners> | ||
| <!-- Filter for coverage reports. --> | ||
| <source> | ||
| <include> | ||
| <directory>./src</directory> | ||
| </include> | ||
| </source> | ||
| </phpunit> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.