Replace Nette\Diagnostics by Tracy – Recherche
- Milo
- Nette Core | 1283
I tried to remove whole Nette\Diagnostics and replace it by Tracy. And update the Sandbox to use all Nette native panels and works with it. You can find thematic commits in the Nette FW and in the Sandbox.
It works together, but it is only a recherche. There are issues I met, not sure they are all:
- Nette\Diagnostics vs. Tracy API differences (e.g. ND\Helpers::editorLink()
returns
Utils\Html
) I didn't try to find all API differences yet. - CSS styles. Nette native panels uses
#nette...
html IDs andnette-
classes.I didn't try to find if CSS differences exist yet.CSS is 100% compatible. - Directories with Nette native panels are named
Diagnostics
. Maybe this can be renamed. - I didn't solve a Nette FW cloning yet. I guess, in loader.php must be check that Tracy is loaded too.
- Documentation – there is a many terms like “Nette debugger”
One big question is about userland debugger tools. NetteLoader generates E_USER_WARNING when renamed class is used. This would be annoing in application because it takes some time then 3rd party panels updates. How to solve it.
- make an exception for Nette\Diagnostics classes in NetteLoader and leave WARNGINGs for next major (minor?) version
- leave some empty classes, e.g. `interface Nette\Diagnostics\IBarPanel extends Tracy\IBarPanel {} `…
Last edited by Milo (2014-03-02 21:09)
- David Grudl
- Nette Core | 8228
Great work!
I think leaving some “empty” classes is solution, because the current Tracy API contains some historical relics that I would like remove, and these classes would address the back compatibility.
- Milo
- Nette Core | 1283
OK.
In that case following methods will return an object from Tracy
namespace even called on class from Nette\Diagnostics
namespace:
Debugger::getBluescreen()
Debugger::getBar()
Debugger::getLogger()
Debugger::getFireLogger()
It can fails on user-land typehints. Any nice idea how to solve it? :)
- Milo
- Nette Core | 1283
BC break notes:
CSS is 100% compatible (well Tracy is one commit
forward). All #nette...
IDs and nette-...
classes can
be renamed to #tracy...
resp. tracy-
.
JavaScript code is 100% compatible. The only difference is
tracyQ
vs. netteQ
object name and referenced CSS
identifiers. I don't know if it affects any user's extensions.
- Milo
- Nette Core | 1283
PHP API differences:
# does not exist in Nette\Diagnostics\Bar
Tracy\Bar::$info
# does not exist in Nette\Diagnostics\Bluescreen
Tracy\Bluescreen::$info
# Following still exist in Nette as @deprecated, not exist in Tracy
Nette\Diagnostics\Debugger::$consoleMode
Nette\Diagnostics\Debugger::$consoleColors
Nette\Diagnostics\Debugger::$logger
Nette\Diagnostics\Debugger::$fireLogger
# public & @deprecated in Nette, private in Tracy
Nette\Diagnostics\Debugger::$blueScreen
Nette\Diagnostics\Debugger::$bar
# Nette only, missing in Tracy
Nette\Diagnostics\Debugger::addPanel()
# Tracy only, missing in Nette
Tracy\Helpers::createHtml()
Tracy\Helpers::fixEncoding()
# returns Nette\Utils\Html but Tracy returns string
Nette\Diagnostics\Helpers::editorLink()
Behavioral differences:
# Highlights Neon and Templating sources on exception
Nette\Diagnostics\Debugger::getBlueScreen()
Nette\Diagnostic classes throws exceptions from Nette namespace
but Tracy only theirs corresponding PHP native parents.
Last edited by Milo (2014-03-02 21:50)
- Filip Procházka
- Moderator | 4668
Milo wrote:
Classes … extend Nette\Object now. It will not as Tracy classes descendants/aliases.
The good think is none is typehinting Nette\Object and if is than he has bigger problems than BC :)
PHP API differences:
You can fix properties compatibility using references.