Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Ignore PHP namespace statements #328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/cc/engine/analyzers/php/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Main < CC::Engine::Analyzers::Base
].freeze
DEFAULT_MASS_THRESHOLD = 75
DEFAULT_FILTERS = [
"(Stmt_Namespace ___)",
"(Stmt_Use ___)",
"(comments ___)",
].freeze
Expand Down
4 changes: 4 additions & 0 deletions spec/cc/engine/analyzers/php/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
create_source_file("foo.php", <<~EOPHP)
<?php
namespace KeepClear\\Http\\Controllers\\API\\V1;

use Illuminate\\Http\\Request;
use KeepClear\\Http\\Controllers\\Controller;
use KeepClear\\Models\\Comment;
Expand All @@ -177,12 +178,14 @@
use KeepClear\\Traits\\Controllers\\ApiFilter;
use KeepClear\\Traits\\Controllers\\ApiParseBody;
use KeepClear\\Traits\\Controllers\\ApiException;

a / b;
EOPHP

create_source_file("bar.php", <<~EOPHP)
<?php
namespace KeepClear\\Http\\Controllers\\API\\V1;

use Illuminate\\Http\\Request;
use KeepClear\\Http\\Controllers\\Controller;
use KeepClear\\Models\\Comment;
Expand All @@ -191,6 +194,7 @@
use KeepClear\\Traits\\Controllers\\ApiFilter;
use KeepClear\\Traits\\Controllers\\ApiParseBody;
use KeepClear\\Traits\\Controllers\\ApiException;

a + b;
EOPHP

Expand Down