Skip to content

Commit

Permalink
Edited from class static method to function
Browse files Browse the repository at this point in the history
  • Loading branch information
jvitasek committed Apr 8, 2021
1 parent b542d5e commit 717777e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 24 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ $ composer require jvitasek/dumpanddie
<?php declare(strict_types = 1);

use Nette\Application\UI\Presenter;
use JVitasek\DumpAndDie\Dumper;

final class TestPresenter extends Presenter {

Expand All @@ -23,7 +22,7 @@ final class TestPresenter extends Presenter {
$filename = sha1($price + time()) . '.log';

// write this
Dumper::dd($price, $filename);
dd($price, $filename);

// instead of this
\Tracy\Debugger::barDump($price);
Expand Down
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
"tracy/tracy": "^2.8"
},
"autoload": {
"psr-4": {
"JVitasek\\DumpAndDie\\": "src"
}
"files": ["src/dumper.php"]
},
"require-dev": {
"phpstan/phpstan-nette": "^0.12.16",
"phpstan/extension-installer": "^1.1",
"slevomat/coding-standard": "^6.4"
}
}
}
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
paths:
- src
level: 6
6 changes: 6 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<ruleset name="AcmeProject">
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml"><!-- relative path to your ruleset.xml -->
<!-- sniffs to exclude -->
</rule>
</ruleset>
16 changes: 0 additions & 16 deletions src/Dumper.php

This file was deleted.

14 changes: 14 additions & 0 deletions src/dumper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

use Tracy\Debugger;

if (!function_exists('dd')) {
function dd(...$args): void
{
foreach ($args as $x) {
Debugger::barDump($x);
}

die(1);
}
}
3 changes: 1 addition & 2 deletions tests/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

use JVitasek\DumpAndDie\Dumper;
use Tracy\Debugger;

require __DIR__ . '/../vendor/autoload.php';
Debugger::enable(Debugger::DEVELOPMENT);
Dumper::dd('dump working');
dd('dump working');

0 comments on commit 717777e

Please sign in to comment.