From 629d773201f3bb8fd07130645981b24ee7052b54 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 7 Jan 2018 13:56:16 +0100 Subject: [PATCH 1/3] Mention that PSR-1 doesn't recommend CamelCase or anything else --- components/serializer.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 5163a0e252a..fd44f9aef3e 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -421,8 +421,9 @@ CamelCase to snake_case interface was introduced in Symfony 2.7. In many formats, it's common to use underscores to separate words (also known -as snake_case). However, PSR-1 specifies that the preferred style for PHP -properties and methods is CamelCase. +as snake_case). However, in Symfony applications is common to use CamelCase to +name properties and methods (even though the `PSR-1 standard`_ doesn't recommend +any specific style). Symfony provides a built-in name converter designed to transform between snake_case and CamelCased styles during serialization and deserialization @@ -646,5 +647,6 @@ Learn more A popular alternative to the Symfony Serializer Component is the third-party library, `JMS serializer`_ (released under the Apache license, so incompatible with GPLv2 projects). +.. _`PSR-1 standard`: http://www.php-fig.org/psr/psr-1/ .. _`JMS serializer`: https://github.com/schmittjoh/serializer .. _Packagist: https://packagist.org/packages/symfony/serializer From a5d27946f490678950f3645780ff4452a94ca3f2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 7 Jan 2018 17:13:39 +0100 Subject: [PATCH 2/3] PSR-1 methods must use CamelCase --- components/serializer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index fd44f9aef3e..68c0f3002b7 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -422,8 +422,8 @@ CamelCase to snake_case In many formats, it's common to use underscores to separate words (also known as snake_case). However, in Symfony applications is common to use CamelCase to -name properties and methods (even though the `PSR-1 standard`_ doesn't recommend -any specific style). +name properties (even though the `PSR-1 standard`_ doesn't recommend any +specific case). Symfony provides a built-in name converter designed to transform between snake_case and CamelCased styles during serialization and deserialization From 1747b5821a46edeb310c3c3860bb9b2da6d1499a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 7 Jan 2018 17:14:58 +0100 Subject: [PATCH 3/3] Final reword: --- components/serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index 68c0f3002b7..84e5cb83e2b 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -423,7 +423,7 @@ CamelCase to snake_case In many formats, it's common to use underscores to separate words (also known as snake_case). However, in Symfony applications is common to use CamelCase to name properties (even though the `PSR-1 standard`_ doesn't recommend any -specific case). +specific case for property names). Symfony provides a built-in name converter designed to transform between snake_case and CamelCased styles during serialization and deserialization