Page MenuHomeDevCentral

Offer debugger methods to dump a variable
ClosedPublic

Authored by dereckson on Apr 18 2018, 19:00.
Tags
None
Referenced Files
F2740721: D1614.id4122.diff
Wed, Mar 27, 21:53
F2740451: D1614.id4123.diff
Wed, Mar 27, 21:29
F2739724: D1614.id4128.diff
Wed, Mar 27, 16:52
Unknown Object (File)
Wed, Mar 27, 15:49
Unknown Object (File)
Wed, Mar 27, 06:07
Unknown Object (File)
Wed, Mar 27, 02:24
Unknown Object (File)
Fri, Mar 22, 19:34
Unknown Object (File)
Fri, Mar 22, 19:13
Subscribers
None

Details

Summary

Import dprint_r and dieprint_r to the library.

These functions allow to enclose a print_r call in a preformatted block,
so the output could be read directly in a rendered HTML document.

They are intended to be used as debug time.

As these global functions are still in use during some current debug
and development tasks, we offer a mechanism to register them from the
Debugger class. As create_function is deprecated since PHP 7.2.0,
the selected method is to require a wrapper file in the global space.

The result is a choice between those two syntaxes:

Debugger::register();
dprint_r($someVariable);
Debugger::printVariable($someVariable);

Ref T1395

Test Plan
  • unit test provided for the registration
  • integration tests provided for the debug methods

Diff Detail

Repository
rKOT Keruald OmniTools
Lint
Lint Errors
SeverityLocationCodeMessage
Errorsrc/Debug/_register_to_global_space.php:8PHPCS.E.Generic.NamingConventions.CamelCapsFunctionName.NotCamelCapsGeneric.NamingConventions.CamelCapsFunctionName.NotCamelCaps
Errorsrc/Debug/_register_to_global_space.php:14PHPCS.E.Generic.NamingConventions.CamelCapsFunctionName.NotCamelCapsGeneric.NamingConventions.CamelCapsFunctionName.NotCamelCaps
Unit
Tests Passed
Branch
debugger (branched from master)
Build Status
Buildable 2534
Build 2782: arc lint + arc unit

Event Timeline

dereckson created this revision.

Declare in phpcs configuration file we don't need to check camel case for _register_to_global_space.php functions

dereckson edited the test plan for this revision. (Show Details)
dereckson edited the summary of this revision. (Show Details)
dereckson edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Apr 20 2018, 12:07
This revision was automatically updated to reflect the committed changes.