我正在使用一些外部库,这些库作为 git 子模块包含在该add_subdirectory命令中。其中一些正在使用旧版本的 cmake,并发出有关策略 CMP0048 和 CMP0077 的警告。
有没有办法关闭这些库的所有 cmake 警告?
我尝试在包含项目之前明确设置策略,OLD但没有帮助。
我不想编辑 git 子模块中的任何文件,因为当有人必须克隆我的项目的存储库并在他们的计算机上构建它时,就会有额外的步骤。
有没有办法记录某个类对另一个类中定义的每个方法都有魔术方法?
我正在使用 PhpStorm,所以我会对任何可以让自动完成功能正常工作的解决方案感到满意。
class A
{
// a bunch of functions go here...
}
/**
* Class B
* What should go here to make it work???
*/
class B
{
private $aInstance;
public function __construct() {
$this->aInstance = new A();
}
public function __call($name, $arguments) {
// TODO: Implement __call() method.
if(method_exists($this->aInstance, $name)) {
return $this->aInstance->{$name}(...$arguments);
}
throw new BadMethodCallException();
}
// a bunch more functions go here...
}
Run Code Online (Sandbox Code Playgroud) 我环顾四周,找到了一个适用于普通对象的解决方案,但它似乎不适用于模拟。
下面的测试失败并显示消息:Unable to set property someProperty of object type Mock_ClassToTest_40ea0b83: Property someProperty does not exist。
class sampleTestClass extends PHPUnit_Framework_TestCase
{
function test() {
$object = $this->getMockForAbstractClass(ClassToTest::class, [], '', false);
$this->setProtectedProperty($object, 'someProperty', 'value');
}
private function getReflectionProperty($object, $property) {
$reflection = new ReflectionClass($object);
$reflectionProperty = $reflection->getProperty($property);
$reflectionProperty->setAccessible(true);
return $reflectionProperty;
}
/**
* This method modifies the protected properties of any object.
* @param object $object The object to modify.
* @param string $property The name of the property to …Run Code Online (Sandbox Code Playgroud) 有没有办法在不更改工作目录中的文件的情况下还原旧提交?我做了一段时间的提交,但我提交的代码还没准备好,我希望这些更改作为未提交的更改保留在我的工作目录中,以便我现在可以继续处理它们.我查看了revert命令但更改了工作目录.我正在考虑检查旧版本,重置头1并存储更改,但我已经有了更改.我只是希望它好像我从来没有做过那样的提交方式,但我希望保留对文件的更改.