User Tools

Site Tools


en:dev:all:psr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:dev:all:psr [25.05.2015 16:03] – [Grundsätzliche Regeln zur Programmierung im WB-Umfeld] translated mrbasemanen:dev:all:psr [28.12.2018 23:37] (current) – [Official Standards] Manuela v.d.Decken
Line 1: Line 1:
-FIXME **This page is not fully translated, yet. Please help completing the translation **\\  
-//(remove this paragraph once the translation is finished)// 
- 
 ====== Coding Standards ====== ====== Coding Standards ======
 ===== Official Standards ===== ===== Official Standards =====
-We did not reinvent the most basic standards for Website Baker and arbitrarily define some rules, but we use basically the same set of rules as many other notable projects and large frameworks  (see [[http://www.php-fig.org/#voting-members|PHP-FIG Referenzliste]]). \\+{{:check.png?nolink&128 |Standards}}We did not reinvent the most basic standards for Website Baker and arbitrarily define some rules, but we use basically the same set of rules as many other notable projects and large frameworks  (see [[http://www.php-fig.org/#voting-members|PHP-FIG Referenzliste]]). \\
 The basic standards for Website Baker are the standards [[http://www.php-fig.org/psr/psr-0|PSR-0]] / [[http://www.php-fig.org/psr/psr-1|PSR-1]] / [[http://www.php-fig.org/psr/psr-2|PSR-2]] and [[http://www.php-fig.org/psr/psr-4|PSR-4]] of the **PHP Framework Interop Group**.\\ The basic standards for Website Baker are the standards [[http://www.php-fig.org/psr/psr-0|PSR-0]] / [[http://www.php-fig.org/psr/psr-1|PSR-1]] / [[http://www.php-fig.org/psr/psr-2|PSR-2]] and [[http://www.php-fig.org/psr/psr-4|PSR-4]] of the **PHP Framework Interop Group**.\\
 Some might feel uncomfortable with the quite strict wording using the expressions MUST! or MUST NOT! etc. However, these terms are taken exactly as they are from the original PSRs which in turn striclty stick to [[http://tools.ietf.org/html/rfc2119|RFC 2119]] and should therefore be understood exactly in this sense.\\ Some might feel uncomfortable with the quite strict wording using the expressions MUST! or MUST NOT! etc. However, these terms are taken exactly as they are from the original PSRs which in turn striclty stick to [[http://tools.ietf.org/html/rfc2119|RFC 2119]] and should therefore be understood exactly in this sense.\\
Line 15: Line 12:
 |MAY / OPTIONAL |This states an item which is truly optional.| |MAY / OPTIONAL |This states an item which is truly optional.|
  
-  * **[[dev:all:psr:psr-0en|Autoloading Standard (PSR-0)]]** - This standard aims to provide a standardized file format, as well as class name and namespace conventions that enable plug and play code. +  * **[[en:dev:all:psr:psr-0|Autoloading Standard (PSR-0)]]** - This standard aims to provide a standardized file format, as well as class name and namespace conventions that enable plug and play code. <span warning>As of 2014-10-21 PSR-0 has been marked as deprecated. PSR-4 is now recommended as an alternative.</span> 
-  * **[[dev:all:psr-1en|Basic Coding Standard (PSR-1)]]** - This standard helps to achieve the highest possible degree of compatibility of PHP code contributed from different sources. +  * **[[en:dev:all:psr:psr-1|Basic Coding Standard (PSR-1)]]** - This standard helps to achieve the highest possible degree of compatibility of PHP code contributed from different sources. 
-  * **[[dev:all:psr-2en|Coding Style Guide (PSR-2)]]**  This provides instructions that ensure that PHP code always has a standardized visual appearance. +  * **[[en:dev:all:psr:psr-2|Coding Style Guide (PSR-2)]]**  This provides instructions that ensure that PHP code always has a standardized visual appearance. 
-  * **[[dev:all:psr-4en|Improved Autoloading (PSR-4)]]** -A more modern interpretation autoloading, which reflects the continued progress in the ecosystem.  +  * **[[http://www.php-fig.org/psr/psr-4|Improved Autoloading (PSR-4)]]** -A more modern interpretation autoloading, which reflects the continued progress in the ecosystem.  
-  * **[[dev:all:wb-adaption-en|WebsiteBaker-Adaption]]** - General adaptation of PSR standards to specific conditions of Website Baker.+  * **[[en:dev:all:wb-adaption|WebsiteBaker-Adaption]]** - General adaptation of PSR standards to specific conditions of Website Baker.
  
 ===== Basic rules for programming in the WB-environment ===== ===== Basic rules for programming in the WB-environment =====
 With every subsequent release of WebsiteBaker, the programming style evolves continually away from the previous 'anarchic' style, widely used for almost 10 years, towards to a more modular, but also forcibly bound to strict programming interfaces manner. This requires a consistent rethinking especially for addon programmers.\\ With every subsequent release of WebsiteBaker, the programming style evolves continually away from the previous 'anarchic' style, widely used for almost 10 years, towards to a more modular, but also forcibly bound to strict programming interfaces manner. This requires a consistent rethinking especially for addon programmers.\\
-At present, i.e. before 2.8.4, compliance with many regulations is still voluntary, in the 2.8.much is already deprecated, and later on many of the specifications of 2.8.will be mandatory. All this sounds very restrictive to many, but this is gladly accepted, since precisely these limitations will eventually ensure a stable modularity, flexibility and interchangeability for stable, reusability and mainly maintainability of code.+At present, i.e. before 2.10.0, compliance with many regulations is still voluntary, in the 2.12.much is already deprecated, and later on many of the specifications of 2.12.will be mandatory. All this sounds very restrictive to many, but this is gladly accepted, since precisely these limitations will eventually ensure a stable modularity, flexibility and interchangeability for stable, reusability and mainly maintainability of code
 + 
 +==== General rules for Addons ==== 
 +.. which should should, regardless of WB, apply as well to any at least semi-professional project and be a basis of every serious programmer training.
  
-==== Allgemeine Regeln für Addons ==== +Addons ... 
-.. die eigentlich sounabhängig von WB, in jedem halbwegs professionellen Projekt gelten sollten und Grundlage jeder ernsthaften Programmierer-Ausbildung sind.+  ... May trigger neither the core nor other addonsbut are generally triggered by the controlling core 
 +  - ... Must not interfere with the flow of the entire system 
 +  - ... Are normally not allowed to establish any direct connection to the outside world 
 +  - ... May never modify or write data to areas of other addons or the Core 
 +  - ... Never change the code of other addons or the core (also applies to installation and upgrade) 
 +  - ... May only send data to the browser throught the responder of core  
 +  - ... May not define global variables or global constants. 
 +  - ... May never use indirect addressing or allow that!
  
-Addons...   +for later versions (2.12), further restrictions will comeSee the respective sections of this documentation.
-  - ... dürfen weder den Core noch andere Addons triggern, sondern werden grundsätzlich vom steuernden Core getriggert +
-  - ... dürfen den Ablauf des Gesamtsystems nicht stören +
-  - ... ist im Normalfall keine direkte Verbindung zur Außenwelt gestattet +
-  - ... dürfen niemals schreibend auf Datenbereiche anderer Addons oder des Core zugreifen +
-  - ... dürfen niemals den Code anderer Addons oder des Core ändern (gilt auch für Installation und Upgrade) +
-  - ... dürfen ausschließlich über den Responder des Core Daten zum Browser etc. senden +
-  - ... dürfen keine globalen Variablen oder globalen Konstanten definieren. +
-für spätere Versionen (ab 2.9werden noch weitere Einschränkungen kommenSiehe die jeweiligen Abschnitte dieser Dokumentation.+
  
en/dev/all/psr.1432569816.txt.gz · Last modified: 03.06.2015 15:55 (external edit)