Skip to content

Commit

Permalink
fixed lots of minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Sep 18, 2023
1 parent 84af688 commit ec2ad1e
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 76 deletions.
8 changes: 7 additions & 1 deletion doc/PhpAnnotations.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
title: PHP annotations
---

Here we document the PHP code annotations that are used and defined by different (static) analyses in this project.

Syntax of `@param`

```
Expand Down Expand Up @@ -34,4 +40,4 @@ Syntax of `@var`
@var mixed $in
@var \ClassObject $classObj
@var \Namespace\ClassObject $classObj
```
```
5 changes: 5 additions & 0 deletions doc/PhpConstraintOperations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: PHP Constraint Operations
---

(((TODO)))
6 changes: 6 additions & 0 deletions doc/declarations.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
title: Declarations
---

Here we document the qualified naming scheme for the locations we used.

* namespaces
* `|php+namespace:///a/b|` for namespace `A\B`
* `|php+namespace:///|` for global namespace
Expand Down
25 changes: 14 additions & 11 deletions doc/number_of_duplicate_classes.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
---
title: Example statistics
---

This is a very simple example report that PHP analysis can produce.

# Some stats

---
* Total number of class decls: 4021
* Unique class paths: 4021 (100%)
* Unique class names: 3997 (99%)

---
* Total number of interfaces decls: 160
* Unique interfaces paths: 160 (100%)
* Unique interfaces names: 156 (97%)

---
* Total number of trait decls: 0
* Unique trait paths: 0 (0%)
* Unique trait names: 0 (0%)

---
* Total number of mixed decls: 4181
* Unique mixed paths: 4181 (100%)
* Unique mixed names: 4152 (99%)

Type | Total | Unique Paths* | Unique Names* | Number of non unique:
- | - | - | - | -
class | 4021 | 4021 (100%) | 3997 (99%) | 24
interface | 160 | 160 (100%) | 156 (97%) | 4
trait | 0 | 0 (100%) | 0 (100%) | 0
mixed | 4181 | 4181 (100%) | 4152 (99%) | 27
| Type | Total | Unique Paths | Unique Names | Number of non unique |
| - | - | - | - | - |
| class | 4021 | 4021 (100%) | 3997 (99%) | 24 |
| interface | 160 | 160 (100%) | 156 (97%) | 4 |
| trait | 0 | 0 (100%) | 0 (100%) | 0 |
| mixed | 4181 | 4181 (100%) | 4152 (99%) | 27 |

\* `Unique Paths` contain the namespace, `Unique Names` only the name of the class.

List of duplicate class names:



```
<a.x, 425234>
<b.y, 425234>
<c.x, 425234>
```
27 changes: 14 additions & 13 deletions doc/php_type_constraint_operations.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Php Type Constraint Operations
---
title: PHP Type Constraint Operations
---

Some examples:
Here we document some examples of the type inference constraints we extract from PHP code.


**Assign operators (some sort of case)**
## Assign operators (some sort of case)

```
$a .= ... // $a is a String
Expand All @@ -14,15 +15,15 @@ $x = (int) $y; // $x = Integer
$x = 1; // $x = Integer
```

**Method call**
## Method call

```
$a -> methodCall();
// the type of $a has methodCall(); || type of $a has __clone() (magic method)
```

** Conditional statements **
## Conditional statements

```
$a instanceOf "C" // is_a
Expand All @@ -32,7 +33,7 @@ is_numeric($a) // $a is numeric
is_bool($a) // $a is a boolean
```

** Member addition **
## Member addition

```
class Empty {}
Expand All @@ -41,13 +42,13 @@ $e->newField = "value"; // newField is added
echo $e->newField; // newField is used
```

** Return types of methods and functions **
## Return types of methods and functions

```
function f () { return true }; // return type of f is a boolean
```

** Object instantiation **
## Object instantiation

```
$x = new Obj; // $x = instance of class Obj
Expand All @@ -63,15 +64,15 @@ getPersonId(new Person(), 1, 2, true); // correct
getPersonId(); // incorrect
```

** self/static/parent **
## self/static/parent **

```
self::methodCall(); // current class
parent::methodCall(); // one of the parent classes
static::methodCall(); // class of instantiation
```

** Out of scope **
## Out of scope

```
- Variable variables (resolve to everything)
Expand All @@ -80,8 +81,8 @@ static::methodCall(); // class of instantiation
```


** Other Notes **
## Other Notes

```
non parsing scripts are ignored
```
```
Loading

0 comments on commit ec2ad1e

Please sign in to comment.