dotherightthing / wpdtrt-plugin-boilerplate

Boilerplate for WordPress plugin development. Formerly named wpdtrt-plugin.
2 stars 2 forks source link

WordPress Coding Standards clash with PSR-4 autoloading #124

Open dotherightthing opened 6 years ago

dotherightthing commented 6 years ago
// src/Plugin.php
namespace DoTheRightThing\WPDTRT_Plugin\r_1_4_15;

// src/Plugin.php
class Plugin { ... }

// wpdtrt-test.php
class WPDTRT_Test_Plugin extends DoTheRightThing\WPDTRT_Plugin\r_1_4_15\Plugin {}

WordPress Coding Standards

src/class-plugin.php

Filenames should be all lowercase with hyphens as word separators. Class file names should be based on the class name with class- prepended Source: Make WordPress: Naming Conventions

PSR-4

src/Plugin.php

The terminating class name corresponds to a file name ending in .php. The file name MUST match the case of the terminating class name. Source: PSR-4: Autoloader

The PSR-4 standard must be matched, otherwise the autoloader won't be able to load the files associated with the classes, resulting in Class not found.

dotherightthing commented 6 years ago

See: