@vituum/vite-plugin-latte 1.2.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/index.js +5 -3
  2. package/index.php +2 -0
  3. package/package.json +6 -6
  4. package/vendor/autoload.php +1 -1
  5. package/vendor/composer/InstalledVersions.php +7 -4
  6. package/vendor/composer/autoload_classmap.php +1 -0
  7. package/vendor/composer/autoload_real.php +4 -4
  8. package/vendor/composer/autoload_static.php +3 -2
  9. package/vendor/composer/installed.json +21 -20
  10. package/vendor/composer/installed.php +8 -8
  11. package/vendor/latte/latte/composer.json +6 -5
  12. package/vendor/latte/latte/readme.md +27 -9
  13. package/vendor/latte/latte/src/Bridges/Tracy/templates/LattePanel.panel.phtml +4 -1
  14. package/vendor/latte/latte/src/Latte/Compiler/TagLexer.php +1 -1
  15. package/vendor/latte/latte/src/Latte/Compiler/TagParserData.php +129 -129
  16. package/vendor/latte/latte/src/Latte/Compiler/TemplateGenerator.php +1 -1
  17. package/vendor/latte/latte/src/Latte/Compiler/TemplateParser.php +1 -1
  18. package/vendor/latte/latte/src/Latte/Engine.php +22 -2
  19. package/vendor/latte/latte/src/Latte/Essential/CachingIterator.php +2 -3
  20. package/vendor/latte/latte/src/Latte/Essential/CoreExtension.php +9 -1
  21. package/vendor/latte/latte/src/Latte/Essential/Filters.php +110 -10
  22. package/vendor/latte/latte/src/Latte/Essential/Nodes/ImportNode.php +8 -2
  23. package/vendor/latte/latte/src/Latte/Essential/Nodes/VarNode.php +14 -18
  24. package/vendor/latte/latte/src/Latte/Essential/TranslatorExtension.php +1 -1
  25. package/vendor/latte/latte/src/Latte/Loaders/FileLoader.php +5 -4
  26. package/vendor/latte/latte/src/Latte/Runtime/Template.php +1 -1
  27. package/vendor/latte/latte/src/Latte/Sandbox/Nodes/FunctionCallNode.php +0 -1
  28. package/vendor/nette/utils/composer.json +1 -1
  29. package/vendor/nette/utils/readme.md +25 -26
  30. package/vendor/nette/utils/src/Iterators/CachingIterator.php +5 -19
  31. package/vendor/nette/utils/src/Iterators/Mapper.php +1 -2
  32. package/vendor/nette/utils/src/Utils/Arrays.php +61 -29
  33. package/vendor/nette/utils/src/Utils/Callback.php +1 -1
  34. package/vendor/nette/utils/src/Utils/FileSystem.php +15 -2
  35. package/vendor/nette/utils/src/Utils/Finder.php +1 -1
  36. package/vendor/nette/utils/src/Utils/Helpers.php +3 -0
  37. package/vendor/nette/utils/src/Utils/Image.php +33 -46
  38. package/vendor/nette/utils/src/Utils/Iterables.php +100 -20
  39. package/vendor/nette/utils/src/Utils/Reflection.php +7 -5
  40. package/vendor/nette/utils/src/Utils/Strings.php +27 -8
  41. package/vendor/nette/utils/src/Utils/Type.php +2 -2
  42. package/vendor/nette/utils/src/Utils/exceptions.php +5 -5
  43. package/vendor/nette/utils/src/exceptions.php +20 -15
@@ -505,6 +505,6 @@ class Finder implements \IteratorAggregate
505
505
  '\-' => '-',
506
506
  ],
507
507
  );
508
- return '#' . $anchor . $pattern . '$#D' . (defined('PHP_WINDOWS_VERSION_BUILD') ? 'i' : '');
508
+ return '#' . $anchor . $pattern . '$#D' . (Helpers::IsWindows ? 'i' : '');
509
509
  }
510
510
  }
@@ -14,6 +14,9 @@ use Nette;
14
14
 
15
15
  class Helpers
