mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-04-23 07:28:36 +02:00
Merge branch '3.x'
This commit is contained in:
commit
1cdb280a30
4
LICENSE
4
LICENSE
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2011 by Nikita Popov.
|
||||
Copyright (c) 2011-2018 by Nikita Popov.
|
||||
|
||||
Some rights reserved.
|
||||
|
||||
@ -28,4 +28,4 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
@ -381,7 +381,7 @@ class Standard extends PrettyPrinterAbstract
|
||||
}
|
||||
|
||||
protected function pExpr_UnaryMinus(Expr\UnaryMinus $node) {
|
||||
if ($node->expr instanceof Expr\UnaryMinus) {
|
||||
if ($node->expr instanceof Expr\UnaryMinus || $node->expr instanceof Expr\PreDec) {
|
||||
// Enforce -(-$expr) instead of --$expr
|
||||
return '-(' . $this->p($node->expr) . ')';
|
||||
}
|
||||
@ -389,7 +389,7 @@ class Standard extends PrettyPrinterAbstract
|
||||
}
|
||||
|
||||
protected function pExpr_UnaryPlus(Expr\UnaryPlus $node) {
|
||||
if ($node->expr instanceof Expr\UnaryPlus) {
|
||||
if ($node->expr instanceof Expr\UnaryPlus || $node->expr instanceof Expr\PreInc) {
|
||||
// Enforce +(+$expr) instead of ++$expr
|
||||
return '+(' . $this->p($node->expr) . ')';
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ print ($a and print $b);
|
||||
|
||||
-(-$a);
|
||||
+(+$a);
|
||||
-(--$a);
|
||||
+(++$a);
|
||||
|
||||
// The following will currently add unnecessary parentheses, because the pretty printer is not aware that assignment
|
||||
// and incdec only work on variables.
|
||||
@ -75,6 +77,8 @@ yield from ($a and yield from $b);
|
||||
print ($a and print $b);
|
||||
-(-$a);
|
||||
+(+$a);
|
||||
-(--$a);
|
||||
+(++$a);
|
||||
// The following will currently add unnecessary parentheses, because the pretty printer is not aware that assignment
|
||||
// and incdec only work on variables.
|
||||
!($a = $b);
|
||||
|
Loading…
x
Reference in New Issue
Block a user