]> Raphaël G. Git Repositories - packbundle/commitdiff
Switch to normal twig error
authorRaphaël Gertz <git@rapsys.eu>
Tue, 26 Nov 2019 16:13:18 +0000 (17:13 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Tue, 26 Nov 2019 16:13:18 +0000 (17:13 +0100)
Twig/Filter/CPackFilter.php
Twig/Filter/JPackFilter.php

index 2edb1c4270a7978d96108fc10f9f72eb01c16017..ca38c3be37033ade64bffe8fb8b0b29e69cf5ddf 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
 <?php
 
-// src/Rapsys/PackBundle/Twig/Filter/CPackFilter.php
 namespace Rapsys\PackBundle\Twig\Filter;
 
 use Rapsys\PackBundle\Twig\Filter\FilterInterface;
 namespace Rapsys\PackBundle\Twig\Filter;
 
 use Rapsys\PackBundle\Twig\Filter\FilterInterface;
+use Twig\Error\Error;
 
 class CPackFilter implements FilterInterface {
        //Default bin
 
 class CPackFilter implements FilterInterface {
        //Default bin
@@ -39,10 +39,10 @@ class CPackFilter implements FilterInterface {
                        if ($this->compress == 'minify') {
                                $this->bin .= ' --minify';
                        //Unknown compress type
                        if ($this->compress == 'minify') {
                                $this->bin .= ' --minify';
                        //Unknown compress type
-                       #XXX: default compression is pretty
+                       //XXX: default compression is pretty
                        } elseif ($this->compress !== 'pretty') {
                                //Throw an error on unknown compress
                        } elseif ($this->compress !== 'pretty') {
                                //Throw an error on unknown compress
-                               throw new \Twig_Error(sprintf('Got unexpected compress for %s: %s', $this->bin, $this->compress), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected compress for %s: %s', $this->bin, $this->compress), $this->line, $this->fileName);
                        }
                }
        }
                        }
                }
        }
@@ -76,7 +76,7 @@ class CPackFilter implements FilterInterface {
 
                        //Read content from stderr
                        if (($stderr = stream_get_contents($pipes[2]))) {
 
                        //Read content from stderr
                        if (($stderr = stream_get_contents($pipes[2]))) {
-                               throw new \Twig_Error(sprintf('Got unexpected strerr for %s: %s', $this->bin, $stderr), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected strerr for %s: %s', $this->bin, $stderr), $this->line, $this->fileName);
                        }
 
                        //Close stderr
                        }
 
                        //Close stderr
@@ -84,7 +84,7 @@ class CPackFilter implements FilterInterface {
 
                        //Close process
                        if (($ret = proc_close($proc))) {
 
                        //Close process
                        if (($ret = proc_close($proc))) {
-                               throw new \Twig_Error(sprintf('Got unexpected non zero return code %s: %d', $this->bin, $ret), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected non zero return code %s: %d', $this->bin, $ret), $this->line, $this->fileName);
                        }
                }
 
                        }
                }
 
index 199d980fa0d76d1250187b64e4f99f4848fe37c6..ca4555d71affc37e70dc88acfdf5a87135fcad57 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
 <?php
 
-// src/Rapsys/PackBundle/Twig/Filter/JPackFilter.php
 namespace Rapsys\PackBundle\Twig\Filter;
 
 use Rapsys\PackBundle\Twig\Filter\FilterInterface;
 namespace Rapsys\PackBundle\Twig\Filter;
 
 use Rapsys\PackBundle\Twig\Filter\FilterInterface;
+use Twig\Error\Error;
 
 class JPackFilter implements FilterInterface {
        //Default bin
 
 class JPackFilter implements FilterInterface {
        //Default bin
@@ -45,10 +45,10 @@ class JPackFilter implements FilterInterface {
                        } elseif ($this->compress == 'obfuscate') {
                                $this->bin .= ' --obfuscate';
                        //Unknown compress type
                        } elseif ($this->compress == 'obfuscate') {
                                $this->bin .= ' --obfuscate';
                        //Unknown compress type
-                       #XXX: default compression is best
+                       //XXX: default compression is best
                        } elseif ($this->compress !== 'best') {
                                //Throw an error on unknown compress
                        } elseif ($this->compress !== 'best') {
                                //Throw an error on unknown compress
-                               throw new \Twig_Error(sprintf('Got unexpected compress for %s: %s', $this->bin, $this->compress), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected compress for %s: %s', $this->bin, $this->compress), $this->line, $this->fileName);
                        }
                }
        }
                        }
                }
        }
@@ -82,7 +82,7 @@ class JPackFilter implements FilterInterface {
 
                        //Read content from stderr
                        if (($stderr = stream_get_contents($pipes[2]))) {
 
                        //Read content from stderr
                        if (($stderr = stream_get_contents($pipes[2]))) {
-                               throw new \Twig_Error(sprintf('Got unexpected strerr for %s: %s', $this->bin, $stderr), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected strerr for %s: %s', $this->bin, $stderr), $this->line, $this->fileName);
                        }
 
                        //Close stderr
                        }
 
                        //Close stderr
@@ -90,7 +90,7 @@ class JPackFilter implements FilterInterface {
 
                        //Close process
                        if (($ret = proc_close($proc))) {
 
                        //Close process
                        if (($ret = proc_close($proc))) {
-                               throw new \Twig_Error(sprintf('Got unexpected non zero return code %s: %d', $this->bin, $ret), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected non zero return code %s: %d', $this->bin, $ret), $this->line, $this->fileName);
                        }
                }
 
                        }
                }