16
16
  {
17
+ public const IsWindows = PHP_OS_FAMILY === 'Windows';
18
+
19
+
17
20
  /**
18
21
  * Executes a callback and returns the captured output as a string.
19
22
  */
@@ -163,10 +163,7 @@ class Image
163
163
  */
164
164
  public static function fromFile(string $file, ?int &$type = null): static
165
165
  {
166
- if (!extension_loaded('gd')) {
167
- throw new Nette\NotSupportedException('PHP extension GD is not loaded.');
168
- }
169
-
166
+ self::ensureExtension();
170
167
  $type = self::detectTypeFromFile($file);
171
168
  if (!$type) {
172
169
  throw new UnknownImageFileException(is_file($file) ? "Unknown type of file '$file'." : "File '$file' not found.");
@@ -183,10 +180,7 @@ class Image
183
180
  */
184
181
  public static function fromString(string $s, ?int &$type = null): static
185
182
  {
186
- if (!extension_loaded('gd')) {
187
- throw new Nette\NotSupportedException('PHP extension GD is not loaded.');
188
- }
189
-
183
+ self::ensureExtension();
190
184
  $type = self::detectTypeFromString($s);
191
185
  if (!$type) {
192
186
  throw new UnknownImageFileException('Unknown type of image.');
@@ -221,10 +215,7 @@ class Image
221
215
  */
222
216
  public static function fromBlank(int $width, int $height, ImageColor|array|null $color = null): static
223
217
  {
224
- if (!extension_loaded('gd')) {
225
- throw new Nette\NotSupportedException('PHP extension GD is not loaded.');
226
- }
227
-
218
+ self::ensureExtension();
228
219
  if ($width < 1 || $height < 1) {
229
220
  throw new Nette\InvalidArgumentException('Image width and height must be greater than zero.');
230
221
  }
@@ -308,6 +299,7 @@ class Image
308
299
  */
309
300
  public static function isTypeSupported(int $type): bool
310
301
  {
302
+ self::ensureExtension();
311
303
  return (bool) (imagetypes() & match ($type) {
312
304
  ImageType::JPEG => IMG_JPG,
313
305
  ImageType::PNG => IMG_PNG,
@@ -323,6 +315,7 @@ class Image
323
315
  /** @return ImageType[] */
324
316
  public static function getSupportedTypes(): array
325
317
  {
318
+ self::ensureExtension();
326
319
  $flag = imagetypes();
327
320
  return array_filter([
328
321
  $flag & IMG_GIF ? ImageType::GIF : null,
@@ -640,6 +633,7 @@ class Image
640
633
  array $options = [],
641
634
  ): array
642
635
  {
636
+ self::ensureExtension();
643
637
  $box = imagettfbbox($size, $angle, $fontFile, $text, $options);
644
638
  return [
645
639
  'left' => $minX = min([$box[0], $box[2], $box[4], $box[6]]),
@@ -724,42 +718,27 @@ class Image
724
718
  */
725
719
  private function output(int $type, ?int $quality, ?string $file = null): void
726
720
  {
727
- switch ($type) {
728
- case ImageType::JPEG:
729
- $quality = $quality === null ? 85 : max(0, min(100, $quality));
730
- $success = @imagejpeg($this->image, $file, $quality); // @ is escalated to exception
731
- break;
732
-
733
- case ImageType::PNG:
734
- $quality = $quality === null ? 9 : max(0, min(9, $quality));
735
- $success = @imagepng($this->image, $file, $quality); // @ is escalated to exception
736
- break;
737
-
738
- case ImageType::GIF:
739
- $success = @imagegif($this->image, $file); // @ is escalated to exception
740
- break;
741
-
742
- case ImageType::WEBP:
743
- $quality = $quality === null ? 80 : max(0, min(100, $quality));
744
- $success = @imagewebp($this->image, $file, $quality); // @ is escalated to exception
745
- break;
746
-
747
- case ImageType::AVIF:
748
- $quality = $quality === null ? 30 : max(0, min(100, $quality));
749
- $success = @imageavif($this->image, $file, $quality); // @ is escalated to exception
750
- break;
751
-
752
- case ImageType::BMP:
753
- $success = @imagebmp($this->image, $file); // @ is escalated to exception
754
- break;
755
-
756
- default:
757
- throw new Nette\InvalidArgumentException("Unsupported image type '$type'.");
758
- }
721
+ [$defQuality, $min, $max] = match ($type) {
722
+ ImageType::JPEG => [85, 0, 100],
723
+ ImageType::PNG => [9, 0, 9],
724
+ ImageType::GIF => [null, null, null],
725
+ ImageType::WEBP => [80, 0, 100],
726
+ ImageType::AVIF => [30, 0, 100],
727
+ ImageType::BMP => [null, null, null],
728
+ default => throw new Nette\InvalidArgumentException("Unsupported image type '$type'."),
729
+ };
759
730
 
760
- if (!$success) {
761
- throw new ImageException(Helpers::getLastError() ?: 'Unknown error');
731
+ $args = [$this->image, $file];
732
+ if ($defQuality !== null) {
733
+ $args[] = $quality === null ? $defQuality : max($min, min($max, $quality));
762
734
  }
735
+
736
+ Callback::invokeSafe('image' . self::Formats[$type], $args, function (string $message) use ($file): void {
737
+ if ($file !== null) {
738
+ @unlink($file);
739
+ }
740
+ throw new ImageException($message);
741
+ });
763
742
  }
764
743
 
765
744
 
@@ -826,4 +805,12 @@ class Image
826
805
  $color = $color instanceof ImageColor ? $color->toRGBA() : array_values($color);
827
806
  return imagecolorallocatealpha($this->image, ...$color) ?: imagecolorresolvealpha($this->image, ...$color);
828
807
  }
808
+
809
+
810
+ private static function ensureExtension(): void
811
+ {
812
+ if (!extension_loaded('gd')) {
813
+ throw new Nette\NotSupportedException('PHP extension GD is not loaded.');
814
+ }
815
+ }
829
816
  }
@@ -49,10 +49,11 @@ final class Iterables
49
49
 
50
50
  /**
51
51
  * Returns the first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null.
52
- * The $predicate has the signature `function (mixed $value, mixed $key, iterable $iterable): bool`.
53
- * @template T
54
- * @param iterable<T> $iterable
55
- * @return ?T
52
+ * @template K
53
+ * @template V
54
+ * @param iterable<K, V> $iterable
55
+ * @param ?callable(V, K, iterable<K, V>): bool $predicate
56
+ * @return ?V
56
57
  */
57
58
  public static function first(iterable $iterable, ?callable $predicate = null, ?callable $else = null): mixed
58
59
  {
@@ -67,10 +68,11 @@ final class Iterables
67
68
 
68
69
  /**
69
70
  * Returns the key of first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null.
70
- * The $predicate has the signature `function (mixed $value, mixed $key, iterable $iterable): bool`.
71
- * @template T
72
- * @param iterable<T, mixed> $iterable
73
- * @return ?T
71
+ * @template K
72
+ * @template V
73
+ * @param iterable<K, V> $iterable
74
+ * @param ?callable(V, K, iterable<K, V>): bool $predicate
75
+ * @return ?K
74
76
  */
75
77
  public static function firstKey(iterable $iterable, ?callable $predicate = null, ?callable $else = null): mixed
76
78
  {
@@ -84,11 +86,10 @@ final class Iterables
84
86
 
85
87
 
86
88
  /**
87
- * Tests whether at least one element in the iterator passes the test implemented by the
88
- * provided callback with signature `function (mixed $value, mixed $key, iterable $iterable): bool`.
89
+ * Tests whether at least one element in the iterator passes the test implemented by the provided function.
89
90
  * @template K
90
91
  * @template V
91
- * @param iterable<K, V> $iterable
92
+ * @param iterable<K, V> $iterable
92
93
  * @param callable(V, K, iterable<K, V>): bool $predicate
93
94
  */
94
95
  public static function some(iterable $iterable, callable $predicate): bool
@@ -103,11 +104,10 @@ final class Iterables
103
104
 
104
105
 
105
106
  /**
106
- * Tests whether all elements in the iterator pass the test implemented by the provided function,
107
- * which has the signature `function (mixed $value, mixed $key, iterable $iterable): bool`.
107
+ * Tests whether all elements in the iterator pass the test implemented by the provided function.
108
108
  * @template K
109
109
  * @template V
110
- * @param iterable<K, V> $iterable
110
+ * @param iterable<K, V> $iterable
111
111
  * @param callable(V, K, iterable<K, V>): bool $predicate
112
112
  */
113
113
  public static function every(iterable $iterable, callable $predicate): bool
@@ -123,11 +123,10 @@ final class Iterables
123
123
 
124
124
  /**
125
125
  * Iterator that filters elements according to a given $predicate. Maintains original keys.
126
- * The callback has the signature `function (mixed $value, mixed $key, iterable $iterable): bool`.
127
126
  * @template K
128
127
  * @template V
129
- * @param iterable<K, V> $iterable
130
- * @param callable(V, K, iterable<K, V>): bool $predicate
128
+ * @param iterable<K, V> $iterable
129
+ * @param callable(V, K, iterable<K, V>): bool $predicate
131
130
  * @return \Generator<K, V>
132
131
  */
133
132
  public static function filter(iterable $iterable, callable $predicate): \Generator
@@ -142,12 +141,11 @@ final class Iterables
142
141
 
143
142
  /**
144
143
  * Iterator that transforms values by calling $transformer. Maintains original keys.
145
- * The callback has the signature `function (mixed $value, mixed $key, iterable $iterable): bool`.
146
144
  * @template K
147
145
  * @template V
148
146
  * @template R
149
- * @param iterable<K, V> $iterable
150
- * @param callable(V, K, iterable<K, V>): R $transformer
147
+ * @param iterable<K, V> $iterable
148
+ * @param callable(V, K, iterable<K, V>): R $transformer
151
149
  * @return \Generator<K, R>
152
150
  */
153
151
  public static function map(iterable $iterable, callable $transformer): \Generator
@@ -156,4 +154,86 @@ final class Iterables
156
154
  yield $k => $transformer($v, $k, $iterable);
157
155
  }
158
156
  }
157
+
158
+
159
+ /**
160
+ * Iterator that transforms keys and values by calling $transformer. If it returns null, the element is skipped.
161
+ * @template K
162
+ * @template V
163
+ * @template ResV
164
+ * @template ResK
165
+ * @param iterable<K, V> $iterable
166
+ * @param callable(V, K, iterable<K, V>): ?array{ResV, ResK} $transformer
167
+ * @return \Generator<ResV, ResK>
168
+ */
169
+ public static function mapWithKeys(iterable $iterable, callable $transformer): \Generator
170
+ {
171
+ foreach ($iterable as $k => $v) {
172
+ $pair = $transformer($v, $k, $iterable);
173
+ if ($pair) {
174
+ yield $pair[0] => $pair[1];
175
+ }
176
+ }
177
+ }
178
+
179
+
180
+ /**
181
+ * Wraps around iterator and caches its keys and values during iteration.
182
+ * This allows the data to be re-iterated multiple times.
183
+ * @template K
184
+ * @template V
185
+ * @param iterable<K, V> $iterable
186
+ * @return \IteratorAggregate<K, V>
187
+ */
188
+ public static function memoize(iterable $iterable): iterable
189
+ {
190
+ return new class (self::toIterator($iterable)) implements \IteratorAggregate {
191
+ public function __construct(
192
+ private \Iterator $iterator,
193
+ private array $cache = [],
194
+ ) {
195
+ }
196
+
197
+
198
+ public function getIterator(): \Generator
199
+ {
200
+ if (!$this->cache) {
201
+ $this->iterator->rewind();
202
+ }
203
+ $i = 0;
204
+ while (true) {
205
+ if (isset($this->cache[$i])) {
206
+ [$k, $v] = $this->cache[$i];
207
+ } elseif ($this->iterator->valid()) {
208
+ $k = $this->iterator->key();
209
+ $v = $this->iterator->current();
210
+ $this->iterator->next();
211
+ $this->cache[$i] = [$k, $v];
212
+ } else {
213
+ break;
214
+ }
215
+ yield $k => $v;
216
+ $i++;
217
+ }
218
+ }
219
+ };
220
+ }
221
+
222
+
223
+ /**
224
+ * Creates an iterator from anything that is iterable.
225
+ * @template K
226
+ * @template V
227
+ * @param iterable<K, V> $iterable
228
+ * @return \Iterator<K, V>
229
+ */
230
+ public static function toIterator(iterable $iterable): \Iterator
231
+ {
232
+ return match (true) {
233
+ $iterable instanceof \Iterator => $iterable,
234
+ $iterable instanceof \IteratorAggregate => self::toIterator($iterable->getIterator()),
235
+ is_array($iterable) => new \ArrayIterator($iterable),
236
+ default => throw new Nette\ShouldNotHappenException,
237
+ };
238
+ }
159
239
  }
@@ -19,14 +19,14 @@ final class Reflection
19
19
  {
20
20
  use Nette\StaticClass;
21
21
 
22
- /** @deprecated use Nette\Utils\Validator::isBuiltinType() */
22
+ /** @deprecated use Nette\Utils\Validators::isBuiltinType() */
23
23
  public static function isBuiltinType(string $type): bool
24
24
  {
25
25
  return Validators::isBuiltinType($type);
26
26
  }
27
27
 
28
28
 
29
- /** @deprecated use Nette\Utils\Validator::isClassKeyword() */
29
+ /** @deprecated use Nette\Utils\Validators::isClassKeyword() */
30
30
  public static function isClassKeyword(string $name): bool
31
31
  {
32
32
  return Validators::isClassKeyword($name);
@@ -100,7 +100,7 @@ final class Reflection
100
100
 
101
101
  $hash = [$method->getFileName(), $method->getStartLine(), $method->getEndLine()];
102
102
  if (($alias = $decl->getTraitAliases()[$method->name] ?? null)
103
- && ($m = new \ReflectionMethod($alias))
103
+ && ($m = new \ReflectionMethod(...explode('::', $alias, 2)))
104
104
  && $hash === [$m->getFileName(), $m->getStartLine(), $m->getEndLine()]
105
105
  ) {
106
106
  return self::getMethodDeclaringMethod($m);
@@ -125,7 +125,7 @@ final class Reflection
125
125
  public static function areCommentsAvailable(): bool
126
126
  {
127
127
  static $res;
128
- return $res ?? $res = (bool) (new \ReflectionMethod(__METHOD__))->getDocComment();
128
+ return $res ?? $res = (bool) (new \ReflectionMethod(self::class, __FUNCTION__))->getDocComment();
129
129
  }
130
130
 
131
131
 
@@ -136,7 +136,9 @@ final class Reflection
136
136
  } elseif ($ref instanceof \ReflectionMethod) {
137
137
  return $ref->getDeclaringClass()->name . '::' . $ref->name . '()';
138
138
  } elseif ($ref instanceof \ReflectionFunction) {
139
- return $ref->name . '()';
139
+ return PHP_VERSION_ID >= 80200 && $ref->isAnonymous()
140
+ ? '{closure}()'
141
+ : $ref->name . '()';
140
142
  } elseif ($ref instanceof \ReflectionProperty) {
141
143
  return self::getPropertyDeclaringClass($ref)->name . '::$' . $ref->name;
142
144
  } elseif ($ref instanceof \ReflectionParameter) {
@@ -28,7 +28,7 @@ class Strings
28
28
 
29
29
 
30
30
  /**
31
- * @deprecated use Nette\Utils\Validator::isUnicode()
31
+ * @deprecated use Nette\Utils\Validators::isUnicode()
32
32
  */
33
33
  public static function checkEncoding(string $s): bool
34
34
  {
@@ -547,7 +547,6 @@ class Strings
547
547
  return $utf8 && $captureOffset
548
548
  ? self::bytesToChars($subject, [$m])[0]
549
549
  : $m;
550
-
551
550
  }
552
551
 
553
552
 
@@ -589,6 +588,7 @@ class Strings
589
588
  /**
590
589
  * Searches the string for all occurrences matching the regular expression and
591
590
  * returns an array of arrays containing the found expression and each subexpression.
591
+ * @return ($lazy is true ? \Generator<int, array> : array[])
592
592
  */
593
593
  public static function matchAll(
594
594
  string $subject,
@@ -599,21 +599,41 @@ class Strings
599
599
  bool $unmatchedAsNull = false,
600
600
  bool $patternOrder = false,
601
601
  bool $utf8 = false,
602
- ): array
602
+ bool $lazy = false,
603
+ ): array|\Generator
603
604
  {
604
- $flags = is_int($captureOffset) // back compatibility
605
- ? $captureOffset
606
- : ($captureOffset ? PREG_OFFSET_CAPTURE : 0) | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0) | ($patternOrder ? PREG_PATTERN_ORDER : 0);
607
-
608
605
  if ($utf8) {
609
606
  $offset = strlen(self::substring($subject, 0, $offset));
610
607
  $pattern .= 'u';
611
608
  }
612
609
 
610
+ if ($lazy) {
611
+ $flags = PREG_OFFSET_CAPTURE | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0);
612
+ return (function () use ($utf8, $captureOffset, $flags, $subject, $pattern, $offset) {
613
+ $counter = 0;
614
+ while (
615
+ $offset <= strlen($subject) - ($counter ? 1 : 0)
616
+ && self::pcre('preg_match', [$pattern, $subject, &$m, $flags, $offset])
617
+ ) {
618
+ $offset = $m[0][1] + max(1, strlen($m[0][0]));
619
+ if (!$captureOffset) {
620
+ $m = array_map(fn($item) => $item[0], $m);
621
+ } elseif ($utf8) {
622
+ $m = self::bytesToChars($subject, [$m])[0];
623
+ }
624
+ yield $counter++ => $m;
625
+ }
626
+ })();
627
+ }
628
+
613
629
  if ($offset > strlen($subject)) {
614
630
  return [];
615
631
  }
616
632
 
633
+ $flags = is_int($captureOffset) // back compatibility
634
+ ? $captureOffset
635
+ : ($captureOffset ? PREG_OFFSET_CAPTURE : 0) | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0) | ($patternOrder ? PREG_PATTERN_ORDER : 0);
636
+
617
637
  self::pcre('preg_match_all', [
618
638
  $pattern, $subject, &$m,
619
639
  ($flags & PREG_PATTERN_ORDER) ? $flags : ($flags | PREG_SET_ORDER),
@@ -622,7 +642,6 @@ class Strings
622
642
  return $utf8 && $captureOffset
623
643
  ? self::bytesToChars($subject, $m)
624
644
  : $m;
625
-
626
645
  }
627
646
 
628
647
 
@@ -260,8 +260,8 @@ final class Type
260
260
  $subtypes,
261
261
  fn($subtype) => Validators::isBuiltinType($type)
262
262
  ? strcasecmp($type, $subtype) === 0
263
- : is_a($subtype, $type, allow_string: true)
264
- )
263
+ : is_a($subtype, $type, allow_string: true),
264
+ ),
265
265
  );
266
266
  }
267
267
  }
@@ -11,7 +11,7 @@ namespace Nette\Utils;
11
11
 
12
12
 
13
13
  /**
14
- * The exception that is thrown when an image error occurs.
14
+ * An error occurred while working with the image.
15
15
  */
16
16
  class ImageException extends \Exception
17
17
  {
@@ -19,7 +19,7 @@ class ImageException extends \Exception
19
19
 
20
20
 
21
21
  /**
22
- * The exception that indicates invalid image file.
22
+ * The image file is invalid or in an unsupported format.
23
23
  */
24
24
  class UnknownImageFileException extends ImageException
25
25
  {
@@ -27,7 +27,7 @@ class UnknownImageFileException extends ImageException
27
27
 
28
28
 
29
29
  /**
30
- * The exception that indicates error of JSON encoding/decoding.
30
+ * JSON encoding or decoding failed.
31
31
  */
32
32
  class JsonException extends \JsonException
33
33
  {
@@ -35,7 +35,7 @@ class JsonException extends \JsonException
35
35
 
36
36
 
37
37
  /**
38
- * The exception that indicates error of the last Regexp execution.
38
+ * Regular expression pattern or execution failed.
39
39
  */
40
40
  class RegexpException extends \Exception
41
41
  {
@@ -43,7 +43,7 @@ class RegexpException extends \Exception
43
43
 
44
44
 
45
45
  /**
46
- * The exception that indicates assertion error.
46
+ * Type validation failed. The value doesn't match the expected type constraints.
47
47
  */
48
48
  class AssertionException extends \Exception
49
49
  {
@@ -11,8 +11,7 @@ namespace Nette;
11
11
 
12
12
 
13
13
  /**
14
- * The exception that is thrown when the value of an argument is
15
- * outside the allowable range of values as defined by the invoked method.
14
+ * The value is outside the allowed range.
16
15
  */
17
16
  class ArgumentOutOfRangeException extends \InvalidArgumentException
18
17
  {
@@ -20,8 +19,7 @@ class ArgumentOutOfRangeException extends \InvalidArgumentException
20
19
 
21
20
 
22
21
  /**
23
- * The exception that is thrown when a method call is invalid for the object's
24
- * current state, method has been invoked at an illegal or inappropriate time.
22
+ * The object is in a state that does not allow the requested operation.
25
23
  */
26
24
  class InvalidStateException extends \RuntimeException
27
25
  {
@@ -29,7 +27,7 @@ class InvalidStateException extends \RuntimeException
29
27
 
30
28
 
31
29
  /**
32
- * The exception that is thrown when a requested method or operation is not implemented.
30
+ * The requested feature is not implemented.
33
31
  */
34
32
  class NotImplementedException extends \LogicException
35
33
  {
@@ -37,8 +35,7 @@ class NotImplementedException extends \LogicException
37
35
 
38
36
 
39
37
  /**
40
- * The exception that is thrown when an invoked method is not supported. For scenarios where
41
- * it is sometimes possible to perform the requested operation, see InvalidStateException.
38
+ * The requested operation is not supported.
42
39
  */
43
40
  class NotSupportedException extends \LogicException
44
41
  {
@@ -46,7 +43,7 @@ class NotSupportedException extends \LogicException
46
43
 
47
44
 
48
45
  /**
49
- * The exception that is thrown when a requested method or operation is deprecated.
46
+ * The requested feature is deprecated and no longer available.
50
47
  */
51
48
  class DeprecatedException extends NotSupportedException
52
49
  {
@@ -54,7 +51,7 @@ class DeprecatedException extends NotSupportedException
54
51
 
55
52
 
56
53
  /**
57
- * The exception that is thrown when accessing a class member (property or method) fails.
54
+ * Cannot access the requested class property or method.
58
55
  */
59
56
  class MemberAccessException extends \Error
60
57
  {
@@ -62,7 +59,7 @@ class MemberAccessException extends \Error
62
59
 
63
60
 
64
61
  /**
65
- * The exception that is thrown when an I/O error occurs.
62
+ * Failed to read from or write to a file or stream.
66
63
  */
67
64
  class IOException extends \RuntimeException
68
65
  {
@@ -70,7 +67,7 @@ class IOException extends \RuntimeException
70
67
 
71
68
 
72
69
  /**
73
- * The exception that is thrown when accessing a file that does not exist on disk.
70
+ * The requested file does not exist.
74
71
  */
75
72
  class FileNotFoundException extends IOException
76
73
  {
@@ -78,7 +75,7 @@ class FileNotFoundException extends IOException
78
75
 
79
76
 
80
77
  /**
81
- * The exception that is thrown when part of a file or directory cannot be found.
78
+ * The requested directory does not exist.
82
79
  */
83
80
  class DirectoryNotFoundException extends IOException
84
81
  {
@@ -86,7 +83,7 @@ class DirectoryNotFoundException extends IOException
86
83
 
87
84
 
88
85
  /**
89
- * The exception that is thrown when an argument does not match with the expected value.
86
+ * The provided argument has invalid type or format.
90
87
  */
91
88
  class InvalidArgumentException extends \InvalidArgumentException
92
89
  {
@@ -94,7 +91,7 @@ class InvalidArgumentException extends \InvalidArgumentException
94
91
 
95
92
 
96
93
  /**
97
- * The exception that is thrown when an illegal index was requested.
94
+ * The requested array or collection index does not exist.
98
95
  */
99
96
  class OutOfRangeException extends \OutOfRangeException
100
97
  {
@@ -102,8 +99,16 @@ class OutOfRangeException extends \OutOfRangeException
102
99
 
103
100
 
104
101
  /**
105
- * The exception that is thrown when a value (typically returned by function) does not match with the expected value.
102
+ * The returned value has unexpected type or format.
106
103
  */
107
104
  class UnexpectedValueException extends \UnexpectedValueException
108
105
  {
109
106
  }
107
+
108
+
109
+ /**
110
+ * Houston, we have a problem.
111
+ */
112
+ class ShouldNotHappenException extends \LogicException
113
+ {
114
+ }