We all know that namespacing your application code is PSR best practice and recommendation. The only things PSR can do are gaps and side effects when it comes to functions and their declaration.
But what about functions that are not associated with any class? Should they be in the namespace or remain in the global namespace?
Some developers say that namespace functions are bad practice, but I couldn't understand why.
From what I learned / read and saw recommended regarding namespacing functions:
? , , , , (, , ..)?
- , . . , . , , , , , .
, , . OO, Java #, . , . ( ).
, , , , SO. .
[...] , , (, , ..)?
. - . , .
- . , , , , ike_rsqrt. , , , .
ike_rsqrt
- , , , . , , , , , . , . . , , , - - . , , - , : .
- . , . , , , .
, ?
PHP-. . , - , . , \Util\Str::camelize() UI\Util\TextCleaner::prettifyHtml().
\Util\Str::camelize()
UI\Util\TextCleaner::prettifyHtml()
?
Namespacing . : , . SRP.
, , . , , , .
: , ( ).
, . include() . ;)
include()
: , / ( ).
, , . . / , .
: , PHP ( , ).
, . SOLID . . SOLID, ... , .
: , OO ( , . ).
, , .
. , - " , " . , . - , - .
, , (, , ..)?
, . - , . namespacing , , , .
Source: https://habr.com/ru/post/1616020/More articles:Android RecyclerView: abstract method not implemented - androidTag people as instagram - iosHow to set up linear programming optimization in R using LpSolve? - optimizationДержите show_compatibility_56 всегда включенным в MySQL - sqlPython How to generate random integers with multiple ranges? - pythonQtWebEngine: "Не разрешено загружать локальный ресурс" для iframe, как отключить веб-безопасность? - javascriptundefined link to `libintl_gettext 'using MinGW / MSYS and CMake - c ++Moment.js works with valid date in Chrome, but not IE or Firefox - jqueryHow to write a program for drawing a tiled image? - mathDifferent results with the same query in oracle 11g and 10g - oracleAll Articles