From e6d73d8ff8f2273387fe12150c111c0a08c80880 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Sat, 21 Nov 2015 20:24:49 +0400 Subject: [PATCH] Removed custom autoloader. --- CHANGELOG.md | 6 +++- README.md | 1 - docs/general.rst | 1 - samples/Sample_Header.php | 2 -- src/PhpWord/Autoloader.php | 55 ------------------------------ tests/PhpWord/AutoloaderTest.php | 58 -------------------------------- tests/bootstrap.php | 2 -- 7 files changed, 5 insertions(+), 120 deletions(-) delete mode 100644 src/PhpWord/Autoloader.php delete mode 100644 tests/PhpWord/AutoloaderTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 51d0bb56..b792b19b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,11 @@ Use the correspondent `getAlignment` and `setAlignment` methods instead. - @Roma ### Removed - `PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings. In each case set of available string values is defined by the correspondent simple type. - @RomanSyroeshko -- Manual installation option. To install PHPWord use Composer since now. - @RomanSyroeshko +- Manual installation support. Since the release we have dependencies on third party libraries, +so installation via ZIP-archive download is not an option anymore. To install PHPWord use [Composer](https://getcomposer.org/). + We also removed `PhpOffice\PhpWord\Autoloader`, because the latter change made it completely useless. + Autoloaders provided by Composer are in use now (see `bootstrap.php`). - @RomanSyroeshko + 0.12.1 (30 August 2015) diff --git a/README.md b/README.md index f86ff0ed..b3bfa53a 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,6 @@ The following is a basic usage example of the PHPWord library. ```php `__. '); define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php')); define('IS_INDEX', SCRIPT_FILENAME == 'index'); -Autoloader::register(); Settings::loadConfig(); // Set writers diff --git a/src/PhpWord/Autoloader.php b/src/PhpWord/Autoloader.php deleted file mode 100644 index 1865292b..00000000 --- a/src/PhpWord/Autoloader.php +++ /dev/null @@ -1,55 +0,0 @@ -assertContains( - array('PhpOffice\\PhpWord\\Autoloader', 'autoload'), - spl_autoload_functions() - ); - } - - /** - * Autoload - */ - public function testAutoload() - { - $declaredCount = count(get_declared_classes()); - Autoloader::autoload('Foo'); - $this->assertCount( - $declaredCount, - get_declared_classes(), - 'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load classes outside of the PhpOffice\\PhpWord namespace' - ); - // TODO change this class to the main PhpWord class when it is namespaced - Autoloader::autoload('PhpOffice\\PhpWord\\Exception\\InvalidStyleException'); - $this->assertTrue( - in_array('PhpOffice\\PhpWord\\Exception\\InvalidStyleException', get_declared_classes()), - 'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the PhpOffice\\PhpWord\\Exception\\InvalidStyleException class' - ); - } -} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b7b5351b..7535d378 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -37,5 +37,3 @@ spl_autoload_register(function ($class) { } } }); - -\PhpOffice\PhpWord\Autoloader::register();