diff vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php	Fri Feb 23 15:52:07 2018 +0000
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php	Mon Apr 23 09:33:26 2018 +0100
@@ -1,24 +1,25 @@
-<?php
+<?php declare(strict_types=1);
 
 namespace PhpParser\Builder;
 
 use PhpParser;
+use PhpParser\BuilderHelpers;
 use PhpParser\Node\Stmt;
 
-class Property extends PhpParser\BuilderAbstract
+class Property implements PhpParser\Builder
 {
     protected $name;
 
     protected $flags = 0;
     protected $default = null;
-    protected $attributes = array();
+    protected $attributes = [];
 
     /**
      * Creates a property builder.
      *
      * @param string $name Name of the property
      */
-    public function __construct($name) {
+    public function __construct(string $name) {
         $this->name = $name;
     }
 
@@ -28,7 +29,7 @@
      * @return $this The builder instance (for fluid interface)
      */
     public function makePublic() {
-        $this->setModifier(Stmt\Class_::MODIFIER_PUBLIC);
+        $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC);
 
         return $this;
     }
@@ -39,7 +40,7 @@
      * @return $this The builder instance (for fluid interface)
      */
     public function makeProtected() {
-        $this->setModifier(Stmt\Class_::MODIFIER_PROTECTED);
+        $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED);
 
         return $this;
     }
@@ -50,7 +51,7 @@
      * @return $this The builder instance (for fluid interface)
      */
     public function makePrivate() {
-        $this->setModifier(Stmt\Class_::MODIFIER_PRIVATE);
+        $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE);
 
         return $this;
     }
@@ -61,7 +62,7 @@
      * @return $this The builder instance (for fluid interface)
      */
     public function makeStatic() {
-        $this->setModifier(Stmt\Class_::MODIFIER_STATIC);
+        $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC);
 
         return $this;
     }
@@ -74,7 +75,7 @@
      * @return $this The builder instance (for fluid interface)
      */
     public function setDefault($value) {
-        $this->default = $this->normalizeValue($value);
+        $this->default = BuilderHelpers::normalizeValue($value);
 
         return $this;
     }
@@ -87,9 +88,9 @@
      * @return $this The builder instance (for fluid interface)
      */
     public function setDocComment($docComment) {
-        $this->attributes = array(
-            'comments' => array($this->normalizeDocComment($docComment))
-        );
+        $this->attributes = [
+            'comments' => [BuilderHelpers::normalizeDocComment($docComment)]
+        ];
 
         return $this;
     }
@@ -99,13 +100,13 @@
      *
      * @return Stmt\Property The built property node
      */
-    public function getNode() {
+    public function getNode() : PhpParser\Node {
         return new Stmt\Property(
             $this->flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC,
-            array(
+            [
                 new Stmt\PropertyProperty($this->name, $this->default)
-            ),
+            ],
             $this->attributes
         );
     }
-}
\ No newline at end of file
+}