diff --git a/README.md b/README.md index 982210b3..c68f5233 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,8 @@ potentially very difficult to debug due to dissimilar or unsupported package ver - [Composer Plugins](docs/limitations.md#composer-plugins) - [PSR-0 Partial support](docs/limitations.md#psr-0-partial-support) - [Files autoloading](docs/limitations.md#files-autoloading) + - [Exposing/Excluding traits](docs/limitations.md#exposingexcluding-traits) + - [Exposing/Excluding enums](docs/limitations.md#exposingexcluding-enums) - [Contributing](#contributing) - [Credits](#credits) diff --git a/docs/limitations.md b/docs/limitations.md index d5fd2034..efc43417 100644 --- a/docs/limitations.md +++ b/docs/limitations.md @@ -10,6 +10,8 @@ - [Composer Plugins](#composer-plugins) - [PSR-0 Partial support](#psr-0-partial-support) - [Files autoloading](#files-autoloading) +- [Exposing/Excluding traits](#exposingexcluding-traits) +- [Exposing/Excluding enums](#exposingexcluding-enums) ### Dynamic symbols @@ -240,6 +242,19 @@ the scoped file and non-scoped file will have the same hash resulting in errors. This is a limitation that should be fixable, check [#298] for the progress. +### Exposing/Excluding traits + +There is currently no way to expose or exclude a trait. Since there is no +aliasing mechanism for traits, it could be still possible by declaring a trait +that extends the scoped trait, but this is currently not implemented. + + +### Exposing/Excluding enums + +There is currently no way to expose or exclude an enum. The problem being there +is no way to alias one. + +

diff --git a/specs/enum/declaration.php b/specs/enum/declaration.php new file mode 100644 index 00000000..eca35693 --- /dev/null +++ b/specs/enum/declaration.php @@ -0,0 +1,213 @@ +, + * Pádraic Brady + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return [ + 'meta' => [ + 'title' => 'Enum declaration', + // Default values. If not specified will be the one used + 'prefix' => 'Humbug', + + 'expose-global-constants' => false, + 'expose-global-classes' => false, + 'expose-global-functions' => false, + 'expose-namespaces' => [], + 'expose-constants' => [], + 'expose-classes' => [], + 'expose-functions' => [], + + 'exclude-namespaces' => [], + 'exclude-constants' => [], + 'exclude-classes' => [], + 'exclude-functions' => [], + + 'expected-recorded-classes' => [], + 'expected-recorded-functions' => [], + ], + + 'minimal enum declaration' => <<<'PHP' + <<<'PHP' + 'grey', + Status::PUBLISHED => 'green', + self::ARCHIVED => 'red', + }; + } + } + + ---- + 'grey', + Status::PUBLISHED => 'green', + self::ARCHIVED => 'red', + }; + } + } + + PHP, + + 'enum with interface' => <<<'PHP' + <<<'PHP' + <<<'PHP' + [ + 'exclude-classes' => ['Status'], + 'payload' => <<<'PHP' + [ + 'expose-classes' => ['Status'], + 'payload' => <<<'PHP' + , + * Pádraic Brady + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return [ + 'meta' => [ + 'title' => 'Enum declaration', + // Default values. If not specified will be the one used + 'prefix' => 'Humbug', + + 'expose-global-constants' => false, + 'expose-global-classes' => false, + 'expose-global-functions' => false, + 'expose-namespaces' => [], + 'expose-constants' => [], + 'expose-classes' => [], + 'expose-functions' => [], + + 'exclude-namespaces' => [], + 'exclude-constants' => [], + 'exclude-classes' => [], + 'exclude-functions' => [], + + 'expected-recorded-classes' => [], + 'expected-recorded-functions' => [], + ], + + 'typehint and create an enum' => <<<'PHP' + <<<'PHP' + color(); + + ---- + color(); + + PHP, + + 'use instance of enum' => <<<'PHP' +