Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into files-observer
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed May 31, 2024
2 parents c9c6aeb + 3aedbe7 commit e7e4307
Show file tree
Hide file tree
Showing 23 changed files with 583 additions and 90 deletions.
3 changes: 3 additions & 0 deletions .github/.release-please-config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"release-type": "php",
"packages": {
".": {
Expand All @@ -7,6 +8,8 @@
}
},
"include-component-in-tag": false,
"include-v-in-tag": false,
"changelog-type": "github",
"changelog-sections": [
{
"type": "feat",
Expand Down
Binary file modified .github/phar/keys.asc.gpg
Binary file not shown.
36 changes: 6 additions & 30 deletions .github/workflows/build-phar-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,37 +91,13 @@ jobs:
run: rm ${{ env.GPG_KEYS }}

- name: 📤 Upload release assets
uses: actions/[email protected]
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const fs = require("fs");
const files = [
{
name: "trap.phar",
path: process.env.TRAP_PHAR,
},
{
name: "trap.phar.asc",
path: process.env.TRAP_PHAR_SIGNATURE,
},
];
for (const file of files) {
try {
await github.rest.repos.uploadReleaseAsset({
data: fs.readFileSync(file.path),
name: file.name,
origin: process.env.RELEASE_UPLOAD_URL,
owner: context.repo.owner,
release_id: process.env.RELEASE_ID,
repo: context.repo.repo,
});
} catch (error) {
core.setFailed(error.message);
}
}
token: "${{ secrets.TRAP_RELEASE_TOKEN }}"
files: |
${{ env.TRAP_PHAR }}
${{ env.TRAP_PHAR_SIGNATURE }}
notify-discord:
runs-on: ubuntu-latest
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 1.8.0 (2024-05-29)

## What's Changed
* Add tr() and td() functions by @roxblnfk in https://github.com/buggregator/trap/pull/102
* Add `trap()->code()` sugar by @lee-to in https://github.com/buggregator/trap/pull/103
* Change release generation type to Github API by @lotyp in https://github.com/buggregator/trap/pull/106

## New Contributors
* @lee-to made their first contribution in https://github.com/buggregator/trap/pull/103

**Full Changelog**: https://github.com/buggregator/trap/compare/v1.7.5...v1.8.0

## [1.7.5](https://github.com/buggregator/trap/compare/v1.7.4...v1.7.5) (2024-05-24)


### Bug Fixes

* fix environments in build-phar-release ([453e522](https://github.com/buggregator/trap/commit/453e522b6c49c6e9d54cd6256137c8f25925939f))

## [1.7.4](https://github.com/buggregator/trap/compare/v1.7.3...v1.7.4) (2024-05-24)


### Bug Fixes

* release asset upload ([#99](https://github.com/buggregator/trap/issues/99)) ([b4616c5](https://github.com/buggregator/trap/commit/b4616c52056cd1803b2d3990178577537a694147))
* suppress warnings if Closure::bind() is run with static callable ([3d72a7e](https://github.com/buggregator/trap/commit/3d72a7ef551bd2f21b0935826e8093a58da0b774))

## [1.7.3](https://github.com/buggregator/trap/compare/v1.7.2...v1.7.3) (2024-05-24)


Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,13 @@ Then just call the `trap()` function in your code:
```php
// dump the current stack trace
trap()->stackTrace();

// dump a variable with a depth limit
trap($var)->depth(4);

// dump a named variables sequence
trap($var, foo: $far, bar: $bar);

// dump a variable and return it
$responder->respond(trap($response)->return());
```
Expand All @@ -143,6 +146,27 @@ $responder->respond(trap($response)->return());
> The `trap()` function configures `$_SERVER['REMOTE_ADDR']` and `$_SERVER['REMOTE_PORT']` automatically,
> if they are not set.
Also, there are a couple of shortcuts here:

- `tr(...)` - equivalent to `trap(...)->return()`
- `td(...)` - equivalent to `trap(...); die;`

If called without arguments, they will display a short stack trace, used memory, and time between shortcut calls.

```php
function handle($input) {
tr(); // Trace #0 -.--- 3.42M

$data = $this->prepareData($input);

tr(); // Trace #1 0.015ms 6.58M

$this->processor->process(tr(data: $data));

td(); // exit with output: Trace #2 1.15ms 7.73M
}
```

### Default port

Trap automatically recognizes the type of traffic.
Expand Down
45 changes: 30 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,35 @@
"sort-packages": true
},
"scripts": {
"cs:diff": "php vendor/bin/php-cs-fixer fix --dry-run -v --diff",
"cs:fix": "php vendor/bin/php-cs-fixer fix -v",
"infect": "XDEBUG_MODE=coverage php vendor/bin/roave-infection-static-analysis-plugin --configuration=infection.json.dist",
"infect:ci": "XDEBUG_MODE=coverage php vendor/bin/roave-infection-static-analysis-plugin --ansi --configuration=infection.json.dist --logger-github --ignore-msi-with-no-mutations --only-covered",
"psalm": "php vendor/bin/psalm --show-info=true",
"psalm:baseline": "php vendor/bin/psalm --set-baseline=psalm-baseline.xml",
"psalm:ci": "php vendor/bin/psalm --output-format=github --shepherd --show-info=false --stats --threads=4",
"refactor": "php vendor/bin/rector process --config=rector.php",
"refactor:ci": "php vendor/bin/rector process --config=rector.php --dry-run --ansi",
"stan": "php vendor/bin/phpstan analyse --memory-limit=2G",
"stan:baseline": "php vendor/bin/phpstan analyse --generate-baseline --memory-limit=2G --allow-empty-baseline",
"stan:ci": "php vendor/bin/phpstan analyse --memory-limit=2G --error-format=github",
"test": "XDEBUG_MODE=coverage php vendor/bin/pest --exclude-group=phpunit-only --color=always",
"test:cc": "XDEBUG_MODE=coverage php vendor/bin/pest --coverage --coverage-clover=.build/phpunit/logs/clover.xml --exclude-group=phpunit-only --color=always",
"test:sep": "XDEBUG_MODE=coverage php vendor/bin/phpunit --group=phpunit-only --color=always --exclude-testsuite=Arch"
"cs:diff": "php-cs-fixer fix --dry-run -v --diff",
"cs:fix": "php-cs-fixer fix -v",
"infect": [
"@putenv XDEBUG_MODE=coverage",
"roave-infection-static-analysis-plugin --configuration=infection.json.dist"
],
"infect:ci": [
"@putenv XDEBUG_MODE=coverage",
"roave-infection-static-analysis-plugin --ansi --configuration=infection.json.dist --logger-github --ignore-msi-with-no-mutations --only-covered"
],
"psalm": "psalm --show-info=true",
"psalm:baseline": "psalm --set-baseline=psalm-baseline.xml",
"psalm:ci": "psalm --output-format=github --shepherd --show-info=false --stats --threads=4",
"refactor": "rector process --config=rector.php",
"refactor:ci": "rector process --config=rector.php --dry-run --ansi",
"stan": "phpstan analyse --memory-limit=2G",
"stan:baseline": "phpstan analyse --generate-baseline --memory-limit=2G --allow-empty-baseline",
"stan:ci": "phpstan analyse --memory-limit=2G --error-format=github",
"test": [
"@putenv XDEBUG_MODE=coverage",
"pest --exclude-group=phpunit-only --color=always"
],
"test:cc": [
"@putenv XDEBUG_MODE=coverage",
"pest --coverage --coverage-clover=.build/phpunit/logs/clover.xml --exclude-group=phpunit-only --color=always"
],
"test:sep": [
"@putenv XDEBUG_MODE=coverage",
"phpunit --group=phpunit-only --color=always --exclude-testsuite=Arch"
]
}
}
44 changes: 22 additions & 22 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
<code><![CDATA[new \SplQueue()]]></code>
</MixedPropertyTypeCoercion>
</file>
<file src="src/Support/ProtobufCaster.php">
<file src="src/Client/Caster/ProtobufCaster.php">
<MixedArgument>
<code><![CDATA[$ed->getClass()]]></code>
<code><![CDATA[$value]]></code>
Expand Down
2 changes: 1 addition & 1 deletion resources/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.7.3"
".": "1.8.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Buggregator\Trap\Support\Caster;
namespace Buggregator\Trap\Client\Caster;

/**
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

declare(strict_types=1);

namespace Buggregator\Trap\Support;
namespace Buggregator\Trap\Client\Caster;

use Buggregator\Trap\Support\Caster\EnumValue;
use Google\Protobuf\Internal\Descriptor as InternalDescriptor;
use Google\Protobuf\Descriptor as PublicDescriptor;
use Google\Protobuf\Internal\Descriptor as InternalDescriptor;
use Google\Protobuf\Internal\DescriptorPool;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\MapField;
Expand Down
Loading

0 comments on commit e7e4307

Please sign in to comment.