You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,13 @@ $ cd generator
36
36
$ php ./safe.php generate
37
37
```
38
38
39
+
## Special cases
40
+
41
+
In some cases, automatic generation is too difficult to execute and the function has to be written manually.
42
+
This should however only be done exceptionally in order to keep the project easy to maintain.
43
+
The most important examples are all the functions of the classes `DateTime` and `DateTimeImmutable`, since the entire classes have to be overloaded manually.
44
+
All custom objects must be located in lib/ and custom functions must be in lib/special_cases.php.
45
+
39
46
### Submitting a PR
40
47
41
48
The continuous integration hooks will regenerate all the functions and check that the result is exactly what has been
All PHP functions that can return `false` on error are part of Safe.
63
+
In addition, Safe also provide 2 'Safe' classes: `Safe\DateTime` and `Safe\DateTimeImmutable` whose methods will throw exceptions instead of returning false.
64
+
62
65
## PHPStan integration
63
66
64
67
> Yeah... but I must explicitly think about importing the "safe" variant of the function, for each and every file of my application.
* @param string $modify A date/time string. Valid formats are explained in <a href="https://secure.php.net/manual/en/datetime.formats.php">Date and Time Formats</a>.
50
+
* @return DateTime Returns the DateTime object for method chaining.
0 commit comments