Comments (5)
Right now classes cannot exist without a class body. However, I can see that it sometimes might make sense to have an empty class. I'll add the possibility to create empty classes.
As a work-around solution until the above-mentioned fix is in place, you could just write:
class X
# empty class
(So a class with just a comment as class body).
from snow.
I am writing Magento modules and it has many empty classes. Thanks for your solution, class X with comments works. But I met two others issues. Please help.
class X extends Y # empty class Fatal error: Class 'Y' not found in D:\Program\Snow\snow.php(201) : eval()'d code on line 2
class Hms_HomeTabs_Block_HomeTabs # empty class Fatal error: Uncaught exception 'Exception' with message 'Unable to parse input: given input is no T_EXPRESSIONS: class Hms_HomeTabs_Block_HomeTabs # empty class null' in D:\Program\Snow\snowcompiler.php:368 Stack trace: #0 D:\Program\Snow\snow.php(169): SnowCompiler->compile() #1 {main} thrown in D:\Program\Snow\snowcompiler.php on line 368
from snow.
Thank you for your feedback - this is very helpful!
Now for your two new issues: the first one tries to find class Y, since you try to inherit from it, but is unable to do so. So you need to make sure that class Y is defined in the current scope (either by defining it or by including it).
The second issue: I will change the class identifier definition to actually support underscores in the middle of the name. Until this is implemented, you can try using camel-case instead.
from snow.
Thanks for your reply :) I think I should write plain PHP until Snow support underscores because Magento modules use underscores in class names to identify MVC and folder structure so I cannot use camel-sase or any other approaches.
from snow.
The above commit should fix the issue with underscores in class identifiers and also makes the class body optional.
from snow.
Related Issues (15)
- Support for de-structuring assignments HOT 1
- Gettext Function HOT 1
- Template() Question HOT 1
- new Object HOT 2
- New Feature
- New Feature HOT 2
- DIRECTORY_SEPARATOR HOT 2
- Improve parse error reporting
- Update Documentation HOT 1
- Add some unification wrappers
- Add some templating capabilities HOT 1
- Optional for Including Helper Functions HOT 1
- Arrow Operator HOT 1
- throw new Exception HOT 1
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 snow.