Skip to content

Commit

Permalink
Add explanatory comment
Browse files Browse the repository at this point in the history
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) .
  • Loading branch information
pH-7 authored Nov 10, 2024
1 parent 2db72d0 commit 55b18c6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Validation/UserValidation.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
<?php
/**
* @author Pierre-Henry Soria
* @website https://www.udemy.com/course/build-modern-php-api/
* @website https://ph7.me
* @license MIT License
*/

namespace PH7\ApiSimpleMenu\Validation;

use Respect\Validation\Validator as v;

class UserValidation
{
// storing the min/max lengths for first/last names
/**
* Storing min/max lengths for first/last names.
*
* @internal Since PHP 8.3, typed constant declarations are supported.
* If using PHP 8.3+, can be changed to:
* private const int MINIMUM_NAME_LENGTH = 2;
* private const int MAXIMUM_NAME_LENGTH = 40;
*/
private const MINIMUM_NAME_LENGTH = 2;
private const MAXIMUM_NAME_LENGTH = 40;

Expand Down Expand Up @@ -50,4 +63,4 @@ public function isLoginSchemaValid(): bool

return $schemaValidation->validate($this->data);
}
}
}

0 comments on commit 55b18c6

Please sign in to comment.