for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Jaxon\Script;
/**
* AbstractJsCall
*
* Base class for js (not Jaxon) calls and selectors.
* @package jaxon-core
* @author Thierry Feuzeu
* @copyright 2024 Thierry Feuzeu <[email protected]>
* @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link https://github.com/jaxon-php/jaxon-core
*/
use Jaxon\Plugin\Response\Dialog\DialogCommand;
use Closure;
abstract class AbstractJsCall extends AbstractCall
{
* A function to call when the expression is created
* @var Closure
protected $xExprCb;
* The constructor.
* @param DialogCommand $xDialog
* @param Closure|null $xExprCb
protected function __construct(DialogCommand $xDialog, ?Closure $xExprCb)
$this->xDialog = $xDialog;
$this->xExprCb = $xExprCb;
}
* Call the js expression callback
* @param JsExpr $xJsExpr
* @return JsExpr
protected function _initExpr(JsExpr $xJsExpr): JsExpr
$this->xExprCb !== null && ($this->xExprCb)($xJsExpr);
return $xJsExpr;
* Get the value of an attribute of the current object
* @param string $sAttribute
public function __get(string $sAttribute): JsExpr
return $this->_expr()->__get( $sAttribute);
* Set the value of an attribute of the current object
* @param mixed $xValue
* @return void
public function __set(string $sAttribute, $xValue)
return $this->_expr()->__set($sAttribute, $xValue);
$this->_expr()->__set($sAttribute, $xValue)
Jaxon\Script\JsExpr::__set()
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.
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.