Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Assert often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Assert, and based on these observations, apply Extract Interface, too.
| 1 | <?php declare(strict_types=1); |
||
| 24 | class Assert |
||
| 25 | { |
||
| 26 | const INVALID_FLOAT = 9; |
||
| 27 | const INVALID_INTEGER = 10; |
||
| 28 | const INVALID_DIGIT = 11; |
||
| 29 | const INVALID_INTEGERISH = 12; |
||
| 30 | const INVALID_BOOLEAN = 13; |
||
| 31 | const VALUE_EMPTY = 14; |
||
| 32 | const VALUE_NULL = 15; |
||
| 33 | const INVALID_STRING = 16; |
||
| 34 | const INVALID_REGEX = 17; |
||
| 35 | const INVALID_MIN_LENGTH = 18; |
||
| 36 | const INVALID_MAX_LENGTH = 19; |
||
| 37 | const INVALID_STRING_START = 20; |
||
| 38 | const INVALID_STRING_CONTAINS = 21; |
||
| 39 | const INVALID_CHOICE = 22; |
||
| 40 | const INVALID_NUMERIC = 23; |
||
| 41 | const INVALID_ARRAY = 24; |
||
| 42 | const INVALID_KEY_EXISTS = 26; |
||
| 43 | const INVALID_NOT_BLANK = 27; |
||
| 44 | const INVALID_INSTANCE_OF = 28; |
||
| 45 | const INVALID_SUBCLASS_OF = 29; |
||
| 46 | const INVALID_RANGE = 30; |
||
| 47 | const INVALID_ALNUM = 31; |
||
| 48 | const INVALID_TRUE = 32; |
||
| 49 | const INVALID_EQ = 33; |
||
| 50 | const INVALID_SAME = 34; |
||
| 51 | const INVALID_MIN = 35; |
||
| 52 | const INVALID_MAX = 36; |
||
| 53 | const INVALID_LENGTH = 37; |
||
| 54 | const INVALID_FALSE = 38; |
||
| 55 | const INVALID_STRING_END = 39; |
||
| 56 | const INVALID_UUID = 40; |
||
| 57 | const INVALID_COUNT = 41; |
||
| 58 | const INVALID_NOT_EQ = 42; |
||
| 59 | const INVALID_NOT_SAME = 43; |
||
| 60 | const INVALID_TRAVERSABLE = 44; |
||
| 61 | const INVALID_ARRAY_ACCESSIBLE = 45; |
||
| 62 | const INVALID_KEY_ISSET = 46; |
||
| 63 | const INVALID_SAMACCOUNTNAME = 47; |
||
| 64 | const INVALID_USERPRINCIPALNAME = 48; |
||
| 65 | const INVALID_DIRECTORY = 101; |
||
| 66 | const INVALID_FILE = 102; |
||
| 67 | const INVALID_READABLE = 103; |
||
| 68 | const INVALID_WRITEABLE = 104; |
||
| 69 | const INVALID_CLASS = 105; |
||
| 70 | const INVALID_EMAIL = 201; |
||
| 71 | const INTERFACE_NOT_IMPLEMENTED = 202; |
||
| 72 | const INVALID_URL = 203; |
||
| 73 | const INVALID_NOT_INSTANCE_OF = 204; |
||
| 74 | const VALUE_NOT_EMPTY = 205; |
||
| 75 | const INVALID_JSON_STRING = 206; |
||
| 76 | const INVALID_OBJECT = 207; |
||
| 77 | const INVALID_METHOD = 208; |
||
| 78 | const INVALID_SCALAR = 209; |
||
| 79 | const INVALID_DATE = 210; |
||
| 80 | const INVALID_CALLABLE = 211; |
||
| 81 | const INVALID_KEYS_EXIST = 300; |
||
| 82 | const INVALID_PROPERTY_EXISTS = 301; |
||
| 83 | const INVALID_PROPERTIES_EXIST = 302; |
||
| 84 | const INVALID_UTF8 = 303; |
||
| 85 | const INVALID_DOMAIN_NAME = 304; |
||
| 86 | const INVALID_NOT_FALSE = 305; |
||
| 87 | const INVALID_FILE_OR_DIR = 306; |
||
| 88 | const INVALID_ASCII = 307; |
||
| 89 | const INVALID_NOT_REGEX = 308; |
||
| 90 | const INVALID_GREATER_THAN = 309; |
||
| 91 | const INVALID_LESS_THAN = 310; |
||
| 92 | const INVALID_GREATER_THAN_OR_EQ = 311; |
||
| 93 | const INVALID_LESS_THAN_OR_EQ = 312; |
||
| 94 | const INVALID_IP_ADDRESS = 313; |
||
| 95 | const INVALID_AUS_MOBILE = 314; |
||
| 96 | |||
| 97 | const EMERGENCY = 'emergency'; |
||
| 98 | const ALERT = 'alert'; |
||
| 99 | const CRITICAL = 'critical'; |
||
| 100 | const ERROR = 'error'; |
||
| 101 | const WARNING = 'warning'; |
||
| 102 | const NOTICE = 'notice'; |
||
| 103 | const INFO = 'info'; |
||
| 104 | const DEBUG = 'debug'; |
||
| 105 | |||
| 106 | /** @var bool */ |
||
| 107 | protected $nullOr = false; |
||
| 108 | |||
| 109 | /** @var bool */ |
||
| 110 | protected $emptyOr = false; |
||
| 111 | |||
| 112 | /** @var mixed */ |
||
| 113 | protected $value = null; |
||
| 114 | |||
| 115 | /** @var bool */ |
||
| 116 | protected $all = false; |
||
| 117 | |||
| 118 | /** @var null|string */ |
||
| 119 | protected $propertyPath = null; |
||
| 120 | |||
| 121 | /** @var null|string */ |
||
| 122 | protected $level = 'critical'; |
||
| 123 | |||
| 124 | /** @var int */ |
||
| 125 | protected $overrideCode = null; |
||
| 126 | |||
| 127 | /** @var string */ |
||
| 128 | protected $overrideError = ''; |
||
| 129 | /** |
||
| 130 | * Exception to throw when an assertion failed. |
||
| 131 | * |
||
| 132 | * @var string |
||
| 133 | */ |
||
| 134 | protected $exceptionClass = 'Terah\Assert\AssertionFailedException'; |
||
| 135 | |||
| 136 | /** |
||
| 137 | * @param mixed $value |
||
| 138 | */ |
||
| 139 | public function __construct($value) |
||
| 143 | |||
| 144 | |||
| 145 | /** |
||
| 146 | * @param \Closure[] $validators |
||
| 147 | * @return array |
||
| 148 | */ |
||
| 149 | public static function runValidators(array $validators) : array |
||
| 166 | |||
| 167 | /** |
||
| 168 | * @param $value |
||
| 169 | * @param string $name |
||
| 170 | * @param int $code |
||
| 171 | * @param string $error |
||
| 172 | * @param string $level |
||
| 173 | * @return Assert |
||
| 174 | */ |
||
| 175 | public static function that($value, $name='', $code=0, $error='', $level=Assert::WARNING) |
||
| 197 | |||
| 198 | /** |
||
| 199 | * @param mixed $value |
||
| 200 | * @return Assert |
||
| 201 | */ |
||
| 202 | public function reset($value) |
||
| 206 | |||
| 207 | /** |
||
| 208 | * @param mixed $value |
||
| 209 | * @return Assert |
||
| 210 | */ |
||
| 211 | public function value($value) |
||
| 216 | |||
| 217 | /** |
||
| 218 | * @param bool $nullOr |
||
| 219 | * @return Assert |
||
| 220 | */ |
||
| 221 | public function nullOr($nullOr = true) |
||
| 226 | |||
| 227 | /** |
||
| 228 | * @param bool $emptyOr |
||
| 229 | * @return Assert |
||
| 230 | */ |
||
| 231 | public function emptyOr($emptyOr = true) |
||
| 236 | |||
| 237 | /** |
||
| 238 | * @param bool $all |
||
| 239 | * @return Assert |
||
| 240 | */ |
||
| 241 | public function all($all = true) |
||
| 246 | |||
| 247 | /** |
||
| 248 | * Helper method that handles building the assertion failure exceptions. |
||
| 249 | * They are returned from this method so that the stack trace still shows |
||
| 250 | * the assertions method. |
||
| 251 | * |
||
| 252 | * @param string $message |
||
| 253 | * @param int $code |
||
| 254 | * @param string $propertyPath |
||
| 255 | * @param array $constraints |
||
| 256 | * @param string $level |
||
| 257 | * @return AssertionFailedException |
||
| 258 | */ |
||
| 259 | protected function createException($message, $code, $propertyPath, array $constraints = [], $level=null) |
||
| 267 | |||
| 268 | /** |
||
| 269 | * @param $exceptionClass |
||
| 270 | * @return Assert |
||
| 271 | */ |
||
| 272 | public function setExceptionClass($exceptionClass) |
||
| 277 | |||
| 278 | /** |
||
| 279 | * @param int $code |
||
| 280 | * @return Assert |
||
| 281 | */ |
||
| 282 | public function code($code) |
||
| 287 | |||
| 288 | /** |
||
| 289 | * @param int $level |
||
| 290 | * @return Assert |
||
| 291 | */ |
||
| 292 | public function level($level) |
||
| 297 | |||
| 298 | /** |
||
| 299 | * @param string $error |
||
| 300 | * @return Assert |
||
| 301 | */ |
||
| 302 | public function error($error) |
||
| 307 | |||
| 308 | /** |
||
| 309 | * @param string $name |
||
| 310 | * @return Assert |
||
| 311 | */ |
||
| 312 | public function name($name) |
||
| 317 | |||
| 318 | /** |
||
| 319 | * Assert that two values are equal (using == ). |
||
| 320 | * |
||
| 321 | * @param mixed $value2 |
||
| 322 | * @param string|null $message |
||
| 323 | * @param string|null $propertyPath |
||
| 324 | * @return Assert |
||
| 325 | * @throws AssertionFailedException |
||
| 326 | */ |
||
| 327 | public function eq($value2, $message = null, $propertyPath = null) |
||
| 345 | |||
| 346 | /** |
||
| 347 | * |
||
| 348 | * @param mixed $value2 |
||
| 349 | * @param string|null $message |
||
| 350 | * @param string|null $propertyPath |
||
| 351 | * @return Assert |
||
| 352 | * @throws AssertionFailedException |
||
| 353 | */ |
||
| 354 | public function greaterThan($value2, $message = null, $propertyPath = null) |
||
| 372 | |||
| 373 | /** |
||
| 374 | * |
||
| 375 | * @param mixed $value2 |
||
| 376 | * @param string|null $message |
||
| 377 | * @param string|null $propertyPath |
||
| 378 | * @return Assert |
||
| 379 | * @throws AssertionFailedException |
||
| 380 | */ |
||
| 381 | public function greaterThanOrEq($value2, $message = null, $propertyPath = null) |
||
| 399 | |||
| 400 | /** |
||
| 401 | * |
||
| 402 | * @param mixed $value2 |
||
| 403 | * @param string|null $message |
||
| 404 | * @param string|null $propertyPath |
||
| 405 | * @return Assert |
||
| 406 | * @throws AssertionFailedException |
||
| 407 | */ |
||
| 408 | public function lessThan($value2, $message = null, $propertyPath = null) |
||
| 426 | |||
| 427 | /** |
||
| 428 | * |
||
| 429 | * @param mixed $value2 |
||
| 430 | * @param string|null $message |
||
| 431 | * @param string|null $propertyPath |
||
| 432 | * @return Assert |
||
| 433 | * @throws AssertionFailedException |
||
| 434 | */ |
||
| 435 | public function lessThanOrEq($value2, $message = null, $propertyPath = null) |
||
| 453 | |||
| 454 | /** |
||
| 455 | * Assert that two values are the same (using ===). |
||
| 456 | * |
||
| 457 | * @param mixed $value2 |
||
| 458 | * @param string|null $message |
||
| 459 | * @param string|null $propertyPath |
||
| 460 | * @return Assert |
||
| 461 | * @throws AssertionFailedException |
||
| 462 | */ |
||
| 463 | public function same($value2, $message = null, $propertyPath = null) |
||
| 481 | |||
| 482 | /** |
||
| 483 | * Assert that two values are not equal (using == ). |
||
| 484 | * |
||
| 485 | * @param mixed $value2 |
||
| 486 | * @param string|null $message |
||
| 487 | * @param string|null $propertyPath |
||
| 488 | * @return Assert |
||
| 489 | * @throws AssertionFailedException |
||
| 490 | */ |
||
| 491 | public function notEq($value2, $message = null, $propertyPath = null) |
||
| 509 | |||
| 510 | /** |
||
| 511 | * @param string|null $message |
||
| 512 | * @param string|null $propertyPath |
||
| 513 | * |
||
| 514 | * @return $this |
||
| 515 | * @throws AssertionFailedException |
||
| 516 | */ |
||
| 517 | public function isCallable($message = null, $propertyPath = null) |
||
| 534 | |||
| 535 | /** |
||
| 536 | * Assert that two values are not the same (using === ). |
||
| 537 | * |
||
| 538 | * @param mixed $value2 |
||
| 539 | * @param string|null $message |
||
| 540 | * @param string|null $propertyPath |
||
| 541 | * @return Assert |
||
| 542 | * @throws AssertionFailedException |
||
| 543 | */ |
||
| 544 | public function notSame($value2, $message = null, $propertyPath = null) |
||
| 562 | |||
| 563 | /** |
||
| 564 | * @param string|null $message |
||
| 565 | * @param string|null $propertyPath |
||
| 566 | * @return Assert |
||
| 567 | * @throws AssertionFailedException |
||
| 568 | */ |
||
| 569 | public function id($message = null, $propertyPath = null) |
||
| 575 | |||
| 576 | /** |
||
| 577 | * @param string|null $message |
||
| 578 | * @param string|null $propertyPath |
||
| 579 | * @return Assert |
||
| 580 | * @throws AssertionFailedException |
||
| 581 | */ |
||
| 582 | public function unsignedInt($message=null, $propertyPath=null) |
||
| 589 | |||
| 590 | /** |
||
| 591 | * @param string|null $message |
||
| 592 | * @param string|null $propertyPath |
||
| 593 | * @return Assert |
||
| 594 | * @throws AssertionFailedException |
||
| 595 | */ |
||
| 596 | public function flag($message = null, $propertyPath = null) |
||
| 602 | |||
| 603 | /** |
||
| 604 | * @param string|null $message |
||
| 605 | * @param string|null $propertyPath |
||
| 606 | * @return Assert |
||
| 607 | * @throws AssertionFailedException |
||
| 608 | */ |
||
| 609 | public function status($message = null, $propertyPath = null) |
||
| 615 | |||
| 616 | /** |
||
| 617 | * @param string|null $message |
||
| 618 | * @param string|null $propertyPath |
||
| 619 | * @return Assert |
||
| 620 | */ |
||
| 621 | public function nullOrId($message = null, $propertyPath = null) |
||
| 625 | |||
| 626 | /** |
||
| 627 | * @param string|null $message |
||
| 628 | * @param string|null $propertyPath |
||
| 629 | * @return Assert |
||
| 630 | */ |
||
| 631 | public function allIds($message = null, $propertyPath = null) |
||
| 635 | |||
| 636 | /** |
||
| 637 | * @param string|null $message |
||
| 638 | * @param string|null $propertyPath |
||
| 639 | * @return Assert |
||
| 640 | * @throws AssertionFailedException |
||
| 641 | */ |
||
| 642 | public function int($message = null, $propertyPath = null) |
||
| 646 | |||
| 647 | /** |
||
| 648 | * Assert that value is a php integer. |
||
| 649 | * |
||
| 650 | * @param string|null $message |
||
| 651 | * @param string|null $propertyPath |
||
| 652 | * @return Assert |
||
| 653 | * @throws AssertionFailedException |
||
| 654 | */ |
||
| 655 | public function integer($message = null, $propertyPath = null) |
||
| 672 | |||
| 673 | /** |
||
| 674 | * Assert that value is a php float. |
||
| 675 | * |
||
| 676 | * @param string|null $message |
||
| 677 | * @param string|null $propertyPath |
||
| 678 | * @return Assert |
||
| 679 | * @throws AssertionFailedException |
||
| 680 | */ |
||
| 681 | public function float($message = null, $propertyPath = null) |
||
| 698 | |||
| 699 | /** |
||
| 700 | * Validates if an integer or integerish is a digit. |
||
| 701 | * |
||
| 702 | * @param string|null $message |
||
| 703 | * @param string|null $propertyPath |
||
| 704 | * @return Assert |
||
| 705 | * @throws AssertionFailedException |
||
| 706 | */ |
||
| 707 | public function digit($message = null, $propertyPath = null) |
||
| 724 | |||
| 725 | /** |
||
| 726 | * Validates if an string is a date . |
||
| 727 | * |
||
| 728 | * @param string|null $message |
||
| 729 | * @param string|null $propertyPath |
||
| 730 | * @return Assert |
||
| 731 | * @throws AssertionFailedException |
||
| 732 | */ |
||
| 733 | public function date($message = null, $propertyPath = null) |
||
| 751 | |||
| 752 | /** |
||
| 753 | * Assert that value is a php integer'ish. |
||
| 754 | * |
||
| 755 | * @param string|null $message |
||
| 756 | * @param string|null $propertyPath |
||
| 757 | * @return Assert |
||
| 758 | * @throws AssertionFailedException |
||
| 759 | */ |
||
| 760 | public function integerish($message = null, $propertyPath = null) |
||
| 777 | |||
| 778 | /** |
||
| 779 | * Assert that value is php boolean |
||
| 780 | * |
||
| 781 | * @param string|null $message |
||
| 782 | * @param string|null $propertyPath |
||
| 783 | * @return Assert |
||
| 784 | * @throws AssertionFailedException |
||
| 785 | */ |
||
| 786 | public function boolean($message = null, $propertyPath = null) |
||
| 803 | |||
| 804 | /** |
||
| 805 | * Assert that value is a PHP scalar |
||
| 806 | * |
||
| 807 | * @param string|null $message |
||
| 808 | * @param string|null $propertyPath |
||
| 809 | * @return Assert |
||
| 810 | * @throws AssertionFailedException |
||
| 811 | */ |
||
| 812 | public function scalar($message = null, $propertyPath = null) |
||
| 829 | |||
| 830 | /** |
||
| 831 | * Assert that value is not empty |
||
| 832 | * |
||
| 833 | * @param string|null $message |
||
| 834 | * @param string|null $propertyPath |
||
| 835 | * @return Assert |
||
| 836 | * @throws AssertionFailedException |
||
| 837 | */ |
||
| 838 | View Code Duplication | public function notEmpty($message = null, $propertyPath = null) |
|
| 855 | |||
| 856 | /** |
||
| 857 | * Assert that value is empty |
||
| 858 | * |
||
| 859 | * @param string|null $message |
||
| 860 | * @param string|null $propertyPath |
||
| 861 | * @return Assert |
||
| 862 | * @throws AssertionFailedException |
||
| 863 | */ |
||
| 864 | public function noContent($message = null, $propertyPath = null) |
||
| 881 | |||
| 882 | /** |
||
| 883 | * Assert that value is not null |
||
| 884 | * |
||
| 885 | * @param string|null $message |
||
| 886 | * @param string|null $propertyPath |
||
| 887 | * @return Assert |
||
| 888 | * @throws AssertionFailedException |
||
| 889 | */ |
||
| 890 | public function notNull($message = null, $propertyPath = null) |
||
| 907 | |||
| 908 | /** |
||
| 909 | * Assert that value is a string |
||
| 910 | * |
||
| 911 | * @param string|null $message |
||
| 912 | * @param string|null $propertyPath |
||
| 913 | * @return Assert |
||
| 914 | * @throws AssertionFailedException |
||
| 915 | */ |
||
| 916 | public function string($message = null, $propertyPath = null) |
||
| 934 | |||
| 935 | /** |
||
| 936 | * Assert that value matches a regex |
||
| 937 | * |
||
| 938 | * @param string $pattern |
||
| 939 | * @param string|null $message |
||
| 940 | * @param string|null $propertyPath |
||
| 941 | * @return Assert |
||
| 942 | * @throws AssertionFailedException |
||
| 943 | */ |
||
| 944 | public function regex($pattern, $message=null, $propertyPath=null) |
||
| 962 | |||
| 963 | /** |
||
| 964 | * @param string $message |
||
| 965 | * @param string $propertyPath |
||
| 966 | * @return $this |
||
| 967 | * @throws AssertionFailedException |
||
| 968 | */ |
||
| 969 | public function ipAddress($message = null, $propertyPath = null) |
||
| 988 | |||
| 989 | /** |
||
| 990 | * @param string $pattern |
||
| 991 | * @param string|null $message |
||
| 992 | * @param string|null $propertyPath |
||
| 993 | * @return $this |
||
| 994 | * @throws AssertionFailedException |
||
| 995 | */ |
||
| 996 | public function notRegex($pattern, $message = null, $propertyPath = null) |
||
| 1014 | |||
| 1015 | /** |
||
| 1016 | * Assert that string has a given length. |
||
| 1017 | * |
||
| 1018 | * @param int $length |
||
| 1019 | * @param string|null $message |
||
| 1020 | * @param string|null $propertyPath |
||
| 1021 | * @param string $encoding |
||
| 1022 | * @return Assert |
||
| 1023 | * @throws AssertionFailedException |
||
| 1024 | */ |
||
| 1025 | public function length($length, $message = null, $propertyPath = null, $encoding = 'utf8') |
||
| 1046 | |||
| 1047 | /** |
||
| 1048 | * Assert that a string is at least $minLength chars long. |
||
| 1049 | * |
||
| 1050 | * @param int $minLength |
||
| 1051 | * @param string|null $message |
||
| 1052 | * @param string|null $propertyPath |
||
| 1053 | * @param string $encoding |
||
| 1054 | * @return Assert |
||
| 1055 | * @throws AssertionFailedException |
||
| 1056 | */ |
||
| 1057 | public function minLength($minLength, $message = null, $propertyPath = null, $encoding = 'utf8') |
||
| 1079 | |||
| 1080 | /** |
||
| 1081 | * Assert that string value is not longer than $maxLength chars. |
||
| 1082 | * |
||
| 1083 | * @param integer $maxLength |
||
| 1084 | * @param string|null $message |
||
| 1085 | * @param string|null $propertyPath |
||
| 1086 | * @param string $encoding |
||
| 1087 | * @return Assert |
||
| 1088 | * @throws AssertionFailedException |
||
| 1089 | */ |
||
| 1090 | public function maxLength($maxLength, $message = null, $propertyPath = null, $encoding = 'utf8') |
||
| 1111 | |||
| 1112 | /** |
||
| 1113 | * Assert that string length is between min,max lengths. |
||
| 1114 | * |
||
| 1115 | * @param integer $minLength |
||
| 1116 | * @param integer $maxLength |
||
| 1117 | * @param string|null $message |
||
| 1118 | * @param string|null $propertyPath |
||
| 1119 | * @param string $encoding |
||
| 1120 | * @return Assert |
||
| 1121 | * @throws AssertionFailedException |
||
| 1122 | */ |
||
| 1123 | public function betweenLength($minLength, $maxLength, $message = null, $propertyPath = null, $encoding = 'utf8') |
||
| 1157 | |||
| 1158 | /** |
||
| 1159 | * Assert that string starts with a sequence of chars. |
||
| 1160 | * |
||
| 1161 | * @param string $needle |
||
| 1162 | * @param string|null $message |
||
| 1163 | * @param string|null $propertyPath |
||
| 1164 | * @param string $encoding |
||
| 1165 | * @return Assert |
||
| 1166 | * @throws AssertionFailedException |
||
| 1167 | */ |
||
| 1168 | View Code Duplication | public function startsWith($needle, $message = null, $propertyPath = null, $encoding = 'utf8') |
|
| 1188 | |||
| 1189 | /** |
||
| 1190 | * Assert that string ends with a sequence of chars. |
||
| 1191 | * |
||
| 1192 | * @param string $needle |
||
| 1193 | * @param string|null $message |
||
| 1194 | * @param string|null $propertyPath |
||
| 1195 | * @param string $encoding |
||
| 1196 | * @return Assert |
||
| 1197 | * @throws AssertionFailedException |
||
| 1198 | */ |
||
| 1199 | public function endsWith($needle, $message = null, $propertyPath = null, $encoding = 'utf8') |
||
| 1220 | |||
| 1221 | /** |
||
| 1222 | * Assert that string contains a sequence of chars. |
||
| 1223 | * |
||
| 1224 | * @param string $needle |
||
| 1225 | * @param string|null $message |
||
| 1226 | * @param string|null $propertyPath |
||
| 1227 | * @param string $encoding |
||
| 1228 | * @return Assert |
||
| 1229 | * @throws AssertionFailedException |
||
| 1230 | */ |
||
| 1231 | View Code Duplication | public function contains($needle, $message = null, $propertyPath = null, $encoding = 'utf8') |
|
| 1251 | |||
| 1252 | /** |
||
| 1253 | * Assert that value is in array of choices. |
||
| 1254 | * |
||
| 1255 | * @param array $choices |
||
| 1256 | * @param string|null $message |
||
| 1257 | * @param string|null $propertyPath |
||
| 1258 | * @return Assert |
||
| 1259 | * @throws AssertionFailedException |
||
| 1260 | */ |
||
| 1261 | public function choice(array $choices, $message = null, $propertyPath = null) |
||
| 1279 | |||
| 1280 | /** |
||
| 1281 | * Alias of {@see choice()} |
||
| 1282 | * |
||
| 1283 | * @throws AssertionFailedException |
||
| 1284 | * |
||
| 1285 | * @param array $choices |
||
| 1286 | * @param string|null $message |
||
| 1287 | * @param string|null $propertyPath |
||
| 1288 | * @return $this |
||
| 1289 | */ |
||
| 1290 | public function inArray(array $choices, $message = null, $propertyPath = null) |
||
| 1299 | |||
| 1300 | /** |
||
| 1301 | * Assert that value is numeric. |
||
| 1302 | * |
||
| 1303 | * @param string|null $message |
||
| 1304 | * @param string|null $propertyPath |
||
| 1305 | * @return Assert |
||
| 1306 | * @throws AssertionFailedException |
||
| 1307 | */ |
||
| 1308 | public function numeric($message = null, $propertyPath = null) |
||
| 1325 | |||
| 1326 | /** |
||
| 1327 | * @param string|null $message |
||
| 1328 | * @param string|null $propertyPath |
||
| 1329 | * @return Assert |
||
| 1330 | * @throws AssertionFailedException |
||
| 1331 | */ |
||
| 1332 | public function nonEmptyArray($message = null, $propertyPath = null) |
||
| 1337 | |||
| 1338 | /** |
||
| 1339 | * @param string|null $message |
||
| 1340 | * @param string|null $propertyPath |
||
| 1341 | * @return Assert |
||
| 1342 | * @throws AssertionFailedException |
||
| 1343 | */ |
||
| 1344 | public function nonEmptyInt($message = null, $propertyPath = null) |
||
| 1349 | |||
| 1350 | /** |
||
| 1351 | * @param string|null $message |
||
| 1352 | * @param string|null $propertyPath |
||
| 1353 | * @return Assert |
||
| 1354 | * @throws AssertionFailedException |
||
| 1355 | */ |
||
| 1356 | public function nonEmptyString($message = null, $propertyPath = null) |
||
| 1361 | |||
| 1362 | /** |
||
| 1363 | * Assert that value is an array. |
||
| 1364 | * |
||
| 1365 | * @param string|null $message |
||
| 1366 | * @param string|null $propertyPath |
||
| 1367 | * @return Assert |
||
| 1368 | * @throws AssertionFailedException |
||
| 1369 | */ |
||
| 1370 | public function isArray($message = null, $propertyPath = null) |
||
| 1387 | |||
| 1388 | /** |
||
| 1389 | * Assert that value is an array or a traversable object. |
||
| 1390 | * |
||
| 1391 | * @param string|null $message |
||
| 1392 | * @param string|null $propertyPath |
||
| 1393 | * @return Assert |
||
| 1394 | * @throws AssertionFailedException |
||
| 1395 | */ |
||
| 1396 | public function isTraversable($message = null, $propertyPath = null) |
||
| 1413 | |||
| 1414 | /** |
||
| 1415 | * Assert that value is an array or an array-accessible object. |
||
| 1416 | * |
||
| 1417 | * @param string|null $message |
||
| 1418 | * @param string|null $propertyPath |
||
| 1419 | * @return Assert |
||
| 1420 | * @throws AssertionFailedException |
||
| 1421 | */ |
||
| 1422 | public function isArrayAccessible($message = null, $propertyPath = null) |
||
| 1439 | |||
| 1440 | /** |
||
| 1441 | * Assert that key exists in an array |
||
| 1442 | * |
||
| 1443 | * @param string|integer $key |
||
| 1444 | * @param string|null $message |
||
| 1445 | * @param string|null $propertyPath |
||
| 1446 | * @return Assert |
||
| 1447 | * @throws AssertionFailedException |
||
| 1448 | */ |
||
| 1449 | public function keyExists($key, $message = null, $propertyPath = null) |
||
| 1467 | |||
| 1468 | /** |
||
| 1469 | * Assert that keys exist in array |
||
| 1470 | * |
||
| 1471 | * @param array $keys |
||
| 1472 | * @param string|null $message |
||
| 1473 | * @param string|null $propertyPath |
||
| 1474 | * @return Assert |
||
| 1475 | * @throws AssertionFailedException |
||
| 1476 | */ |
||
| 1477 | public function keysExist($keys, $message = null, $propertyPath = null) |
||
| 1498 | |||
| 1499 | /** |
||
| 1500 | * Assert that property exists in array |
||
| 1501 | * |
||
| 1502 | * @param string|integer $key |
||
| 1503 | * @param string|null $message |
||
| 1504 | * @param string|null $propertyPath |
||
| 1505 | * @return Assert |
||
| 1506 | * @throws AssertionFailedException |
||
| 1507 | */ |
||
| 1508 | public function propertyExists($key, $message = null, $propertyPath = null) |
||
| 1526 | |||
| 1527 | /** |
||
| 1528 | * Assert that properties exists in array |
||
| 1529 | * |
||
| 1530 | * @param array $keys |
||
| 1531 | * @param string|null $message |
||
| 1532 | * @param string|null $propertyPath |
||
| 1533 | * @return Assert |
||
| 1534 | * @throws AssertionFailedException |
||
| 1535 | */ |
||
| 1536 | public function propertiesExist(array $keys, $message = null, $propertyPath = null) |
||
| 1558 | |||
| 1559 | /** |
||
| 1560 | * Assert that string is valid utf8 |
||
| 1561 | * |
||
| 1562 | * @param string|null $message |
||
| 1563 | * @param string|null $propertyPath |
||
| 1564 | * @return Assert |
||
| 1565 | * @throws AssertionFailedException |
||
| 1566 | */ |
||
| 1567 | View Code Duplication | public function utf8($message = null, $propertyPath = null) |
|
| 1585 | |||
| 1586 | |||
| 1587 | /** |
||
| 1588 | * Assert that string is valid utf8 |
||
| 1589 | * |
||
| 1590 | * @param string|null $message |
||
| 1591 | * @param string|null $propertyPath |
||
| 1592 | * @return Assert |
||
| 1593 | * @throws AssertionFailedException |
||
| 1594 | */ |
||
| 1595 | View Code Duplication | public function ascii($message = null, $propertyPath = null) |
|
| 1613 | |||
| 1614 | /** |
||
| 1615 | * Assert that key exists in an array/array-accessible object using isset() |
||
| 1616 | * |
||
| 1617 | * @param string|integer $key |
||
| 1618 | * @param string|null $message |
||
| 1619 | * @param string|null $propertyPath |
||
| 1620 | * @return Assert |
||
| 1621 | * @throws AssertionFailedException |
||
| 1622 | */ |
||
| 1623 | public function keyIsset($key, $message = null, $propertyPath = null) |
||
| 1641 | |||
| 1642 | /** |
||
| 1643 | * Assert that key exists in an array/array-accessible object and it's value is not empty. |
||
| 1644 | * |
||
| 1645 | * @param string|integer $key |
||
| 1646 | * @param string|null $message |
||
| 1647 | * @param string|null $propertyPath |
||
| 1648 | * @return Assert |
||
| 1649 | * @throws AssertionFailedException |
||
| 1650 | */ |
||
| 1651 | public function notEmptyKey($key, $message = null, $propertyPath = null) |
||
| 1661 | |||
| 1662 | /** |
||
| 1663 | * Assert that value is not blank |
||
| 1664 | * |
||
| 1665 | * @param string|null $message |
||
| 1666 | * @param string|null $propertyPath |
||
| 1667 | * @return Assert |
||
| 1668 | * @throws AssertionFailedException |
||
| 1669 | */ |
||
| 1670 | View Code Duplication | public function notBlank($message = null, $propertyPath = null) |
|
| 1687 | |||
| 1688 | /** |
||
| 1689 | * Assert that value is instance of given class-name. |
||
| 1690 | * |
||
| 1691 | * @param string $className |
||
| 1692 | * @param string|null $message |
||
| 1693 | * @param string|null $propertyPath |
||
| 1694 | * @return Assert |
||
| 1695 | * @throws AssertionFailedException |
||
| 1696 | */ |
||
| 1697 | public function isInstanceOf($className, $message = null, $propertyPath = null) |
||
| 1715 | |||
| 1716 | /** |
||
| 1717 | * Assert that value is not instance of given class-name. |
||
| 1718 | * |
||
| 1719 | * @param string $className |
||
| 1720 | * @param string|null $message |
||
| 1721 | * @param string|null $propertyPath |
||
| 1722 | * @return Assert |
||
| 1723 | * @throws AssertionFailedException |
||
| 1724 | */ |
||
| 1725 | public function notIsInstanceOf($className, $message = null, $propertyPath = null) |
||
| 1743 | |||
| 1744 | /** |
||
| 1745 | * Assert that value is subclass of given class-name. |
||
| 1746 | * |
||
| 1747 | * @param string $className |
||
| 1748 | * @param string|null $message |
||
| 1749 | * @param string|null $propertyPath |
||
| 1750 | * @return Assert |
||
| 1751 | * @throws AssertionFailedException |
||
| 1752 | */ |
||
| 1753 | public function subclassOf($className, $message = null, $propertyPath = null) |
||
| 1771 | |||
| 1772 | /** |
||
| 1773 | * Assert that value is in range of numbers. |
||
| 1774 | * |
||
| 1775 | * @param integer $minValue |
||
| 1776 | * @param integer $maxValue |
||
| 1777 | * @param string|null $message |
||
| 1778 | * @param string|null $propertyPath |
||
| 1779 | * @return Assert |
||
| 1780 | * @throws AssertionFailedException |
||
| 1781 | */ |
||
| 1782 | public function range($minValue, $maxValue, $message = null, $propertyPath = null) |
||
| 1805 | |||
| 1806 | /** |
||
| 1807 | * Assert that a value is at least as big as a given limit |
||
| 1808 | * |
||
| 1809 | * @param mixed $minValue |
||
| 1810 | * @param string|null $message |
||
| 1811 | * @param string|null $propertyPath |
||
| 1812 | * @return Assert |
||
| 1813 | * @throws AssertionFailedException |
||
| 1814 | */ |
||
| 1815 | public function min($minValue, $message = null, $propertyPath = null) |
||
| 1834 | |||
| 1835 | /** |
||
| 1836 | * Assert that a number is smaller as a given limit |
||
| 1837 | * |
||
| 1838 | * @param mixed $maxValue |
||
| 1839 | * @param string|null $message |
||
| 1840 | * @param string|null $propertyPath |
||
| 1841 | * @return Assert |
||
| 1842 | * @throws AssertionFailedException |
||
| 1843 | */ |
||
| 1844 | public function max($maxValue, $message = null, $propertyPath = null) |
||
| 1863 | |||
| 1864 | /** |
||
| 1865 | * Assert that a file exists |
||
| 1866 | * |
||
| 1867 | * @param string|null $message |
||
| 1868 | * @param string|null $propertyPath |
||
| 1869 | * @return Assert |
||
| 1870 | * @throws AssertionFailedException |
||
| 1871 | */ |
||
| 1872 | public function file($message = null, $propertyPath = null) |
||
| 1891 | |||
| 1892 | /** |
||
| 1893 | * @param string|null $message |
||
| 1894 | * @param string|null $propertyPath |
||
| 1895 | * @return $this |
||
| 1896 | * @throws AssertionFailedException |
||
| 1897 | */ |
||
| 1898 | public function fileExists($message = null, $propertyPath = null) |
||
| 1917 | |||
| 1918 | /** |
||
| 1919 | * Assert that a directory exists |
||
| 1920 | * |
||
| 1921 | * @param string|null $message |
||
| 1922 | * @param string|null $propertyPath |
||
| 1923 | * @return Assert |
||
| 1924 | * @throws AssertionFailedException |
||
| 1925 | */ |
||
| 1926 | View Code Duplication | public function directory($message = null, $propertyPath = null) |
|
| 1944 | |||
| 1945 | /** |
||
| 1946 | * Assert that the value is something readable |
||
| 1947 | * |
||
| 1948 | * @param string|null $message |
||
| 1949 | * @param string|null $propertyPath |
||
| 1950 | * @return Assert |
||
| 1951 | * @throws AssertionFailedException |
||
| 1952 | */ |
||
| 1953 | View Code Duplication | public function readable($message = null, $propertyPath = null) |
|
| 1971 | |||
| 1972 | /** |
||
| 1973 | * Assert that the value is something writeable |
||
| 1974 | * |
||
| 1975 | * @param string|null $message |
||
| 1976 | * @param string|null $propertyPath |
||
| 1977 | * @return Assert |
||
| 1978 | * @throws AssertionFailedException |
||
| 1979 | */ |
||
| 1980 | View Code Duplication | public function writeable($message = null, $propertyPath = null) |
|
| 1998 | |||
| 1999 | /** |
||
| 2000 | * Assert that value is an email adress (using |
||
| 2001 | * input_filter/FILTER_VALIDATE_EMAIL). |
||
| 2002 | * |
||
| 2003 | * @param string|null $message |
||
| 2004 | * @param string|null $propertyPath |
||
| 2005 | * @return Assert |
||
| 2006 | * @throws AssertionFailedException |
||
| 2007 | */ |
||
| 2008 | public function email($message = null, $propertyPath = null) |
||
| 2040 | |||
| 2041 | /** |
||
| 2042 | * @param null $message |
||
| 2043 | * @param null $propertyPath |
||
| 2044 | * @return Assert |
||
| 2045 | * @throws AssertionFailedException |
||
| 2046 | */ |
||
| 2047 | public function emailPrefix($message = null, $propertyPath = null) |
||
| 2052 | |||
| 2053 | /** |
||
| 2054 | * Assert that value is an URL. |
||
| 2055 | * |
||
| 2056 | * This code snipped was taken from the Symfony project and modified to the special demands of this method. |
||
| 2057 | * |
||
| 2058 | * @param string|null $message |
||
| 2059 | * @param string|null $propertyPath |
||
| 2060 | * @return Assert |
||
| 2061 | * @throws AssertionFailedException |
||
| 2062 | * |
||
| 2063 | * |
||
| 2064 | * @link https://github.com/symfony/Validator/blob/master/Constraints/UrlValidator.php |
||
| 2065 | * @link https://github.com/symfony/Validator/blob/master/Constraints/Url.php |
||
| 2066 | */ |
||
| 2067 | public function url($message = null, $propertyPath = null) |
||
| 2101 | |||
| 2102 | /** |
||
| 2103 | * Assert that value is domain name. |
||
| 2104 | * |
||
| 2105 | * This code snipped was taken from the Symfony project and modified to the special demands of this method. |
||
| 2106 | * |
||
| 2107 | * @param string|null $message |
||
| 2108 | * @param string|null $propertyPath |
||
| 2109 | * @return Assert |
||
| 2110 | * @throws AssertionFailedException |
||
| 2111 | * |
||
| 2112 | */ |
||
| 2113 | public function domainName($message = null, $propertyPath = null) |
||
| 2132 | |||
| 2133 | /** |
||
| 2134 | * Assert that value is alphanumeric. |
||
| 2135 | * |
||
| 2136 | * @param string|null $message |
||
| 2137 | * @param string|null $propertyPath |
||
| 2138 | * @return Assert |
||
| 2139 | * @throws AssertionFailedException |
||
| 2140 | */ |
||
| 2141 | View Code Duplication | public function ausMobile($message = null, $propertyPath = null) |
|
| 2163 | |||
| 2164 | /** |
||
| 2165 | * Assert that value is alphanumeric. |
||
| 2166 | * |
||
| 2167 | * @param string|null $message |
||
| 2168 | * @param string|null $propertyPath |
||
| 2169 | * @return Assert |
||
| 2170 | * @throws AssertionFailedException |
||
| 2171 | */ |
||
| 2172 | View Code Duplication | public function alnum($message = null, $propertyPath = null) |
|
| 2194 | |||
| 2195 | /** |
||
| 2196 | * Assert that the value is boolean True. |
||
| 2197 | * |
||
| 2198 | * @param string|null $message |
||
| 2199 | * @param string|null $propertyPath |
||
| 2200 | * @return Assert |
||
| 2201 | * @throws AssertionFailedException |
||
| 2202 | */ |
||
| 2203 | public function true($message = null, $propertyPath = null) |
||
| 2221 | |||
| 2222 | /** |
||
| 2223 | * Assert that the value is boolean True. |
||
| 2224 | * |
||
| 2225 | * @param string|null $message |
||
| 2226 | * @param string|null $propertyPath |
||
| 2227 | * @return Assert |
||
| 2228 | * @throws AssertionFailedException |
||
| 2229 | */ |
||
| 2230 | public function truthy($message = null, $propertyPath = null) |
||
| 2247 | |||
| 2248 | /** |
||
| 2249 | * Assert that the value is boolean False. |
||
| 2250 | * |
||
| 2251 | * @param string|null $message |
||
| 2252 | * @param string|null $propertyPath |
||
| 2253 | * @return Assert |
||
| 2254 | * @throws AssertionFailedException |
||
| 2255 | */ |
||
| 2256 | public function false($message = null, $propertyPath = null) |
||
| 2273 | |||
| 2274 | /** |
||
| 2275 | * Assert that the value is not boolean False. |
||
| 2276 | * |
||
| 2277 | * @param string|null $message |
||
| 2278 | * @param string|null $propertyPath |
||
| 2279 | * @return Assert |
||
| 2280 | * @throws AssertionFailedException |
||
| 2281 | */ |
||
| 2282 | public function notFalse($message = null, $propertyPath = null) |
||
| 2299 | |||
| 2300 | /** |
||
| 2301 | * Assert that the class exists. |
||
| 2302 | * |
||
| 2303 | * @param string|null $message |
||
| 2304 | * @param string|null $propertyPath |
||
| 2305 | * @return Assert |
||
| 2306 | * @throws AssertionFailedException |
||
| 2307 | */ |
||
| 2308 | public function classExists($message = null, $propertyPath = null) |
||
| 2325 | |||
| 2326 | /** |
||
| 2327 | * Assert that the class implements the interface |
||
| 2328 | * |
||
| 2329 | * @param string $interfaceName |
||
| 2330 | * @param string|null $message |
||
| 2331 | * @param string|null $propertyPath |
||
| 2332 | * @return Assert |
||
| 2333 | * @throws AssertionFailedException |
||
| 2334 | */ |
||
| 2335 | public function implementsInterface($interfaceName, $message = null, $propertyPath = null) |
||
| 2354 | |||
| 2355 | /** |
||
| 2356 | * Assert that the given string is a valid json string. |
||
| 2357 | * |
||
| 2358 | * NOTICE: |
||
| 2359 | * Since this does a json_decode to determine its validity |
||
| 2360 | * you probably should consider, when using the variable |
||
| 2361 | * content afterwards, just to decode and check for yourself instead |
||
| 2362 | * of using this assertion. |
||
| 2363 | * |
||
| 2364 | * @param string|null $message |
||
| 2365 | * @param string|null $propertyPath |
||
| 2366 | * @return Assert |
||
| 2367 | * @throws AssertionFailedException |
||
| 2368 | */ |
||
| 2369 | public function isJsonString($message = null, $propertyPath = null) |
||
| 2386 | |||
| 2387 | /** |
||
| 2388 | * Assert that the given string is a valid UUID |
||
| 2389 | * |
||
| 2390 | * Uses code from {@link https://github.com/ramsey/uuid} that is MIT licensed. |
||
| 2391 | * |
||
| 2392 | * @param string|null $message |
||
| 2393 | * @param string|null $propertyPath |
||
| 2394 | * @return Assert |
||
| 2395 | * @throws AssertionFailedException |
||
| 2396 | */ |
||
| 2397 | public function uuid($message = null, $propertyPath = null) |
||
| 2419 | /** |
||
| 2420 | * Assert that the given string is a valid samAccountName (in line with Active directory sAMAccountName restrictions for users) |
||
| 2421 | * |
||
| 2422 | * From: https://social.technet.microsoft.com/wiki/contents/articles/11216.active-directory-requirements-for-creating-objects.aspx#Objects_with_sAMAccountName_Attribute |
||
| 2423 | * The schema allows 256 characters in sAMAccountName values. However, the system limits sAMAccountName to 20 characters for user objects and 16 characters for computer objects. |
||
| 2424 | * The following characters are not allowed in sAMAccountName values: " [ ] : ; | = + * ? < > / \ , |
||
| 2425 | * you cannot logon to a domain using a sAMAccountName that includes the "@" character. If a user has a sAMAccountName with this character, they must logon using their userPrincipalName (UPN). |
||
| 2426 | * |
||
| 2427 | * @param string|null $message |
||
| 2428 | * @param string|null $propertyPath |
||
| 2429 | * @return Assert |
||
| 2430 | * @throws AssertionFailedException |
||
| 2431 | */ |
||
| 2432 | View Code Duplication | public function samAccountName($message = null, $propertyPath = null) |
|
| 2449 | |||
| 2450 | /** |
||
| 2451 | * Assert that the given string is a valid userPrincipalName |
||
| 2452 | * |
||
| 2453 | * @param string|null $message |
||
| 2454 | * @param string|null $propertyPath |
||
| 2455 | * @return Assert |
||
| 2456 | * @throws AssertionFailedException |
||
| 2457 | */ |
||
| 2458 | View Code Duplication | public function userPrincipalName($message = null, $propertyPath = null) |
|
| 2477 | |||
| 2478 | /** |
||
| 2479 | * Assert that the count of countable is equal to count. |
||
| 2480 | * |
||
| 2481 | * @param int $count |
||
| 2482 | * @param string $message |
||
| 2483 | * @param string $propertyPath |
||
| 2484 | * @return Assert |
||
| 2485 | * @throws AssertionFailedException |
||
| 2486 | */ |
||
| 2487 | public function count($count, $message = null, $propertyPath = null) |
||
| 2505 | |||
| 2506 | /** |
||
| 2507 | * @param $func |
||
| 2508 | * @param $args |
||
| 2509 | * @return bool |
||
| 2510 | * @throws AssertionFailedException |
||
| 2511 | */ |
||
| 2512 | protected function doAllOrNullOr($func, $args) |
||
| 2533 | |||
| 2534 | /** |
||
| 2535 | * Determines if the values array has every choice as key and that this choice has content. |
||
| 2536 | * |
||
| 2537 | * @param array $choices |
||
| 2538 | * @param string|null $message |
||
| 2539 | * @param string|null $propertyPath |
||
| 2540 | * @return $this |
||
| 2541 | */ |
||
| 2542 | public function choicesNotEmpty(array $choices, $message = null, $propertyPath = null) |
||
| 2555 | |||
| 2556 | /** |
||
| 2557 | * Determines that the named method is defined in the provided object. |
||
| 2558 | * |
||
| 2559 | * @param mixed $object |
||
| 2560 | * @param string|null $message |
||
| 2561 | * @param string|null $propertyPath |
||
| 2562 | * @returns Assert |
||
| 2563 | * @throws |
||
| 2564 | */ |
||
| 2565 | public function methodExists($object, $message = null, $propertyPath = null) |
||
| 2583 | |||
| 2584 | /** |
||
| 2585 | * Determines that the provided value is an object. |
||
| 2586 | * |
||
| 2587 | * @param string|null $message |
||
| 2588 | * @param string|null $propertyPath |
||
| 2589 | * @return $this |
||
| 2590 | * @throws AssertionFailedException |
||
| 2591 | */ |
||
| 2592 | public function isObject($message = null, $propertyPath = null) |
||
| 2609 | |||
| 2610 | /** |
||
| 2611 | * Make a string version of a value. |
||
| 2612 | * |
||
| 2613 | * @param $value |
||
| 2614 | * @return string |
||
| 2615 | */ |
||
| 2616 | private function stringify($value) |
||
| 2649 | } |
||
| 2650 | |||
| 2651 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..