You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-3
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ class MyTestClass extends TestCase
30
30
31
31
### Introduction to Runkit
32
32
33
-
Some of the traits will rely on [Runkit7](https://www.php.net/runkit7), a port of PHP's runkit designed to work in PHP 7.x, to rewrite code at runtime (a.k.a. "monkey-patching").
33
+
Some of the traits will rely on [Runkit7], a port of PHP's runkit designed to work in PHP 7.x, to rewrite code at runtime (a.k.a. "monkey-patching").
34
34
35
35
For example, once a PHP constant is defined, it will normally have that value until the PHP process ends. Under normal circumstances, that's great: it prevents the value from being accidentally overwritten and/or tampered with.
36
36
@@ -46,7 +46,7 @@ var_dump(SOME_CONSTANT)
46
46
#=> string(10) "some value"
47
47
48
48
// Now, re-define the constant.
49
-
runkit_constant_redefine('SOME_CONSTANT', 'some other value');
49
+
runkit7_constant_redefine('SOME_CONSTANT', 'some other value');
50
50
var_dump(SOME_CONSTANT)
51
51
#=> string(16) "some other value"
52
52
```
@@ -57,11 +57,14 @@ Of course, we might want a constant's original value to be restored after our te
57
57
58
58
The library offers a number of traits, based on the type of global state that might need to be manipulated.
Copy file name to clipboardExpand all lines: docs/Constants.md
+1-8
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,8 @@
2
2
3
3
Some applications — especially WordPress — will use [PHP constants](https://www.php.net/manual/en/language.constants.php) for configuration that should not be edited directly through the <abbrtitle="User Interface">UI</abbr>.
4
4
5
-
Normally, a constant cannot be redefined or removed once defined; however, [the runkit7 extension](https://www.php.net/manual/en/book.runkit7) exposes functions to modify normally immutable constructs.
5
+
Normally, a constant cannot be redefined or removed once defined; however, [the runkit7 extension](Runkit.md) exposes functions to modify normally immutable constructs.
6
6
7
-
If runkit functions are unavailable, the `Constants` trait will automatically skip tests that rely on this functionality.
8
-
9
-
In order to install runkit7 in your development and CI environments, you may use [the installer bundled with this repo](https://github.com/stevegrunwell/runkit7-installer):
0 commit comments