Comments (2)
The default REPL uses PHP eval()
to execute the code, and eval()
does not work properly with namespaces, a limitation in PHP itself.
If you want to use namespaces in wp shell
, you install the additional PsySH
REPL, which provides many improvements, one of them being support for namespaces.
One easy way to do so is through the package manager:
wp package install schlessera/wp-cli-psysh
from shell-command.
Shouldn't this fail then, from php --interactive
?
php > eval('namespace dustinpaluch { function foobar() { echo __FUNCTION__; } foobar(); }');
dustinpaluch\foobar
Looks like my code doesn't work in 5.2.x, but starts working in 5.3.x.
from shell-command.
Related Issues (15)
- Provide an installable package for the optional PsySH enhancement HOT 2
- New data is not available when updated from another session HOT 2
- use statement in shell HOT 1
- What is Boris? HOT 2
- Move command over to new v2 structure
- Automatically rerun failed scenarios
- Missing `pclose()` in build-in REPL HOT 1
- Adopt and enforce new `WP_CLI_CS` standard
- Internal variables bleed over and cause conflicts HOT 2
- Feature request: support ksh under OpenBSD HOT 1
- Path to REPL.php is displayed for any wp shell command HOT 5
- Catch exceptions to avoid restarting sesson HOT 3
- Option to suppress output? HOT 3
- Shell binary not getting detected correctly? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shell-command.