mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-25 06:21:34 +02:00
Fix line wrapping consistency - round 1
Comply with the 'wrap at 120 chars' style rule stated in the contributing.md document
This commit is contained in:
@@ -5,25 +5,24 @@ anchor: namespaces
|
||||
|
||||
## Namespaces {#namespaces_title}
|
||||
|
||||
As mentioned above, the PHP community has a lot of developers creating lots of code. This means that
|
||||
one library's PHP code may use the same class name as another library. When both libraries are used
|
||||
in the same namespace, they collide and cause trouble.
|
||||
As mentioned above, the PHP community has a lot of developers creating lots of code. This means that one library's PHP
|
||||
code may use the same class name as another library. When both libraries are used in the same namespace, they collide
|
||||
and cause trouble.
|
||||
|
||||
_Namespaces_ solve this problem. As described in the PHP reference manual, namespaces may be compared
|
||||
to operating system directories that _namespace_ files; two files with the same name may co-exist in
|
||||
separate directories. Likewise, two PHP classes with the same name may co-exist in separate PHP
|
||||
namespaces. It's as simple as that.
|
||||
_Namespaces_ solve this problem. As described in the PHP reference manual, namespaces may be compared to operating
|
||||
system directories that _namespace_ files; two files with the same name may co-exist in separate directories. Likewise,
|
||||
two PHP classes with the same name may co-exist in separate PHP namespaces. It's as simple as that.
|
||||
|
||||
It is important for you to namespace your code so that it may be used by other developers without fear
|
||||
of colliding with other libraries.
|
||||
It is important for you to namespace your code so that it may be used by other developers without fear of colliding
|
||||
with other libraries.
|
||||
|
||||
One recommended way to use namespaces is outlined in [PSR-0][psr0], which aims to provide a standard file,
|
||||
class and namespace convention to allow plug-and-play code.
|
||||
One recommended way to use namespaces is outlined in [PSR-0][psr0], which aims to provide a standard file, class and
|
||||
namespace convention to allow plug-and-play code.
|
||||
|
||||
In December 2013 the PHP-FIG created a new autoloading standard: [PSR-4][psr4], which one day will
|
||||
probably replace PSR-0. Currently both are still usable, as PSR-4 requires PHP 5.3 and many PHP 5.2-only
|
||||
projects currently implement PSR-0. If you're going to use an autoloader standard for a new application or
|
||||
package then you almost certainly want to look into PSR-4.
|
||||
In December 2013 the PHP-FIG created a new autoloading standard: [PSR-4][psr4], which one day will probably replace
|
||||
PSR-0. Currently both are still usable, as PSR-4 requires PHP 5.3 and many PHP 5.2-only projects currently implement
|
||||
PSR-0. If you're going to use an autoloader standard for a new application or package then you almost certainly want
|
||||
to look into PSR-4.
|
||||
|
||||
* [Read about Namespaces][namespaces]
|
||||
* [Read about PSR-0][psr0]
|
||||
|
Reference in New Issue
Block a user