From 3dba5ba08574b6d47a51abc053db6e341ca1471a Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 16 Jul 2023 01:25:52 +0200 Subject: [PATCH] do not scan deprecated definitions --- src/Task/DcDeprecated.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Task/DcDeprecated.php b/src/Task/DcDeprecated.php index db01f07..0c1e6fe 100644 --- a/src/Task/DcDeprecated.php +++ b/src/Task/DcDeprecated.php @@ -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) {