for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace StaticAnalysis\AccessInterceptorValueHolder;
use ProxyManager\Factory\AccessInterceptorValueHolderFactory;
require_once __DIR__ . '/../../vendor/autoload.php';
class MyProxiedClass
{
public function sayHello() : string
return 'Hello!';
}
(static function () : void {
echo (new AccessInterceptorValueHolderFactory())
->createProxy(
new MyProxiedClass(),
[
'sayHello' => static function (
object $proxy,
$proxy
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
MyProxiedClass $realInstance,
$realInstance
string $method,
$method
array $parameters,
$parameters
bool & $returnEarly
$returnEarly
) {
echo 'pre-';
},
],
'sayHello' =>
/** @param mixed $returnValue */
static function (
& $returnValue,
$returnValue
bool & $overrideReturnValue
$overrideReturnValue
echo 'post-';
]
)
->sayHello();
$valueHolderInterceptor = (new AccessInterceptorValueHolderFactory())
->createProxy(new MyProxiedClass());
$valueHolderInterceptor->setMethodPrefixInterceptor(
'sayHello',
);
$valueHolderInterceptor->setMethodSuffixInterceptor(
echo $valueHolderInterceptor->sayHello();
$interceptedValue = $valueHolderInterceptor
->getWrappedValueHolderValue();
assert($interceptedValue !== null);
echo $interceptedValue->sayHello();
})();
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.