do not scan deprecated definitions

master
Jean-Christian Paul Denis 2023-07-16 01:25:52 +02:00
parent 348beb0c44
commit 3dba5ba085
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 18 additions and 1 deletions

View File

@ -31,6 +31,9 @@ class DcDeprecated extends Task
/** @var array Deprecated functions [filetype [pattern, deprecated, replacement, version, help link]] */
private $deprecated = ['php' => [], 'js' => []];
/** @var boolean Stop parsing files */
private $stop_scan = false;
protected function getProperties(): TaskDescriptor
{
return new TaskDescriptor(
@ -72,9 +75,23 @@ class DcDeprecated extends Task
return true;
}
public function openDirectory(): ?bool
{
$skipped = $this->stop_scan;
$this->stop_scan = false;
if (preg_match('/\/(dcdeprecated)(\/.*?|)$/', $this->path_full)) {
if (!$skipped) {
$this->success->add(__('Skip directory'));
}
$this->stop_scan = true;
}
return null;
}
public function readFile(&$content): ?bool
{
if (!in_array($this->path_extension, array_keys($this->deprecated))) {
if ($this->stop_scan || !in_array($this->path_extension, array_keys($this->deprecated))) {
return null;
}
foreach ($this->deprecated[$this->path_extension] as $d) {