Skip to content

Commit

Permalink
docs: [DateTimeCreateFromFormatCallFixer] Fix typos in the code sample (
Browse files Browse the repository at this point in the history
  • Loading branch information
elementaire committed Oct 30, 2022
1 parent a314d8e commit ff49030
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ List of Available Rules

Consider this code:
``DateTime::createFromFormat('Y-m-d', '2022-02-11')``.
What value will be returned? '2022-01-11 00:00:00.0'? No, actual return
What value will be returned? '2022-02-11 00:00:00.0'? No, actual return
value has 'H:i:s' section like '2022-02-11 16:55:37.0'.
Change 'Y-m-d' to '!Y-m-d', return value will be '2022-01-11 00:00:00.0'.
Change 'Y-m-d' to '!Y-m-d', return value will be '2022-02-11 00:00:00.0'.
So, adding ``!`` to format string will make return value more intuitive.

*warning risky* Risky when depending on the actual timings being used even when not explicit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Description

Consider this code:
``DateTime::createFromFormat('Y-m-d', '2022-02-11')``.
What value will be returned? '2022-01-11 00:00:00.0'? No, actual return
What value will be returned? '2022-02-11 00:00:00.0'? No, actual return
value has 'H:i:s' section like '2022-02-11 16:55:37.0'.
Change 'Y-m-d' to '!Y-m-d', return value will be '2022-01-11 00:00:00.0'.
Change 'Y-m-d' to '!Y-m-d', return value will be '2022-02-11 00:00:00.0'.
So, adding ``!`` to format string will make return value more intuitive.

Warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public function getDefinition(): FixerDefinitionInterface
],
"Consider this code:
`DateTime::createFromFormat('Y-m-d', '2022-02-11')`.
What value will be returned? '2022-01-11 00:00:00.0'? No, actual return value has 'H:i:s' section like '2022-02-11 16:55:37.0'.
Change 'Y-m-d' to '!Y-m-d', return value will be '2022-01-11 00:00:00.0'.
What value will be returned? '2022-02-11 00:00:00.0'? No, actual return value has 'H:i:s' section like '2022-02-11 16:55:37.0'.
Change 'Y-m-d' to '!Y-m-d', return value will be '2022-02-11 00:00:00.0'.
So, adding `!` to format string will make return value more intuitive.",
'Risky when depending on the actual timings being used even when not explicit set in format.'
);
Expand Down

0 comments on commit ff49030

Please sign in to comment.