for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dallgoot\Yaml\Nodes;
/**
*
* @author Stéphane Rebai <[email protected]>
* @license Apache 2.0
* @link https://github.com/dallgoot/yaml
*/
class Anchor extends Actions
{
public function &build(&$parent = null)
$name = substr($this->anchor, 1);
$yamlObject = $this->getRoot()->getYamlObject();
if ($this->anchor[0] === "*") {
try {
return $yamlObject->getReference($name);
} catch (\Throwable $e) {
throw new \ParseError("Unknown anchor : '$name' this:".$this->anchor,1,$e);
}
} else {
$built = is_null($this->value) ? null : $this->value->build($parent);
return $yamlObject->addReference($name, $built);
$yamlObject->addReference($name, $built)
Dallgoot\Yaml\YamlObject::addReference()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
public function isAwaitingChild(NodeGeneric $node):bool
return is_null($this->value);
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.