Skip to content

Commit

Permalink
Added support for PHP 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
code-distortion committed Feb 4, 2025
1 parent a0ae5c8 commit b4cf174
Show file tree
Hide file tree
Showing 42 changed files with 300 additions and 274 deletions.
28 changes: 5 additions & 23 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,26 @@ root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.js]
indent_size = 2

[*.json]
indent_size = 2

[*.json.dist]
indent_size = 2

[*.json5]
indent_size = 2

[*.json5.dist]
[*.{json,json.dist}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.neon]
indent_size = 2

[*.neon.dist]
indent_size = 2

[*.xml]
indent_size = 2

[*.xml.dist]
[*.{neon,neon.dist}]
indent_size = 2

[*.yml]
[*.{xml,xml.dist}]
indent_size = 2

[*.yml.dist]
[*.{yml,yml.dist}]
indent_size = 2
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
# Ignore tests and tooling with "export-ignore"
/.github/ export-ignore
/tests/ export-ignore
/.editorconfig export-ignore
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Before submitting a pull request:

## Requirements

- *[PSR-12 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md)* where possible - falling back to [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) otherwise - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer).
- *[PSR-12 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md)* where possible - falling back to [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) otherwise - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

Expand Down
59 changes: 38 additions & 21 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: run-tests
name: "run-tests"

on:
push:
Expand All @@ -8,31 +8,33 @@ on:
schedule:
- cron: "0 0 * * 0"

permissions:
contents: read

jobs:

all_tests:

name: "PHP${{ matrix.php }} TB${{ matrix.testbench }} ${{ matrix.os-title }} ${{ matrix.dependency-prefer-title }}"
runs-on: "${{ matrix.os }}"
permissions:
contents: "read"
strategy:
fail-fast: true
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
php: [ "8.3", "8.2", "8.1", "8.0" ]
testbench: [ "^8.0", "^7.0", "^6.26", "^6.0" ]
php: [ "8.4", "8.3", "8.2", "8.1", "8.0" ]
testbench: [ "^9.0", "^8.0", "^7.0", "^6.26", "^6.0" ]
dependency-prefer: [ "prefer-stable", "prefer-lowest" ]
include:
- php: "8.4"
phpunit: "^10.5.44 | ^11.0"
phpunit-config-file: "phpunit.github-actions.xml.dist"
- php: "8.3"
phpunit: "^10.1.0"
phpunit: "^10.5.44 | ^11.0"
phpunit-config-file: "phpunit.github-actions.xml.dist"
- php: "8.2"
phpunit: "^10.1.0"
phpunit: "^10.5.44 | ^11.0"
phpunit-config-file: "phpunit.github-actions.xml.dist"
- php: "8.1"
phpunit: "^10.1.0"
phpunit: "^10.5.44"
phpunit-config-file: "phpunit.github-actions.xml.dist"
- php: "8.0"
phpunit: "^9.3"
Expand Down Expand Up @@ -62,11 +64,25 @@ jobs:
dependency-prefer-title: "stable"
- dependency-prefer: "prefer-lowest"
dependency-prefer-title: "lowest"

exclude:
- testbench: "^9.0"
php: "8.1"
- testbench: "^9.0"
php: "8.0"

# - testbench: "^8.0"
# php: "8.4"
# - testbench: "^8.0"
# php: "8.3"
- testbench: "^8.0"
php: "8.0"

- testbench: "^6.26" # Laravel 8 for higher versions of PHP
php: "8.0"

- testbench: "^6.0" # Laravel 8 for lower versions of PHP
php: "8.4"
- testbench: "^6.0" # Laravel 8 for lower versions of PHP
php: "8.3"
- testbench: "^6.0" # Laravel 8 for lower versions of PHP
Expand All @@ -78,45 +94,46 @@ jobs:
- name: "Checkout code"
uses: "actions/checkout@v4"

- name: "Validate composer.json and composer.lock"
run: "composer validate --strict"

- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
extensions: fileinfo # required by league/flysystem on Windows
extensions: "fileinfo" # required by league/flysystem on Windows
ini-values: "error_reporting=E_ALL"
coverage: none
coverage: "none"
env:
COMPOSER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: "Validate composer.json and composer.lock"
run: "composer validate --strict"

