]> git.mxchange.org Git - friendica.git/blobdiff - doc/Developer-How-To-Move-Classes-to-src.md
Merge pull request #7744 from MrPetovan/task/7190-remove-defaults-src
[friendica.git] / doc / Developer-How-To-Move-Classes-to-src.md
index d502e863c32e4307200fd1e2fca03bb5ddc54e32..3087918b721a265964c104b58f5438a882141c3e 100644 (file)
@@ -4,7 +4,7 @@ How To Move Classes to `src`
 * [Home](help)
   * [Developer Intro](help/Developers-Intro)
 
-Since April 2017, Friendica uses [Composer](help/Composer) to manage autoloading.
+Friendica uses [Composer](help/Composer) to manage autoloading.
 This means that all the PHP class files moved to the `src` folder will be [automatically included](help/autoloader) when the class it defines is first used in the flow.
 This is an improvement over the current `require` usage since files will be included on an actual usage basis instead of the presence of a `require` call.
 
@@ -73,16 +73,16 @@ If there are only a handful of references to a single non-namespaced class, just
 ````php
 namespace Friendica\Core;
 ...
-if (\dbm::is_result($r)) {
+if (\DBM::is_result($r)) {
     ...
 }
 ````
 ````php
 namespace Friendica\Core;
 
-use \dbm;
+use Friendica\Database\DBM;
 
-if (dbm::is_result($r)) {
+if (DBM::is_result($r)) {
     ...
 }
 ````
@@ -94,11 +94,14 @@ Please remove all the `require_once` mentions of the former file, as they will p
 
 ## Miscellaneous tips
 
-When you are done with moving the class, please run `php util/typo.php` from the Friendica base directory to check for obvious mistakes.
+When you are done with moving the class, please run `php bin/console.php typo` from the Friendica base directory to check for obvious mistakes.
 Howevever, this tool isn't bullet-proof, and a staging install of Friendica is recommended to test your class move without impairing your production server if you host one.
 
 Most of Friendica processes are run in the background, so make sure to turn on your debug log to check for errors that wouldn't show up while simply browsing Friendica.
 
+Check the class file for any magic constant `__FILE__` or `__DIR__`, as their value changed since you moved the class in the file tree.
+Most of the time it's used for debugging purposes but there can be instances where it's used to create cache folders for example.
+
 ## Related
 
 * [Class autoloading](help/autoloader)