This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.
Although this extension is officially supported by CAST, please note that it has been developed within the technical constraints of the CAST Universal Analyzer technology and to some extent adapted to meet specific customer needs. Therefore the extension may not address all of the coding techniques and patterns that exist for the target technology and may not produce the same level of analysis and precision regarding e.g. quality measurement and/or function point counts that are typically produced by other CAST AIP analyzers.

What's new?

PHP 1.1.0

  • In this release, a sample CAST Transaction Configuration Center (TCC) configuration file (.TCCsetup) is provided. This file can be imported into TCC (see PHP 1.1 - Sample of TCC Configuration for FP computation) and it provides a basic configuration for transactions entry and end points.
  • The third-party Code Sniffer and PHPMD that are bundled with the PHP technology extension have been upgraded to recent versions: 
    • Code Sniffer 2.5.0 and Php MsDoctor 15.0 are now used with PHP 1.1.
    • Please refer to the PHP Installation section for more information about how to install new versions of these third-party items - if you want to take advantage of new Quality Rules provided in PHP 1.1, you must install these items.
  • New Quality Rules have been integrated from the latest Code Sniffer Plugin (the following Quality Rules only function when you install the latest version of the Code Sniffer Plugin delivered with PHP 1.1: these rules are particularly recommended for Zend and Symfony Frameworks:
    1. Avoid having variables without naming conventions (PHP) : this rule is particularly recommended for the Zend Framework (PHP)
    2. Avoid having For-loops that use a function call in the test expression (PHP)
    3. Avoid having control structures without proper spacing in the open and close brace - PSR2 (PHP)
    4. Avoid Having control structures without proper switch case declarations (PSR2) (PHP)
    5. Avoid having variables passed by reference when calling a function (PHP)

    6. Avoid having multiple classes defined in a single file - Symfony STD (PHP)

    7. Avoid having object not instantiated using parenthesis - Symfony STD (PHP

    8. Avoid having class methods without scope modifiers - Symfony STD (PHP)

    9. Avoid having inline control statements (PHP)

  • Symfony framework support 
    • This version provides the support of the Symfony framework based on the java extension delivered inside the package.
    • The following objects defined in the Symfony configuration file are identified during the analysis. Their creation is based on the yml/Yaml configuration files. These objects are created under Configuration/Symfony folder
      • Symfony Controller / Controller Class
      • Symfony Service
      • Symfony Route
    • An analysis will create links between Symfony objects and PHP objects. Please refer to the Analysis result section for details.
    • YML and YAML extensions are also supported in this new version. The PHP discover has been also updated to consider this files
Please note that this version contains all bug fixes from PHP 1.0.x.

PHP 1.1.1

PHP 1.1.2

PHP 1.1.3

  • Bug fixing - see PHP 1.1 - Bug Fix List.
  • Discovery of the following known issues which will be fixed in a future release:
    • Call and include links might get created to and from the same file depending on the syntax used. This is by design and will be changed in a future release. For example:

    • The analysis log may contain warnings such as "Unable to find the regexp for the link" for files. These can be ignored and will be fixed in a future release.

Function Point, Quality and Sizing support

This extension provides the following support:

  • Function Points (transactions): a green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
  • Quality and Sizing: a green tick indicates that CAST can measure size and that a minimum set of Quality Rules exist
Function Points
(transactions)
Quality and Sizing
(tick)(tick)

CAST AIP compatibility 

CAST recommends that you always install the latest release of an extension.

7.3.x

8.0.x8.1.x8.2.x
(error)(tick)(tick)(tick)

Supported DBMS servers

DBMSSupported?
CSS(tick)
Oracle(tick)
Microsoft SQL Server(error)

Supported Versions of PHP

This version of the PHP extension provides partial support for the following PHP versions:

  • 5.x

Licence Agreements

In order to provide a better solution and therefore increase the number of quality rules, the PHP configuration uses other external tools, such as:

PHP_CodeSniffer

More information about this tool is available here: http://pear.php.net/package/PHP_CodeSniffer

Version

CAST ships version 2.5.0 of the PHP_CodeSniffer.

License

The licence agreement for the PHP_CodeSniffer tool is available here:

and is detailed below:

Copyright (c) 2012, Squiz Pty Ltd (ABN 77 084 670 600)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • 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.
  • Neither the name of Squiz Pty Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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 OWNER 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.

Quality Rules calculated by the PHP Code Sniffer tool

1007022Avoid FOR loops which can be simplified to a WHILE loop (PHP)
1007024Avoid incrementer jumbling in loops (PHP)
1007026Avoid using identical type operators rather than EQUAL operators (PHP)
1007028Avoid using increment/decrement operator (PHP)
1007030Avoid using empty statement (PHP)
1007032Avoid empty class definition (PHP)
1007034Avoid empty style definition (PHP)
1007036Avoid classes having too many children (PHP)
1007038Avoid classes having too many dependencies (PHP)
1007040Avoid classes having too many parents (PHP)
1007046Avoid Classes and Interfaces with a High Depth of Inheritance Tree (PHP)
1007056Avoid unnecessary final modifiers inside final Classes (PHP)
1007058Avoid unused Function parameters (PHP)
1007080Avoid Classes not having the same name as the file  (PHP)
1007084Avoid uppercase keywords for control structures in Sections(PHP)
1007086Avoid uppercase keywords for control structures in Functions and Methods(PHP)
1007088Avoid having variable with a too short name (PHP)
1007090Avoid having variable with a too long  name (PHP)
1007096Avoid ELSEIF statements. ELSE and IF should be separate (PHP)
1007116Avoid Methods with Object Instantiation in loops (PHP)
1007124Avoid empty catch blocks (PHP)
1007126Avoid Functions throwing exceptions and not having a @Throws tag (PHP)
1007128Avoid classes exceeding maximum length (PHP)
1007130Avoid methods having too many  parameters (PHP)
1007132Avoid methods having lenght exceeding the maximum (PHP)
1007134Avoid  classes with too many fields (PHP)
1007136Avoid classes with too many methods (PHP)
1007138Avoid classes having a  number of public methods and attributs exceeds maximum (PHP)
1007140Avoid having unused variables (PHP)
1007142Avoid unused private fields (PHP)
1007144Avoid unused private  methods (PHP)
1007146Avoid classes exceeding number of weighted methods (PHP)
1007148Avoid unconditional IF and ELSEIF statements (PHP)
1007150Avoid useless overriding Methods (PHP)
1007152Avoid unassigned default values in Functions (PHP)
1007156Avoid using a goto statements (PHP)
1007158Avoid using eval expressions (PHP)
1007160Avoid using exit expressions (PHP)
1007212Avoid having variables without naming conventions (PHP)
1007226Avoid having For-loops that use a function call in the test expression (PHP)
1007228Avoid having control structures without proper spacing in the open and close brace - PSR2 (PHP)
1007230Avoid Having control structures without proper switch case declarations (PSR2) (PHP)
1007232Avoid having variables passed by reference when calling a function (PHP)
1007234Avoid having inline control statements (PHP)
1007236Avoid having multiple classes defined in a single file - Symfony STD (PHP)
1007238Avoid having class methods without scope modifiers - Symfony STD (PHP)
1007240Avoid having object not instantiated using parenthesis - Symfony STD (PHP)

PHPMD

More information about this tool is available here: http://phpmd.org/

The licence agreement for the PHPMD tool is available available in the file "LICENSE.txt" delivered in the source folder of the tool and is detailed below:

Copyright (c) 2009-2011, Manuel Pichler <mapi@phpmd.org>.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • 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.
  • Neither the name of Manuel Pichler nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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 OWNER 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.

PHP Depend

More information about this tool is available here: http://pdepend.org/

The licence agreement for the PHP Depend tool is available in the file "LICENSE.txt" delivered in the source folder of the tool and is detailed below:

Copyright (c) 2008-2012, Manuel Pichler <mapi@pdepend.org>.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • 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.
  • Neither the name of Manuel Pichler nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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 OWNER 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.

Documentation of PHP Quality Rules and Metrics

Documentation of all CAST Metrics and Quality Rules specific to the PHP extension is delivered via a compiled HTML Help file (CHM). Please ensure that once the CHM has been downloaded you right-click on the CHM file in Windows Explorer and choose Properties > Unblock. This will ensure that the CHM is readable on your own PC:

VersionCHM
1.1.0Download CHM