1
좋아요, 그래서 private가 되었습니까? 객체를 생성 할 때 비어있는 Vector $ lines은 이제 벡터에 문자열을 추가하려고합니다.nullable Vector에 요소 추가
<?hh
class LineList {
private ?Vector<string> $lines;
public function addLine(string $line): void {
$this->file[] = trim($line);
}
}
을하지만 hh_client와 코드를 검사 할 때, 그것은 나에게 다음과 같은 경고 제공 : 다음 해킹 코드는 잘 작동
$this->file[]]: a nullable type does not allow array append (Typing[4006])
[private ?Vector<string> $lines]: You might want to check this out
질문 : 어떻게 그없이 벡터에 요소를 추가하려면를 검사기가이 경고를 푸시?
감사합니다. 첫 번째 작품! – jeyemgfx