From 9f44251423a60a78564f98fc21173e9164270fe5 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Tue, 12 Dec 2023 12:03:03 -0300 Subject: [PATCH 1/3] Add documentation for the SpaceBeforeCast sniff --- .../Formatting/SpaceBeforeCastStandard.xml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml diff --git a/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml b/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml new file mode 100644 index 0000000000..1ae01bdd28 --- /dev/null +++ b/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml @@ -0,0 +1,31 @@ + + + + + + + (int) $string; + ]]> + + + (int) $string; + ]]> + + + + + (int) $b; + ]]> + + + (int) $b; + ]]> + + + From c9c9b09e939d2ae435eb8c5dc00daffab0677899 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 13 Dec 2023 08:50:16 -0300 Subject: [PATCH 2/3] Minor improvements to the SpaceBeforeCast sniff documentation Suggestions made during the PR review process Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com> --- .../Generic/Docs/Formatting/SpaceBeforeCastStandard.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml b/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml index 1ae01bdd28..b6be1ae301 100644 --- a/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml +++ b/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml @@ -1,7 +1,7 @@ - + From 1f90b17561cd0581ab283bb1db0cb7da9f3054ad Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 13 Dec 2023 09:38:53 -0300 Subject: [PATCH 3/3] Combine code examples into a single `` block Doing this based on the PR review (https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/159#discussion_r1424492090) as the valid code examples are essentially the same. This commit also changes the changes the type cast used in the second example to make it more clear that this sniff is not only about `(int)` type casts. --- .../Docs/Formatting/SpaceBeforeCastStandard.xml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml b/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml index b6be1ae301..09fbc189f3 100644 --- a/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml +++ b/src/Standards/Generic/Docs/Formatting/SpaceBeforeCastStandard.xml @@ -8,23 +8,13 @@ (int) $string; +$c = $a . (string) $b; ]]> - + (int) $string; - ]]> - - - - - (int) $b; - ]]> - - - (int) $b; +$c = $a . (string) $b; ]]>