Skip to content

Commit 459fb47

Browse files
committed
Add a hidden functions list, fixes #618
1 parent cee9ca9 commit 459fb47

File tree

7 files changed

+25
-7
lines changed

7 files changed

+25
-7
lines changed

generated/8.4/functionsList.php

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/8.4/rector-migrate.php

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/8.5/functionsList.php

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/8.5/rector-migrate.php

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/config/hiddenFunctions.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/*
3+
* A list of functions which don't really belong in Safe, but our
4+
* unsafe-function-detector detected them by accident, and now we
5+
* don't want to delete them (because that would break the backwards
6+
* compatibility promise implied by Semver), but we also don't want
7+
* to suggest that users should be using them.
8+
*/
9+
return [
10+
'array_all', // false is not an error
11+
];

generator/src/Generator/FileCreator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ private function getFunctionsNameList(array $functions): array
9393
$functionNames = array_map(function (Method $function) {
9494
return $function->getFunctionName();
9595
}, $functions);
96-
$specialCases = Scanner::getSpecialCases();
97-
$functionNames = array_merge($functionNames, $specialCases);
96+
$functionNames = array_merge($functionNames, Scanner::getSpecialCases());
97+
$functionNames = array_diff($functionNames, Scanner::getHiddenFunctions());
9898
natcasesort($functionNames);
9999
return $functionNames;
100100
}

generator/src/XmlDocParser/Scanner.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Scanner
2323
/**
2424
* @var string[]
2525
*/
26-
private $ignoredModules;
26+
private ?array $ignoredModules = null;
2727

2828
public function __construct(private readonly string $path)
2929
{
@@ -95,6 +95,17 @@ public static function getSpecialCases(): array
9595
return $matches[1];
9696
}
9797

98+
/**
99+
* Get a list of functions defined in special_cases.php so that we
100+
* can ignore them in the main list.
101+
*
102+
* @return string[]
103+
*/
104+
public static function getHiddenFunctions(): array
105+
{
106+
return require FileCreator::getSafeRootDir() . '/generator/config/hiddenFunctions.php';
107+
}
108+
98109
/**
99110
* @param SplFileInfo[] $paths
100111
* @param string[] $pastFunctionNames

0 commit comments

Comments
 (0)