Skip to content

Instantly share code, notes, and snippets.

@milo
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milo/624f69fe3312801b6ca7 to your computer and use it in GitHub Desktop.
Save milo/624f69fe3312801b6ca7 to your computer and use it in GitHub Desktop.
Nette addon compatibility solution

How to keep a Nette addon compatibility with Nette Framework 2.0, 2.1 and 2.2? Here is my fight description:

  1. Nette 2.0 Nette\Utils\PhpGenerator\ClassType vs Nette 2.1+ Nette\PhpGenerator\ClassType strict errors and Nette\Config\CompilerExtension vs. Nette\DI\CompilerExtension. This was a difficult one:
  • Create abstract BC\Extensions like this,
  • and Nette version-dependent loader like this.
  • A target extension will inherit one of them as class Extension extends BC\Extension and
  • the Composer will class-mapping different folder and hard load version-dependent loader like this.
  1. IBarPanel is solved in the same way as 1)

  2. Few nuances like this is easy to catch in code

  3. Nette\Diagnostics vs. Tracy CSS

Nette 2.2.* solves the compatibility. It translates CSS classes from nette-... to tracy-... automatically. But I want to stay dev-branch compatible with a backward-direction compatbility. Just duplicate selectors like this.

@fprochazka
Copy link

Not bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment