• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

marabesi / php-import-checker / #222

24 Jan 2025 08:18PM UTC coverage: 91.579%. Remained the same
#222

push

marabesi
chore(deps-dev): bump typescript from 5.7.2 to 5.7.3

Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.2 to 5.7.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.2...v5.7.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

34 of 42 branches covered (80.95%)

Branch coverage included in aggregate %.

53 of 53 relevant lines covered (100.0%)

94.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/parser/Namespace.ts
1
import { flatMap } from 'lodash';
1✔
2
import { Block, Node } from 'php-parser';
3
import { PhpUseItem } from './types/Nodes';
4

5
function walker(nodes: Block): any[] {
6
    const namespaces: PhpUseItem[] = [];
69✔
7

8
    function walk(nodes: any) {
9
        if (nodes && nodes.kind === 'usegroup') {
358✔
10
            namespaces.push(nodes);
145✔
11
        }
12

13
        if (nodes.children) {
358✔
14
            nodes.children.forEach((node: Node) => walk(node));
157✔
15
        }
16

17
        if (nodes.length) {
358✔
18
            nodes.forEach((node: Node) => walk(node));
132✔
19
        }
20
    }
21

22
    walk(nodes);
69✔
23

24
    return namespaces;
69✔
25
}
26

27
export class Namespace {
1✔
28
    private useTree: any;
29

30
    constructor(private ast: any) {
69✔
31
        this.useTree = walker(this.ast);
69✔
32
     }
33

34
    normalizeUseStatements(): PhpUseItem[] {
35
        const extractUseItems: PhpUseItem[] = flatMap(
69✔
36
            this.useTree.map((usegroup: PhpUseItem) => usegroup.items)
145✔
37
        );
38

39
        return extractUseItems
69✔
40
            .map((use: PhpUseItem) => {
41
                if (use.alias) {
157✔
42
                    use.name = `${use.name}\\${use.alias.name}`;
8✔
43
                    use.loc = use.alias.loc;
8✔
44
                    return use;
8✔
45
                }
46
                return use;
149✔
47
            });
48
    }
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc