Permalink
Browse files

tasks: updated convert52 and minify

  • Loading branch information...
1 parent a2dfca7 commit 4eb6346e09b3bcd25ac27eb5e5a6671dac187b8a @dg dg committed May 15, 2012
Showing with 3 additions and 1 deletion.
  1. +2 −0 tasks/convert52.php
  2. +1 −1 tasks/minify.php
View
@@ -24,6 +24,7 @@
$s = str_replace('new static', 'new self', $s);
$s = str_replace('static::', 'self::', $s);
$s = str_replace('get_called_class()', '__CLASS__', $s);
+ $s = str_replace('E_USER_DEPRECATED', 'E_USER_WARNING', $s);
$s = preg_replace('#(?<=[(= ])([^() ]+(?:\([^()]+\))?) \?: #', '($tmp=$1) ? $tmp : ', $s); // expand ternary short cut
$s = preg_replace('#/\\*5\.2\*\s*(.*?)\s*\\*/#s', '$1', $s); // uncomment /*5.2* */
$s = preg_replace('#/\\*\\*/.*?/\\*\\*/\\s*#s', '', $s); // remove /**/ ... /**/
@@ -34,6 +35,7 @@
$s = str_replace(', Nette\Database\Reflection\DiscoveredReflection', $prefixed ? ', NDiscoveredReflection' : ', DiscoveredReflection', $s); // CD-collection\app\config.neon
$s = str_replace('$application->onStartup[] = function() {', '{', $s); // bootstrap.php
$s = str_replace('$application->onStartup[] = function() use ($application) {', '{', $s); // bootstrap.php
+ $s = str_replace('$configurator::', $prefixed ? 'NConfigurator::' : 'Configurator::', $s); // bootstrap.php in comment
$s = str_replace('$form::', 'Form::', $s); // Form examples
$s = str_replace('$node::', 'Nette\Latte\MacroNode::', $s); // Latte
$s = str_replace('Nette\Database\Drivers\\\\', $prefixed ? 'N' : '', $s); // Nette\Database\Connection.php
View
@@ -83,7 +83,7 @@ public function addFile($file)
$this->files[realpath($file)] = TRUE;
$content = file_get_contents($file);
// special handling for Connection.php && Statement.php
- $content = preg_replace('#class (N?Connection|N?Statement) extends.+#s', "if (class_exists('PDO')){ $0 }", $content);
+ $content = preg_replace('#class \S+ extends \\\\?PDO.+#s', "if (class_exists('PDO')){ $0 }", $content);
$this->addContent($content, dirname($file));
}

0 comments on commit 4eb6346

Please sign in to comment.