for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Htsl\Parser\Node;
use Htsl\Htsl;
use Htsl\ReadingBuffer\Line;
use Htsl\Parser\Node\Contracts\ANode;
////////////////////////////////////////////////////////////////
class CommentNode extends ANode
{
/**
* Whether the comment is html comment.
*
* @access private
* @var bool
*/
private $htmlComment;
* Real contructor.
* @access protected
* @return \Htsl\Parser\Node\Contracts\ANode
CommentNode
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
protected function construct():parent
$this->htmlComment= '!'!==$this->line->getChar(1);
This check looks for improperly formatted assignments.
Every assignment must have exactly one space before and one space after the equals operator.
To illustrate:
$a = "a"; $ab = "ab"; $abc = "abc";
will have no issues, while
will report issues in lines 1 and 2.
return $this;
}
* Opening this node, and returning node opener.
* @access public
* @return string
public function open():string
return $this->htmlComment ?
'<!--'.str_replace('-->','--'.chr(0xC).'>',substr($this->line->getContent(),1)):
'<?php /* '.substr($this->line->getContent(),2);
* Close this node, and returning node closer.
* @param \Htsl\ReadingBuffer\Line $closerLine The line when node closed.
public function close( Line$closerLine ):string
return $this->htmlComment ? '-->' : ' */ ?>';
This check marks files that end in a newline character, i.e. an empy line.
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.