Skip to content

Commit 7b949e1

Browse files
committed
removed deprecated stuff
1 parent 8326fa0 commit 7b949e1

File tree

4 files changed

+3
-70
lines changed

4 files changed

+3
-70
lines changed

src/PhpGenerator/ClassType.php

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,7 @@ final class ClassType
6868
*/
6969
public static function from($class): self
7070
{
71-
if ($class instanceof \ReflectionClass) {
72-
trigger_error(__METHOD__ . '() accepts only class name or object.', E_USER_DEPRECATED);
73-
}
74-
return (new Factory)->fromClassReflection(
75-
$class instanceof \ReflectionClass ? $class : new \ReflectionClass($class)
76-
);
71+
return (new Factory)->fromClassReflection(new \ReflectionClass($class));
7772
}
7873

7974

@@ -312,39 +307,6 @@ public function addTrait(string $name, array $resolutions = []): self
312307
}
313308

314309

315-
/**
316-
* @deprecated use setConstants()
317-
* @return static
318-
*/
319-
public function setConsts(array $consts): self
320-
{
321-
trigger_error(__METHOD__ . '() is deprecated, use setConstants()', E_USER_DEPRECATED);
322-
return $this->setConstants($consts);
323-
}
324-
325-
326-
/**
327-
* @deprecated use getConstants()
328-
*/
329-
public function getConsts(): array
330-
{
331-
trigger_error(__METHOD__ . '() is deprecated, use similar getConstants()', E_USER_DEPRECATED);
332-
return array_map(function ($const) { return $const->getValue(); }, $this->consts);
333-
}
334-
335-
336-
/**
337-
* @deprecated use addConstant()
338-
* @return static
339-
*/
340-
public function addConst(string $name, $value): self
341-
{
342-
trigger_error(__METHOD__ . '() is deprecated, use similar addConstant()', E_USER_DEPRECATED);
343-
$this->addConstant($name, $value);
344-
return $this;
345-
}
346-
347-
348310
/**
349311
* @param Constant[]|mixed[]
350312
* @return static

src/PhpGenerator/Method.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ final class Method
4343
*/
4444
public static function from($method): self
4545
{
46-
if ($method instanceof \ReflectionMethod) {
47-
trigger_error(__METHOD__ . '() accepts only method name.', E_USER_DEPRECATED);
48-
} else {
49-
$method = Nette\Utils\Callback::toReflection($method);
50-
}
51-
return (new Factory)->fromMethodReflection($method);
46+
return (new Factory)->fromMethodReflection(Nette\Utils\Callback::toReflection($method));
5247
}
5348

5449

@@ -85,10 +80,6 @@ public function __toString(): string
8580
*/
8681
public function setBody($code, array $args = null): self
8782
{
88-
if ($code === false) {
89-
$code = null;
90-
trigger_error(__METHOD__ . '() use null instead of false', E_USER_DEPRECATED);
91-
}
9283
$this->body = $args === null ? $code : Helpers::formatArgs($code, $args);
9384
return $this;
9485
}

src/PhpGenerator/Parameter.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,6 @@ public function setOptional(bool $state = true): self
8686
}
8787

8888

89-
/**
90-
* @deprecated use hasDefaultValue()
91-
*/
92-
public function isOptional(): bool
93-
{
94-
trigger_error(__METHOD__ . '() is deprecated, use hasDefaultValue()', E_USER_DEPRECATED);
95-
return $this->hasDefaultValue;
96-
}
97-
98-
9989
/**
10090
* @return static
10191
*/

src/PhpGenerator/PhpNamespace.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ public function __construct(string $name)
5353
}
5454

5555

56-
/** @deprecated */
57-
public function setName($name)
58-
{
59-
trigger_error(__METHOD__ . '() is deprecated, use constructor.', E_USER_DEPRECATED);
60-
$this->__construct($name);
61-
return $this;
62-
}
63-
64-
6556
public function getName(): string
6657
{
6758
return $this->name;
@@ -156,8 +147,7 @@ public function unresolveName(string $name): string
156147
public function addClass(string $name): ClassType
157148
{
158149
if (isset($this->classes[$name])) {
159-
trigger_error(__METHOD__ . "() class $name was already added.", E_USER_DEPRECATED);
160-
return $this->classes[$name];
150+
throw new Nette\InvalidArgumentException("Class $name was already added.");
161151
}
162152
$this->addUse($this->name . '\\' . $name);
163153
return $this->classes[$name] = new ClassType($name, $this);

0 commit comments

Comments
 (0)