Validate use of empty in PHP < 5.5.

@throws ParseErrorException if the user used empty with anything but a variable

@param Node $node
547220
public function enterNode(Node $node)
    {
        if ($this->atLeastPhp55) {
            return;
        }

        if (!$node instanceof Empty_) {
            return;
        }

        if (!$node->expr instanceof Variable) {
            $msg = \sprintf('syntax error, unexpected %s', $this->getUnexpectedThing($node->expr));

            throw new ParseErrorException($msg, $node->expr->getLine());
        }
    }
1104449
public static function parse(\SimpleXMLElement $node)
	{
		if ($node->getName() != self::$tagName) {
			return null;
		}

		$bounds = new Bounds();

		$bounds->minLatitude = isset($node['minlat']) ? (float) $node['minlat'] : null;
		$bounds->minLongitude = isset($node['minlon']) ? (float) $node['minlon'] : null;
		$bounds->maxLatitude = isset($node['maxlat']) ? (float) $node['maxlat'] : null;
		$bounds->maxLongitude = isset($node['maxlon']) ? (float) $node['maxlon'] : null;

		return $bounds;
	}
257184
protected function applyRule(MethodNode $node): void
    {
        $constant = $node->getFirstChildOfType('ConstantPostfix');

        if ($constant === null) {
            return;
        }

        if (!$this->isPropelQueryConstant($constant->getName())) {
            return;
        }

        $methodName = $node->getName();

        if ($this->isPropelQueryFactoryMethod($methodName)) {
            return;
        }

        $class = $node->getParentName();

        $message = sprintf(
            '%s violates rule "%s"',
            "{$class}::{$methodName}()",
            static::RULE
        );

        $this->addViolation($node, [$message]);
    }
508976
public function enterNode(Node $node): void
    {
        $name = null;

        if ($node instanceof Name) {
            $name = $node->toString();
        }

        if ($name === null
            || (array_key_exists($name, $this->symbols)
                && $this->symbols[$name] === false
            )
        ) {
            return;
        }

        if (!$this->filter->__invoke($name)) {
            $this->symbols[$name] = false;
            return;
        }

        if (!array_key_exists($name, $this->symbols)) {
            $this->symbols[$name] = [];
        }

        $this->symbols[$name][] = $node;
    }
1254794
public static function removeNonPkValues(Node $node) {
    $mapper = $node->getMapper();
    $pkValues = $mapper->getPkNames();
    $valueNames = $node->getValueNames();
    foreach($valueNames as $name) {
      if (!in_array($name, $pkValues)) {
        $node->removeValue($name);
      }
    }
  }
552701
public function enterNode(Node $node)
    {
        if ($node instanceof Class_) {
            if ($node->extends) {
                $extends = (string) $node->extends;
                if ($this->isFinalClass($extends)) {
                    $msg = \sprintf('Class %s may not inherit from final class (%s)', $node->name, $extends);
                    throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
                }
            }

            if ($node->isFinal()) {
                $this->finalClasses[\strtolower($node->name)] = true;
            }
        }
    }
1076523
function it_compiles_nodes($node)
    {
        $node->compile($this)->will(function ($args) {
            $args[0]->write('echo $message');
        });

        $this->compile($node)->getSource()->shouldMatch('/\Recho \$message/');
    }
114949
private function nodeRequiredIfEnabled($node)
    {
        return function ($value) use ($node) {
            if (!$value['enabled']) {
                return false;
            }

            if (isset($value[$node]) && !empty($value[$node])) {
                return false;
            }

            return true;
        };
    }
1148998
public function deleteNode($node)
    {
        $target_pos = $node->getPosition();
        $this->rewind();
        $pos = 0;

        // Omit target node and adjust pos of remainder
        $done = false;
        try {
            while ($n = $this->current()) {
                if ($pos == $target_pos && !$done) {
                    $done = true;
                    $this->next();
                    $this->offsetUnset($pos);
                } elseif ($pos >= $target_pos) {
                    $n->setPosition($pos);
                    $pos++;
                    $this->next();
                } else {
                    $pos++;
                    $this->next();
                }
            }
        }
        catch (Exception $e) {
            // no-op - shift() throws an exception, sigh
        }

    }
86819
protected function validateInput($node)
	{
		$hasAttributes = $node->hasAttributes();

		if ($hasAttributes)
		{
			$name = $node->getAttribute('name');

			$attrs = $node->attributes;

			for ($i = 0; $i < $attrs->length; $i++)
			{
				$attr = $attrs->item($i);
				if ($attr->namespaceURI == self::NS)
				{
					switch ($attr->localName)
					{
						case 'required':
							$value = $this->getValue($name);
							if ($value === '' || is_null($value))
							{
								if ($node->nodeName == 'input' && $node->getAttribute('type') == 'radio')
								{
									// для радиокнопок
									// проверить (и пометить, если нужно) это поле
									$this->invalidValue('input[name='.$name.']', 'required');
								}
								else
								{
									$id = $node->getAttribute('id');
									// проверить (и пометить, если нужно) это поле
									$this->invalidValue('#'.$id, 'required');
								}
							}
						break;
					}
				}
			}
		}
	}
779287
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Expr || ! $parent instanceof VariableLikeInterface) {
            throw new Exception('ValueNodeParser is made to parse a expression node');
        }
    }
943425
private function validateTypeFieldIsPresent($node)
    {
        if (empty($node['_type'])) {
            throw new Exception("Element: {$this->currentNode} has no compulsory field: _type", ValidatorResult::ERROR_NODE_HAS_NO_FIELD_TYPE);
        }

        $this->getLogger()->info("Element: {$this->currentNode} has field: _type");
    }
776316
protected function validateEmpty($object, $attribute)
    {
        if (!$this->allowEmpty) {
            $this->addError($object, $attribute, $this->emptyMessage);
        }
    }
659257
public function visitNode(Node &$node)
    {
        $element = $this->dynamic_analysis;
        $path    = $this->getWorkspacePath($node->getFullPath());
        if ($path === false) {
            return;
        }

        fprintf($this->stream, "%d %s\n", $element->getPctDead(), $path);
    }
1165604
public static function isEmpty($string)
    {
        if (!self::isValid($string) &&
            null !== $string
        ) {
            return false;
        }

        return ($string === null || $string === '');
    }
834922
def parse_content(node)
      content = if node.children.empty?
        node.content
      else
        parse_nodes(node.children)
      end
    end
1269653
public function node(\DOMNode $node) {
        // A listing of types is at http://php.net/manual/en/dom.constants.php
        switch ($node->nodeType) {
            case XML_ELEMENT_NODE:
                $this->rules->element($node);
                break;
            case XML_TEXT_NODE:
                $this->rules->text($node);
                break;
            case XML_CDATA_SECTION_NODE:
                $this->rules->cdata($node);
                break;
            // FIXME: It appears that the parser doesn't do PI's.
            case XML_PI_NODE:
                $this->rules->processorInstruction($node);
                break;
            case XML_COMMENT_NODE:
                $this->rules->comment($node);
                break;
            // Currently we don't support embedding DTDs.
            default:
                print '<!-- Skipped -->';
                break;
        }
    }