-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Mark all declarations as internal (#882)
This should allow IDEs such as PHPStorm to honour the tag and avoid showing the results in the auto-complete. Closes #861.
- Loading branch information
Showing
14 changed files
with
378 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the humbug/php-scoper package. | ||
* | ||
* Copyright (c) 2017 Théo FIDRY <[email protected]>, | ||
* Pádraic Brady <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
return [ | ||
'meta' => [ | ||
'title' => 'It adds @internal annotations to all declarations', | ||
// Default values. If not specified will be the one used | ||
'prefix' => 'Humbug', | ||
|
||
'tag-declarations-as-internal' => true, | ||
|
||
'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' => [], | ||
], | ||
|
||
'Declarations without any comment' => <<<'PHP' | ||
<?php | ||
class RegularClass { | ||
public function aMethod() {} | ||
} | ||
interface RegularInterface {} | ||
abstract class RegularAbstractClass {} | ||
function regular_function () {} | ||
trait RegularTrait {} | ||
const REGULAR_CONSTANT = 'FOO'; | ||
enum RegularEnum {} | ||
---- | ||
<?php | ||
namespace Humbug; | ||
/** @internal */ | ||
class RegularClass | ||
{ | ||
public function aMethod() | ||
{ | ||
} | ||
} | ||
/** @internal */ | ||
interface RegularInterface | ||
{ | ||
} | ||
/** @internal */ | ||
abstract class RegularAbstractClass | ||
{ | ||
} | ||
/** @internal */ | ||
function regular_function() | ||
{ | ||
} | ||
/** @internal */ | ||
trait RegularTrait | ||
{ | ||
} | ||
/** @internal */ | ||
const REGULAR_CONSTANT = 'FOO'; | ||
/** @internal */ | ||
enum RegularEnum | ||
{ | ||
} | ||
|
||
PHP, | ||
|
||
'Declarations without with comments' => <<<'PHP' | ||
<?php | ||
// Smth | ||
class RegularClass { | ||
public function aMethod() {} | ||
} | ||
---- | ||
<?php | ||
namespace Humbug; | ||
// Smth | ||
/** @internal */ | ||
class RegularClass | ||
{ | ||
public function aMethod() | ||
{ | ||
} | ||
} | ||
|
||
PHP, | ||
|
||
'Declarations with existing phpDoc' => <<<'PHP' | ||
<?php | ||
/** | ||
* A comment. | ||
*/ | ||
class RegularClass { | ||
public function aMethod() {} | ||
} | ||
---- | ||
<?php | ||
namespace Humbug; | ||
/** | ||
* A comment. | ||
* @internal | ||
*/ | ||
class RegularClass | ||
{ | ||
public function aMethod() | ||
{ | ||
} | ||
} | ||
|
||
PHP, | ||
|
||
'Declarations with inlined phpDoc' => <<<'PHP' | ||
<?php | ||
/** A comment. */ | ||
class RegularClass { | ||
public function aMethod() {} | ||
} | ||
---- | ||
<?php | ||
namespace Humbug; | ||
/** A comment. | ||
* @internal | ||
*/ | ||
class RegularClass | ||
{ | ||
public function aMethod() | ||
{ | ||
} | ||
} | ||
|
||
PHP, | ||
|
||
'Declarations with inlined phpDoc already containing the @internal tag' => <<<'PHP' | ||
<?php | ||
/** @internal */ | ||
class RegularClass { | ||
public function aMethod() {} | ||
} | ||
---- | ||
<?php | ||
namespace Humbug; | ||
/** @internal */ | ||
class RegularClass | ||
{ | ||
public function aMethod() | ||
{ | ||
} | ||
} | ||
|
||
PHP, | ||
|
||
'Declarations with existing phpDoc containing the @internal tag' => <<<'PHP' | ||
<?php | ||
/** | ||
* A comment. | ||
* | ||
* @private | ||
* @internal | ||
*/ | ||
class RegularClass { | ||
public function aMethod() {} | ||
} | ||
---- | ||
<?php | ||
namespace Humbug; | ||
/** | ||
* A comment. | ||
* | ||
* @private | ||
* @internal | ||
*/ | ||
class RegularClass | ||
{ | ||
public function aMethod() | ||
{ | ||
} | ||
} | ||
|
||
PHP, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.