# find composer's cache directory - so we know which directory to cache in the next step
- name: "Find composer's cache directory"
id: "composer-cache"
shell: bash # make sure this step works on Windows - see https://github.com/actions/runner/issues/2224#issuecomment-1289533957
shell: "bash" # make sure this step works on Windows - see https://github.com/actions/runner/issues/2224#issuecomment-1289533957
run: |
echo "composer_cache_dir=$(composer config cache-files-dir)">> "$GITHUB_OUTPUT"
- name: "Cache composer's cache directory"
uses: "actions/cache@v3"
uses: "actions/cache@v4"
with:
path: "${{ steps.composer-cache.outputs.composer_cache_dir }}"
key: "[${{ matrix.os }}][php-${{ matrix.php }}][testbench-${{ matrix.testbench }}][${{ matrix.dependency-prefer }}][composer.json-${{ hashFiles('composer.json') }}]"

- name: "Install dependencies"
uses: "nick-fields/retry@v2"
uses: "nick-fields/retry@v3"
with:
timeout_minutes: 5
max_attempts: 5
shell: bash # make sure "^" characters are interpreted properly on Windows (e.g. in "^5.0")
shell: "bash" # make sure "^" characters are interpreted properly on Windows (e.g. in "^5.0")
command: |
composer remove "infection/infection" --dev --no-interaction --no-update
composer remove "phpstan/phpstan" --dev --no-interaction --no-update
composer remove "squizlabs/php_codesniffer" --dev --no-interaction --no-update
composer require "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-update
composer remove "phpstan/phpstan" --dev --no-interaction --no-update
composer remove "phpstan/phpstan-strict-rules" --dev --no-interaction --no-update
composer require "phpunit/phpunit:${{ matrix.phpunit }}" --dev --no-interaction --no-update
composer remove "squizlabs/php_codesniffer" --dev --no-interaction --no-update
composer update --${{ matrix.dependency-prefer }} --prefer-dist --no-interaction --optimize-autoloader --no-progress
- name: "Execute tests"
run: vendor/bin/phpunit --configuration=${{ matrix.phpunit-config-file }} --no-coverage --stop-on-error --stop-on-failure
run: vendor/bin/phpunit "--configuration=${{ matrix.phpunit-config-file }}" --no-coverage --stop-on-error --stop-on-failure
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.idea/
.phpunit/
.phpunit.cache/
.vscode/
build/
infection/
phpunit/
Expand Down
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

All notable changes to `code-distortion/clarity-context` will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).



## [0.1.0] - 2023-12-31
## [0.1.1] - 2024-02-05

### Added
- Added support for PHP 8.4



## [0.1.0] - 2023-12-31

### Added
- Initial release
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Tim Chandler
Copyright (c) 2025 Tim Chandler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Clarity Context - Understand Your Exceptions

