publicfunctionloadFromExtension(string $extension, array $values = null): static { if($this->isCompiled()){ thrownewBadMethodCallException('Cannot load from an extension on a compiled container.'); }
publicfunctiontestIsCompiled() { $sc = newContainer(newParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->isCompiled(), '->isCompiled() returns false if the container is not compiled'); $sc->compile(); $this->assertTrue($sc->isCompiled(), '->isCompiled() returns true if the container is compiled'); }
publicfunctiontestIsCompiledWithFrozenParameters() { $sc = newContainer(newFrozenParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->isCompiled(), '->isCompiled() returns false if the container is not compiled but the parameter bag is already frozen'); }
/**
* @param Field $field
*/ publicfunctionadd($field): void { if(!$field->isCompiled()){ thrownew \BadMethodCallException('This action is not recommended if you still need to compile the field'); } $this->addField($field); }
publicfunctionloadFromExtension(string $extension, array $values = null): static { if($this->isCompiled()){ thrownewBadMethodCallException('Cannot load from an extension on a compiled container.'); }