1
0
mirror of https://github.com/danog/class-finder.git synced 2024-12-02 09:27:48 +01:00

Add "Experimental" to the flag.

Hopefully people that don't need it won't use it.
This commit is contained in:
Hayden Pierce 2018-11-24 10:14:55 -06:00
parent 999f912403
commit baff32f2f5
5 changed files with 9 additions and 7 deletions

View File

@ -9,7 +9,7 @@ require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use HaydenPierce\ClassFinder\ClassFinder;
ClassFinder::enableFilesSupport(); ClassFinder::enableExperimentalFilesSupport();
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar'); $classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');
``` ```

View File

@ -9,7 +9,7 @@ require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use HaydenPierce\ClassFinder\ClassFinder;
ClassFinder::enableFilesSupport(); ClassFinder::enableExperimentalFilesSupport();
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar'); $classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');
``` ```
@ -31,7 +31,7 @@ that enabled it, you should remove it and see if you're part of the 99% that doe
want to explicitly disable it: want to explicitly disable it:
``` ```
ClassFinder::disableFilesSupport(); ClassFinder::disableExperimentalFilesSupport();
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar'); $classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');
``` ```

View File

@ -81,12 +81,12 @@ class ClassFinder
self::$config->setAppRoot($appRoot); self::$config->setAppRoot($appRoot);
} }
public static function enableFilesSupport() public static function enableExperimentalFilesSupport()
{ {
self::$useFilesSupport = true; self::$useFilesSupport = true;
} }
public static function disableFilesSupport() public static function disableExperimentalFilesSupport()
{ {
self::$useFilesSupport = false; self::$useFilesSupport = false;
} }

View File

@ -1,3 +1,5 @@
<?php <?php
namespace TestApp1\FilesClasses; namespace TestApp1\FilesClasses;
class OtherRedHerring {}

View File

@ -19,7 +19,7 @@ class FilesTest extends \PHPUnit_Framework_TestCase
public function testClassFinder($namespace, $expected, $message) public function testClassFinder($namespace, $expected, $message)
{ {
try { try {
ClassFinder::enableFilesSupport(); ClassFinder::enableExperimentalFilesSupport();
$classes = ClassFinder::getClassesInNamespace($namespace); $classes = ClassFinder::getClassesInNamespace($namespace);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->assertFalse(true, 'An exception occurred: ' . $e->getMessage()); $this->assertFalse(true, 'An exception occurred: ' . $e->getMessage());
@ -61,7 +61,7 @@ class FilesTest extends \PHPUnit_Framework_TestCase
*/ */
public function testFilesSupportRequiresEnabling() public function testFilesSupportRequiresEnabling()
{ {
ClassFinder::disableFilesSupport(); // Disabling FilesSupport should cause no files to be found. ClassFinder::disableExperimentalFilesSupport(); // Disabling FilesSupport should cause no files to be found.
$classes = ClassFinder::getClassesInNamespace('TestApp1\FilesClasses'); $classes = ClassFinder::getClassesInNamespace('TestApp1\FilesClasses');
} }