I started developing a custom language plugin for PhpStorm, the best IDE for PHP I've met so far. But since the documentation for plugin development is rather poor and I have to dig in the code a lot, I decided to share my hardly gained knowledge with others. So first things you'll (I'll) need to start: Learn Java […]
Archive for the ‘Programming’ Category
Mock vs final fights in testing
There has always been a war between testers, who love mocking all classes, and library developers, who prevent misusing their code by means of final keyword. You cannot do both. Once a class (or method) is declared as final, it cannot be mocked (extended). Since testers need to test their applications built on top of […]
Entity Select-boxes & Nette
Forms often contain a selection, e.g. when creating a user for in your app, you may need a role to be selected. If you use an ORM, you'd probably have IdentityEntity class in your app referring to an RoleEntity class. How will you create such a form? By adding plain select and converting Role Entity […]
Article::getClassName() or Article::className
I miss a feature in PHP, which would allow me to reference classes easily. For example in Java, if you have a class cz.juzna.abc.Acticle and you want to give it to a variable/method, you can reference it by cz.juzna.abc.Acticle.class. In PHP, this can be done only by a string with class' name („cz\juzna\abc\Article“), which is however […]
Data binding in Nette Forms
A form in your app sometimes match exactly to fields of one entity, but it's not always the case. This data-binding should be more general, e.g. one form can provide editing of a hierarchy of entities at once. And it should be bi-directional, pulling data from model and also storing it back. Usually you need to write lot's of […]
Abstract properties
I hope you know you can declare classes and methods as abstract in most programming languages (including PHP) and if you write high quality object oriented code, I guess you use them quiet often. There is no discussion if they're good or not (at least I hope; and I'd like to hear your opinions). But what about abstract […]
Optimizing class cache in PHP
Some time ago I read an article about hacking PHP internals to improve its performance. I liked the idea of avoiding unnecessary syscalls, because context switching is considered to be quiet expensive operation. And I realized there is quiet significant amount of work which needs be performed with class autoloading. So I decided to hack it and make it […]
Weak references in PHP
Today was created a new PECL package, which brings weak references to PHP. Weak references had already an RFC asking for their support in coming PHP 5.4, which was however not very perceived by PHP core developers. As they suggested, such a new feature which doesn't need changes in Zend Enginge (backend of PHP) should […]
Closures vs. code blocks
I wrote a post about lightweight closures couple of days ago, but I didn't realize the real meaning of them. That let most people, including myself, confused. When I read Jakub's blogpost about finally-clause (not English, but you can try using Google Translate) today, I realized what are my lightweight closures really about. Code blocks Saying they were closures wasn't probably […]
Lightweight closures in PHP
I kinda like closures as they are implemented in JavaScript. They're seem so lightweight, easy to use and to write. You don't need much code and you'll get just used to them and use them everywhere. This was not possible before PHP 5.3 and people use tended not to use any kind of callbacks unless really necessary. […]

