├── RELEASE-NOTES.md
├── lib
└── php-parser.jar
├── doc
├── PhpConstraintOperations.md
├── PhpAnnotations.md
├── number_of_duplicate_classes.md
└── php_type_constraint_operations.md
├── FUNDING.md
├── META-INF
├── RASCAL.MF
└── MANIFEST.MF
├── .classpath
├── .gitignore
├── src
├── test
│ ├── rascal
│ │ └── resources
│ │ │ ├── parser
│ │ │ ├── phpdocs_small.txt
│ │ │ └── test
│ │ │ │ ├── b.php
│ │ │ │ └── a.php
│ │ │ ├── pp
│ │ │ ├── expr_Clone.php
│ │ │ ├── expr_Print.php
│ │ │ ├── expr_Errorsuppression.php
│ │ │ ├── loop_Doloop.php
│ │ │ ├── stmt_Unset.php
│ │ │ ├── class_Finalclass.php
│ │ │ ├── fetchAndCall_Constantfetches.php
│ │ │ ├── stmt_Globalconstants.php
│ │ │ ├── loop_Whileloop.php
│ │ │ ├── namespace_Differentnametypes.php
│ │ │ ├── stmt_Echo.php
│ │ │ ├── function_Typehints.php
│ │ │ ├── class_Interface.php
│ │ │ ├── expr_Shellexecution.php
│ │ │ ├── fetchAndCall_Arguments.php
│ │ │ ├── stmt_InlineHTML.php
│ │ │ ├── class_Conditionalclassdefinition.php
│ │ │ ├── expr_Exit.php
│ │ │ ├── expr_Variablesyntaxes.php
│ │ │ ├── function_Conditionalfunctiondefinition.php
│ │ │ ├── function_Returnandpassbyref.php
│ │ │ ├── namespace_Semicolonstylenamespaces.php
│ │ │ ├── fetchAndCall_Simplearrayaccess.php
│ │ │ ├── namespace_Bracednamespaces.php
│ │ │ ├── stmt_Declare.php
│ │ │ ├── fetchAndCall_Newexpressiondereferencing.php
│ │ │ ├── class_PHP4styledeclarations.php
│ │ │ ├── expr_isset()andempty().php
│ │ │ ├── function_Specialfunctionvariables.php
│ │ │ ├── expr_Includeandeval.php
│ │ │ ├── namespace_Somestatementsmayoccuroutsideofnamespaces.php
│ │ │ ├── class_Abstractclass.php
│ │ │ ├── expr_Ternaryoperator.php
│ │ │ ├── scalar_Magicconstants.php
│ │ │ ├── stmt_Controlflowstatements.php
│ │ │ ├── fetchAndCall_Array
│ │ │ │ └── stringdereferencing.php
│ │ │ ├── expr_Casts.php
│ │ │ ├── expr_Comparisonoperators.php
│ │ │ ├── function_Variadicfunctions.php
│ │ │ ├── scalar_Constantstringsyntaxes.php
│ │ │ ├── scalar_Encapsedstrings.php
│ │ │ ├── stmt___halt_compiler.php
│ │ │ ├── expr_Arraydefinitions.php
│ │ │ ├── fetchAndCall_Functioncalls.php
│ │ │ ├── fetchAndCall_Staticpropertyfetches.php
│ │ │ ├── stmt_Blocklessstatementsforif
│ │ │ │ └── for
│ │ │ │ │ └── etc.php
│ │ │ ├── stmt_Switch.php
│ │ │ ├── loop_Forloop.php
│ │ │ ├── expr_Closures.php
│ │ │ ├── stmt_If
│ │ │ │ └── Elseif
│ │ │ │ │ └── Else.php
│ │ │ ├── function_Defaultvalues(staticscalartests).php
│ │ │ ├── expr_Logicaloperators.php
│ │ │ ├── fetchAndCall_Staticcalls.php
│ │ │ ├── namespace_Aliases(use).php
│ │ │ ├── stmt_Try
│ │ │ │ └── catch.php
│ │ │ ├── fetchAndCall_Objectaccess.php
│ │ │ ├── expr_New.php
│ │ │ ├── scalar_Nowdocandheredocstrings.php
│ │ │ ├── class_Traits.php
│ │ │ ├── loop_Foreachloop.php
│ │ │ ├── scalar_Differentfloatsyntaxes.php
│ │ │ ├── expr_Mathematicaloperators.php
│ │ │ └── class_Classdeclaration.php
│ │ │ ├── class
│ │ │ ├── Class.php
│ │ │ ├── ClassFinal.php
│ │ │ ├── ClassAbstract.php
│ │ │ ├── ClassAExtendsB.php
│ │ │ ├── ClassAImplementsCD.php
│ │ │ └── ClassPopulated.php
│ │ │ └── experiments
│ │ │ └── mscse2014
│ │ │ ├── variable
│ │ │ └── variable.php
│ │ │ ├── ternary
│ │ │ └── ternary.php
│ │ │ ├── various
│ │ │ └── various.php
│ │ │ ├── normalAssign
│ │ │ └── normalAssign.php
│ │ │ ├── logicalOp
│ │ │ └── logicalOp.php
│ │ │ ├── comparisonOp
│ │ │ └── comparisonOp.php
│ │ │ ├── classConstant
│ │ │ └── classConstant.php
│ │ │ ├── classProperty
│ │ │ └── classProperty.php
│ │ │ ├── methodCall
│ │ │ └── methodCall.php
│ │ │ ├── classMethod
│ │ │ └── classMethod.php
│ │ │ ├── predefinedVariables
│ │ │ └── predefinedVariables.php
│ │ │ ├── array
│ │ │ └── array.php
│ │ │ ├── scalar
│ │ │ └── scalar.php
│ │ │ ├── casts
│ │ │ └── casts.php
│ │ │ ├── classKeywords
│ │ │ └── classKeywords.php
│ │ │ ├── unaryOp
│ │ │ └── unaryOp.php
│ │ │ ├── methodCallStatic
│ │ │ └── methodCallStatic.php
│ │ │ ├── opAssign
│ │ │ └── opAssign.php
│ │ │ ├── function
│ │ │ └── function.php
│ │ │ └── binaryOp
│ │ │ └── binaryOp.php
│ └── java
│ │ └── AllTests.java
└── main
│ └── rascal
│ └── lang
│ └── php
│ ├── analysis
│ ├── cfg
│ │ ├── samples
│ │ │ ├── Do001.php
│ │ │ ├── Ternary001.php
│ │ │ ├── Cond001.php
│ │ │ ├── StraightLine001.php
│ │ │ ├── Ternary002.php
│ │ │ ├── For001.php
│ │ │ ├── Goto001.php
│ │ │ ├── Goto002.php
│ │ │ ├── While002.php
│ │ │ ├── Foreach001.php
│ │ │ ├── While001.php
│ │ │ ├── Goto003.php
│ │ │ ├── Goto004.php
│ │ │ ├── Cond002.php
│ │ │ ├── Cond003.php
│ │ │ ├── While003.php
│ │ │ ├── Foreach002.php
│ │ │ ├── Foreach003.php
│ │ │ └── Switch001.php
│ │ └── Label.rsc
│ ├── evaluators
│ │ ├── calltests
│ │ │ ├── strrchr.php
│ │ │ └── substr.php
│ │ └── Simplify.rsc
│ └── includes
│ │ └── NormalizeConstCase.rsc
│ ├── util
│ ├── Constants.rsc
│ └── Option.rsc
│ ├── semantics
│ ├── shared
│ │ ├── Value.rsc
│ │ └── StoreModel.rsc
│ └── concrete
│ │ └── Value.rsc
│ ├── types
│ └── Types.rsc
│ └── syntax
│ └── Names.rsc
├── rascal_style.xml
├── LICENSE.md
├── .project
└── .github
└── workflows
└── build.yaml
/RELEASE-NOTES.md:
--------------------------------------------------------------------------------
1 | # to be written
2 |
3 |
--------------------------------------------------------------------------------
/lib/php-parser.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwi-swat/php-analysis/HEAD/lib/php-parser.jar
--------------------------------------------------------------------------------
/doc/PhpConstraintOperations.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: PHP Constraint Operations
3 | ---
4 |
5 | (((TODO)))
6 |
--------------------------------------------------------------------------------
/FUNDING.md:
--------------------------------------------------------------------------------
1 | * NWO-I Centrum Wiskunde & Informatica (2013-...)
2 | * Apalachean State University (2023-...)
3 |
--------------------------------------------------------------------------------
/META-INF/RASCAL.MF:
--------------------------------------------------------------------------------
1 | Project-Name: php-analysis
2 | Source: src/main/rascal, src/test/rascal
3 | Require-Libraries: |lib://rascal-git|
4 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 |
3 | # Files generated for Rascal resources
4 | src/*.rsc
5 |
6 | # eclipse stuff
7 | .metadata
8 | bin/**
9 | tmp/**
10 | tmp/**/*
11 | **/*.rvm
12 | *.tmp
13 | *.bak
14 | *.swp
15 | *~.nib
16 | local.properties
17 | .classpath
18 | .settings/
19 | .loadpath
20 |
21 | .DS_Store
22 |
23 | # Maven
24 | target
25 |
26 | # VSCode
27 | .vscode
28 |
29 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/parser/phpdocs_small.txt:
--------------------------------------------------------------------------------
1 | ["/**
2 | * @param User $usr
3 | * @param Document $doc
4 | */",
5 | "/**
6 | * @return User
7 | */",
8 | "/**
9 | * @return Document
10 | */",
11 | "/**
12 | * Class Loan
13 | * @package eLib
14 | */",
15 | "/**
16 | * @param string $string
17 | */",
18 | "/**
19 | * Class Document
20 | * @package eLib
21 | */",
22 | "/**
23 | * @param string $string
24 | * @param string $string2
25 | * @param string $string3
26 | */",
27 | "/**
28 | * Class User
29 | * @package eLib
30 | */",
31 | "/**
32 | * Class Main
33 | */"]
34 |
--------------------------------------------------------------------------------
/doc/PhpAnnotations.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: PHP annotations
3 | ---
4 |
5 | Here we document the PHP code annotations that are used and defined by different (static) analyses in this project.
6 |
7 | Syntax of `@param`
8 |
9 | ```
10 | @param []
11 |
12 | // Examples:
13 | @param int $var
14 | @param int|string $input Input of this method is either an integer or a string
15 | @param mixed $in
16 | @param \ClassObject $classObj
17 | @param \Namespace\ClassObject $classObj
18 | ```
19 |
20 | Syntax of `@return`
21 |
22 | ```
23 | @return []
24 |
25 | // Examples:
26 | @return void
27 | @return string|int
28 | @return ClassObject|null
29 | @return \Namespace\ClassObject|null
30 | ```
31 |
32 | Syntax of `@var`
33 |
34 | ```
35 | @var [variable_name] []
36 |
37 | // Examples:
38 | @var int $var
39 | @var int|string $input Input of this method is either an integer or a string
40 | @var mixed $in
41 | @var \ClassObject $classObj
42 | @var \Namespace\ClassObject $classObj
43 | ```
44 |
--------------------------------------------------------------------------------
/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: PHPAir
4 | Bundle-SymbolicName: PHPAir
5 | Bundle-Version: 1.0.0
6 | Require-Bundle: rascal_eclipse
7 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8
8 | Export-Package:
9 | lang.php.analysis,
10 | lang.php.analysis.callgraph,
11 | lang.php.analysis.cfg,
12 | lang.php.analysis.evaluators,
13 | lang.php.analysis.evaluators.calltests,
14 | lang.php.analysis.includes,
15 | lang.php.analysis.signatures,
16 | lang.php.ast,
17 | lang.php.experiments.esec2013,
18 | lang.php.experiments.icse2013,
19 | lang.php.experiments.wasdett2013,
20 | lang.php.experiments.wcre2014,
21 | lang.php.extract.csvs,
22 | lang.php.pp,
23 | lang.php.sdf,
24 | lang.php.sdf.languages.php.common,
25 | lang.php.sdf.languages.php.common.literals,
26 | lang.php.sdf.languages.php.version4,
27 | lang.php.sdf.languages.php.version5,
28 | lang.php.sdf.languages.php.version5.literals,
29 | lang.php.semantics,
30 | lang.php.semantics.concrete,
31 | lang.php.semantics.shared,
32 | lang.php.stats,
33 | lang.php.syntax,
34 | lang.php.types,
35 | lang.php.util
36 |
--------------------------------------------------------------------------------
/doc/number_of_duplicate_classes.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Example statistics
3 | ---
4 |
5 | This is a very simple example report that PHP analysis can produce.
6 |
7 | # Some stats
8 |
9 | * Total number of class decls: 4021
10 | * Unique class paths: 4021 (100%)
11 | * Unique class names: 3997 (99%)
12 |
13 | * Total number of interfaces decls: 160
14 | * Unique interfaces paths: 160 (100%)
15 | * Unique interfaces names: 156 (97%)
16 |
17 | * Total number of trait decls: 0
18 | * Unique trait paths: 0 (0%)
19 | * Unique trait names: 0 (0%)
20 |
21 | * Total number of mixed decls: 4181
22 | * Unique mixed paths: 4181 (100%)
23 | * Unique mixed names: 4152 (99%)
24 |
25 | | Type | Total | Unique Paths | Unique Names | Number of non unique |
26 | | - | - | - | - | - |
27 | | class | 4021 | 4021 (100%) | 3997 (99%) | 24 |
28 | | interface | 160 | 160 (100%) | 156 (97%) | 4 |
29 | | trait | 0 | 0 (100%) | 0 (100%) | 0 |
30 | | mixed | 4181 | 4181 (100%) | 4152 (99%) | 27 |
31 |
32 | \* `Unique Paths` contain the namespace, `Unique Names` only the name of the class.
33 |
34 | List of duplicate class names:
35 |
36 |
37 | ```
38 |
39 |
40 |
41 | ```
42 |
--------------------------------------------------------------------------------
/rascal_style.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @license{
5 | }
6 | @license\{.*$
7 | \}$
8 | true
9 | true
10 |
11 |
12 | %%
13 | %%
14 | ^%%
15 | ^%%
16 | %%
17 | true
18 | true
19 |
20 |
21 | #
22 | #
23 | ^#
24 | ^#
25 | #
26 | true
27 | true
28 |
29 |
30 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 |
8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 |
12 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/samples/Do001.php:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/parser/test/b.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/samples/Ternary001.php:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/loop_Whileloop.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/class_Interface.php:
--------------------------------------------------------------------------------
1 |
16 | B
17 |
20 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/samples/Ternary002.php:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/class_Conditionalclassdefinition.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/fetchAndCall_Simplearrayaccess.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/samples/Goto002.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/semantics/shared/Value.rsc:
--------------------------------------------------------------------------------
1 | @license{
2 | Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | }
13 | @contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)}
14 | module lang::php::semantics::shared::Value
15 |
16 | public data Value;
17 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/fetchAndCall_Newexpressiondereferencing.php:
--------------------------------------------------------------------------------
1 | b;
15 | (new A)->b();
16 | (new A)['b'];
17 | (new A)['b']['c'];
18 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/util/Option.rsc:
--------------------------------------------------------------------------------
1 | @license{
2 | Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | }
13 | @contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)}
14 | module lang::php::util::Option
15 |
16 | public data Option[&T] = some(&T item) | none();
17 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/class_PHP4styledeclarations.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/samples/Foreach001.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/samples/While001.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/namespace_Somestatementsmayoccuroutsideofnamespaces.php:
--------------------------------------------------------------------------------
1 |
20 | Hi!
21 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/class_Abstractclass.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/expr_Ternaryoperator.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/experiments/mscse2014/various/various.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/stmt_Controlflowstatements.php:
--------------------------------------------------------------------------------
1 | $b;
17 | $a >= $b;
18 | $a == $b;
19 | $a === $b;
20 | $a != $b;
21 | $a !== $b;
22 | $a instanceof B;
23 | $a instanceof $b;
24 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/samples/Cond003.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/experiments/mscse2014/logicalOp/logicalOp.php:
--------------------------------------------------------------------------------
1 | B";
16 | "$A[B]";
17 | "$A[0]";
18 | "$A[0x0]";
19 | "$A[$B]";
20 | "{$A}";
21 | "{$A['B']}";
22 | "${A}";
23 | "${A['B']}";
24 | "${$A}";
25 | "A $B C";
26 | b"$A";
27 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/stmt___halt_compiler.php:
--------------------------------------------------------------------------------
1 |
17 | Hallo World!
18 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/experiments/mscse2014/comparisonOp/comparisonOp.php:
--------------------------------------------------------------------------------
1 | $f;
18 | $g >= $h;
19 | $i == $j;
20 | $k === $l;
21 | $m != $n;
22 | $o <> $p;
23 | $q !== $r;
24 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/expr_Arraydefinitions.php:
--------------------------------------------------------------------------------
1 | 'd', 'e' => &$f);
19 |
20 | // short array syntax
21 | [];
22 | [1, 2, 3];
23 | ['a' => 'b'];
24 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | PHPAnalysis
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | rascal_eclipse.rascal_builder
15 |
16 |
17 |
18 |
19 | rascal_eclipse.term_builder
20 |
21 |
22 |
23 |
24 | org.eclipse.pde.ManifestBuilder
25 |
26 |
27 |
28 |
29 | org.eclipse.pde.SchemaBuilder
30 |
31 |
32 |
33 |
34 | org.eclipse.m2e.core.maven2Builder
35 |
36 |
37 |
38 |
39 |
40 | org.eclipse.m2e.core.maven2Nature
41 | rascal_eclipse.rascal_nature
42 | org.eclipse.jdt.core.javanature
43 | org.eclipse.pde.PluginNature
44 | rascal_eclipse.term_nature
45 |
46 |
47 |
48 | 1667918394185
49 |
50 | 30
51 |
52 | org.eclipse.core.resources.regexFilterMatcher
53 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/fetchAndCall_Functioncalls.php:
--------------------------------------------------------------------------------
1 | b['c']();
23 |
24 | // array dereferencing
25 | a()['b'];
26 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/experiments/mscse2014/classConstant/classConstant.php:
--------------------------------------------------------------------------------
1 | "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five");
15 | foreach($a as $id => $x) {
16 | echo "The current value at position " . $id . " is " . $x . "\n";
17 | }
18 |
19 | ?>
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/semantics/shared/StoreModel.rsc:
--------------------------------------------------------------------------------
1 | @license{
2 | Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | }
13 | @contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)}
14 | module lang::php::semantics::shared::StoreModel
15 |
16 | import lang::php::semantics::shared::Value;
17 |
18 | public alias Loc = int;
19 |
20 | public alias Mem = map[Loc,Value];
21 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/fetchAndCall_Staticpropertyfetches.php:
--------------------------------------------------------------------------------
1 |
21 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/stmt_Blocklessstatementsforif/for/etc.php:
--------------------------------------------------------------------------------
1 | "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five");
15 | foreach($a as $id => $x) {
16 | echo "The current value at position " . $id . " is " . $x . "\n";
17 | if ($id == 3) break;
18 | }
19 |
20 | ?>
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/stmt_Switch.php:
--------------------------------------------------------------------------------
1 | d();
19 |
20 | $d = "d";
21 | $c->$d();
22 |
23 | $c->$d();
24 |
25 | // variable calls
26 | //$a->$b();
27 | //$a::$b();
28 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/loop_Forloop.php:
--------------------------------------------------------------------------------
1 | 'baz']
24 | )
25 | {
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/experiments/mscse2014/classMethod/classMethod.php:
--------------------------------------------------------------------------------
1 | b;
16 | $a->b['c'];
17 | $a->b{'c'};
18 |
19 | // method call variations
20 | $a->b();
21 | $a->{'b'}();
22 | $a->$b();
23 | $a->$b['c']();
24 |
25 | // array dereferencing
26 | $a->b()['c'];
27 | $a->b(){'c'}; // invalid PHP: drop Support?
28 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/expr_New.php:
--------------------------------------------------------------------------------
1 | b();
23 | new $a->b->c();
24 | new $a->b['c']();
25 | new $a->b{
26 | 'c'
27 | }();
28 |
29 | // test regression introduces by new dereferencing syntax
30 | (new A);
31 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/experiments/mscse2014/array/array.php:
--------------------------------------------------------------------------------
1 | object has method "__toString"
23 | (object)$j; // <: object
24 | (unset)$k; // null
--------------------------------------------------------------------------------
/src/test/rascal/resources/experiments/mscse2014/classKeywords/classKeywords.php:
--------------------------------------------------------------------------------
1 | c test
34 | EOS;
35 |
36 | // comment to force line break before EOF
37 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/Label.rsc:
--------------------------------------------------------------------------------
1 | @license{
2 | Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | }
13 | @contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)}
14 | module lang::php::analysis::cfg::Label
15 |
16 | @doc{Labels are added to expressions and statements to give us a
17 | shorthand to refer to the various statements, expressions, and
18 | sub-statements/sub-expressions in the code.}
19 | data Lab = lab(int id);
20 |
21 | public data Expr(Lab lab=lab(-1));
22 | public data Stmt(Lab lab=lab(-1));
23 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/class_Traits.php:
--------------------------------------------------------------------------------
1 | >= $l; // $k = int()
20 |
21 | $m .= $n; // $m = string()
22 |
23 | $o /= $p; // $o = int(), $p != array()
24 | $q -= $r; // $q = int(), $r != array()
25 |
26 | $s *= $t; // $s = int() || float()
27 | $u += $v; // $u = int() || float()
28 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/loop_Foreachloop.php:
--------------------------------------------------------------------------------
1 | $c) {
20 | }
21 | foreach ($a as $b => &$c) {
22 | }
23 | foreach ($a as list($a, $b)) {
24 | }
25 | foreach ($a as $a => list($b, , $c)) {
26 | }
27 |
28 | // foreach on expression
29 | foreach (array() as $b) {
30 | }
31 |
32 | // alternative syntax
33 | foreach ($a as $b):
34 | endforeach;
35 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/scalar_Differentfloatsyntaxes.php:
--------------------------------------------------------------------------------
1 | float overflows
26 | // (all are actually the same number, just in different representations)
27 | 18446744073709551615;
28 | 0xFFFFFFFFFFFFFFFF;
29 | 01777777777777777777777;
30 | 0177777777777777777777787;
31 | 0b1111111111111111111111111111111111111111111111111111111111111111;
32 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/includes/NormalizeConstCase.rsc:
--------------------------------------------------------------------------------
1 | @license{
2 | Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | }
13 | module lang::php::analysis::includes::NormalizeConstCase
14 |
15 | import lang::php::ast::AbstractSyntax;
16 | import String;
17 |
18 | private set[str] caseInsensitiveConsts = { "TRUE", "FALSE", "NULL" };
19 |
20 | public Expr normalizeConstCase(Expr e) {
21 | return bottom-up visit(e) {
22 | case fi:fetchConst(ni:name(s)) : {
23 | if (toUpperCase(s) in caseInsensitiveConsts)
24 | insert fi[name=ni[name=toUpperCase(s)]];
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/class/ClassPopulated.php:
--------------------------------------------------------------------------------
1 | > $b;
31 | $a ** $b;
32 |
33 | // associativity
34 | $a * $b * $c;
35 | $a * ($b * $c);
36 |
37 | // precedence
38 | $a + $b * $c;
39 | ($a + $b) * $c;
40 |
41 | // pow is special
42 | $a ** $b ** $c;
43 | ($a ** $b) ** $c;
44 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/pp/class_Classdeclaration.php:
--------------------------------------------------------------------------------
1 | methodCall();
22 | // the type of $a has methodCall(); || type of $a has __clone() (magic method)
23 |
24 | ```
25 |
26 | ## Conditional statements
27 |
28 | ```
29 | $a instanceOf "C" // is_a
30 | // type of $a is (a child of) class C || type of $a implements interface C
31 |
32 | is_numeric($a) // $a is numeric
33 | is_bool($a) // $a is a boolean
34 | ```
35 |
36 | ## Member addition
37 |
38 | ```
39 | class Empty {}
40 | $e = new Empty();
41 | $e->newField = "value"; // newField is added
42 | echo $e->newField; // newField is used
43 | ```
44 |
45 | ## Return types of methods and functions
46 |
47 | ```
48 | function f () { return true }; // return type of f is a boolean
49 | ```
50 |
51 | ## Object instantiation
52 |
53 | ```
54 | $x = new Obj; // $x = instance of class Obj
55 | ```
56 | ** Parameters (number of required params and type hints) **
57 |
58 | ```
59 | function getPersonId(Person $p) {
60 | return rand(100);
61 | }
62 | getPersonId(new Person()); // correct
63 | getPersonId(new Person(), 1, 2, true); // correct
64 | getPersonId(); // incorrect
65 | ```
66 |
67 | ## self/static/parent **
68 |
69 | ```
70 | self::methodCall(); // current class
71 | parent::methodCall(); // one of the parent classes
72 | static::methodCall(); // class of instantiation
73 | ```
74 |
75 | ## Out of scope
76 |
77 | ```
78 | - Variable variables (resolve to everything)
79 | - Variable method calls (resolve to everything)
80 | - Eval
81 | ```
82 |
83 |
84 | ## Other Notes
85 |
86 | ```
87 | non parsing scripts are ignored
88 | ```
89 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/cfg/samples/Switch001.php:
--------------------------------------------------------------------------------
1 |
30 |
31 |
--------------------------------------------------------------------------------
/src/test/rascal/resources/experiments/mscse2014/binaryOp/binaryOp.php:
--------------------------------------------------------------------------------
1 | [E] = array() || One of them not array: [E] <: floaty()
15 | $c - $d; // [$c] != array(), [$d] != array(), .
16 | $e * $f; // [$c] != array(), [$d] != array(), .
17 | $g / $h; // [$c] != array(), [$d] != array(), .
18 | $i % $j; // [E] = int
19 |
20 | // bitwise operators:
21 |
22 | // for &, | and ^
23 | // [$l && $r] = string => [E] = string,
24 | // [$l || $r] != string => [E] = int
25 | $k & $l; // and
26 | $m | $n; // inclusive or
27 | $o ^ $p; // exclusive or
28 |
29 | // for << and >>
30 | // [E] = int()
31 | $q << $r; // shift left
32 | $s >> $t; // shift right
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/analysis/evaluators/Simplify.rsc:
--------------------------------------------------------------------------------
1 | @license{
2 | Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | }
13 | module lang::php::analysis::evaluators::Simplify
14 |
15 | import lang::php::ast::AbstractSyntax;
16 | import lang::php::ast::System;
17 | import lang::php::analysis::evaluators::AlgebraicSimplification;
18 | import lang::php::analysis::evaluators::SimulateCalls;
19 | import lang::php::analysis::evaluators::MagicConstants;
20 | import lang::php::analysis::includes::NormalizeConstCase;
21 |
22 | @doc{Apply available normalization functions to simplify the expression}
23 | public Expr simplifyExpr(Expr e, loc baseLoc) {
24 | e = normalizeConstCase(inlineMagicConstants(e, baseLoc));
25 | solve(e) {
26 | e = algebraicSimplification(simulateCalls(e));
27 | }
28 | return e;
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/rascal/lang/php/syntax/Names.rsc:
--------------------------------------------------------------------------------
1 | @license{
2 | Copyright (c) 2013, NWO-I Centrum Wiskunde & Informatica (CWI), Mark Hills, Appalachian State University
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | }
13 | module lang::php::\syntax::Names
14 |
15 | import String;
16 |
17 | public data NameQualification // qualified -> not fullyQualified
18 | = unqualified()
19 | | qualified()
20 | | fullyQualified();
21 |
22 |
23 | public NameQualification getNameQualification(str phpName)
24 | {
25 | str name = replaceAll(phpName, "\\", "/");
26 |
27 | if (/^\/.*$/ := name)
28 | {
29 | return fullyQualified();
30 | }
31 | else if (/^.+\/.*$/ := name)
32 | {
33 | return qualified();
34 | }
35 | else
36 | {
37 | return unqualified();
38 | }
39 | }
40 |
41 |
42 | public str getLastNamePart(str phpName)
43 | {
44 | str name = replaceAll(phpName, "\\", "/");
45 |
46 | if (/^.*\/$/ := "/" + name)
47 | {
48 | return lastName;
49 | }
50 | return phpName; // TODO ??
51 | }
52 |
--------------------------------------------------------------------------------