Skip to content

Commit 55b18c6

Browse files
authored
Add explanatory comment
Showing to my Udemy student they can also declare a class constant with a data type if they use PHP 8.3 or newer. By default, this PHP RESTful API project supports PHP 8.2 as the earliest version (so, not compatible with typed class constants) .
1 parent 2db72d0 commit 55b18c6

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Validation/UserValidation.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
<?php
2+
/**
3+
* @author Pierre-Henry Soria
4+
* @website https://www.udemy.com/course/build-modern-php-api/
5+
* @website https://ph7.me
6+
* @license MIT License
7+
*/
28

39
namespace PH7\ApiSimpleMenu\Validation;
410

511
use Respect\Validation\Validator as v;
612

713
class UserValidation
814
{
9-
// storing the min/max lengths for first/last names
15+
/**
16+
* Storing min/max lengths for first/last names.
17+
*
18+
* @internal Since PHP 8.3, typed constant declarations are supported.
19+
* If using PHP 8.3+, can be changed to:
20+
* private const int MINIMUM_NAME_LENGTH = 2;
21+
* private const int MAXIMUM_NAME_LENGTH = 40;
22+
*/
1023
private const MINIMUM_NAME_LENGTH = 2;
1124
private const MAXIMUM_NAME_LENGTH = 40;
1225

@@ -50,4 +63,4 @@ public function isLoginSchemaValid(): bool
5063

5164
return $schemaValidation->validate($this->data);
5265
}
53-
}
66+
}

0 commit comments

Comments
 (0)