[![Latest Version on Packagist](https://img.shields.io/packagist/v/code-distortion/clarity-context.svg?style=flat-square)](https://packagist.org/packages/code-distortion/clarity-context)
![PHP Version](https://img.shields.io/badge/PHP-8.0%20to%208.3-blue?style=flat-square)
![Laravel](https://img.shields.io/badge/laravel-8%20to%2010-blue?style=flat-square)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/code-distortion/clarity-context/run-tests.yml?branch=master&style=flat-square)](https://github.com/code-distortion/clarity-context/actions)
![PHP Version](https://img.shields.io/badge/PHP-8.0%20to%208.4-blue?style=flat-square)
![Laravel](https://img.shields.io/badge/laravel-8%20to%2011-blue?style=flat-square)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/code-distortion/clarity-context/run-tests.yml?branch=main&style=flat-square)](https://github.com/code-distortion/clarity-context/actions)
[![Buy The World a Tree](https://img.shields.io/badge/treeware-%F0%9F%8C%B3-lightgreen?style=flat-square)](https://plant.treeware.earth/code-distortion/clarity-context)
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.1%20adopted-ff69b4.svg?style=flat-square)](.github/CODE_OF_CONDUCT.md)

Expand Down Expand Up @@ -302,7 +302,7 @@ You can retrieve the following details from the Meta objects:

``` php
// all Meta classes
$meta->getFile(); // the relevant file
$meta->getFile(); // the relevant file
$meta->getProjectFile(); // the same file, but relative to the project-root's dir
$meta->getLine(); // the relevant line number
$meta->getFunction(); // the function or method being run at the time
Expand Down Expand Up @@ -346,7 +346,7 @@ $context->getCallStack()->getMetaGroups();
Each MetaGroup contains similar details to the `Frame` object.

``` php
$metaGroup->getFile(); // the path to the file containing the code being run
$metaGroup->getFile(); // the path to the file containing the code being run
$metaGroup->getProjectFile(); // the same file, but relative to the project-root's dir
$metaGroup->getLine(); // the relevant line number
$metaGroup->getFunction(); // the function or method being run at the time
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
}
],
"require": {
"php": "8.0.* | 8.1.* | 8.2.* | 8.3.*",
"code-distortion/staticall": "^0.1.0"
"php": "8.0.* | 8.1.* | 8.2.* | 8.3.* | 8.4.*"
},
"require-dev": {
"infection/infection": "^0.10 | ^0.11 | ^0.12 | ^0.13 | ^0.14 | ^0.15 | ^0.16 | ^0.17 | ^0.18 | ^0.19 | ^0.20 | ^0.21 | ^0.22 | ^0.23 | ^0.24 | ^0.25 | ^0.26 | ^0.27",
"orchestra/testbench": "^6.12 | ^7.0 | ^8.0",
"phpstan/phpstan": "^0.9 | ^0.10 | ^0.11 | ^0.12 | ^1.0",
"phpunit/phpunit": "~4.8 | ^5.0 | ^6.0 | ^7.0 | ^8.4 | ^9.0 | ^10.0",
"squizlabs/php_codesniffer": "^3.8.0"
"infection/infection": "^0.26 | ^0.27 | ^0.28 | ^0.29",
"orchestra/testbench": "^6.12 | ^7.0 | ^8.0 | ^9.0",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpunit": "^9.6.22 | ^10.0 | ^11.0",
"squizlabs/php_codesniffer": "^3.11.2"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions infection.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"source": {
"directories": [
"src"
],
]
"excludes": [
"src/ServiceProvider.php"
]
Expand All @@ -14,7 +14,7 @@
"html": "infection/infection.html",
"summary": "infection/summary.log",
"json": "infection/infection-log.json",
"perMutator": "infection/per-mutator.md",
"perMutator": "infection/per-mutator.md"
},
"mutators": {
"@default": true
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
parameters:
paths:
- src/
- tests/
level: max
parallel:
processTimeout: 300.0
excludePaths:
- /**/ManualTest.php
8 changes: 4 additions & 4 deletions phpunit.github-actions.up-to-9.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="true"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
Expand All @@ -13,7 +13,7 @@
convertWarningsToExceptions="true"
defaultTimeLimit="10"
enforceTimeLimit="false"
failOnIncomplete="false"
failOnIncomplete="true"
failOnRisky="true"
failOnSkipped="true"
failOnWarning="true"
Expand All @@ -28,10 +28,10 @@
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
<directory suffix="Test.php">./tests/Unit/</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
<directory suffix="Test.php">./tests/Integration/</directory>
</testsuite>
</testsuites>
</phpunit>
12 changes: 7 additions & 5 deletions phpunit.github-actions.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
backupGlobals="true"
backupGlobals="false"
backupStaticProperties="false"
beStrictAboutChangesToGlobalState="false"
beStrictAboutOutputDuringTests="true"
Expand All @@ -21,12 +21,14 @@
displayDetailsOnSkippedTests="true"
enforceTimeLimit="false"
failOnDeprecation="false"
failOnIncomplete="false"
failOnIncomplete="true"
failOnEmptyTestSuite="true"
failOnNotice="true"
failOnRisky="true"
failOnSkipped="true"
failOnWarning="true"
processIsolation="false"
requireCoverageMetadata="false"
stopOnDefect="true"
stopOnDeprecation="false"
stopOnError="true"
Expand All @@ -39,15 +41,15 @@
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
<directory suffix="Test.php">./tests/Unit/</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
<directory suffix="Test.php">./tests/Integration/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
<directory suffix=".php">./src/</directory>
</include>
</source>
</phpunit>
Loading

0 comments on commit b4cf174

Please sign in to comment.