Changeset 942

Show
Ignore:
Timestamp:
09/25/07 23:29:11 (1 year ago)
Author:
mikey
Message:

finished reflection type

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/rdbms/persistence/stubPersistenceHelper.php

    r928 r942  
    9090            } 
    9191             
    92             switch (strtolower($returnType)) { 
     92            switch ($returnType->value()) { 
    9393                case 'int': 
    94                 case 'integer': 
    9594                    $column->setType('INT'); 
    9695                    $column->setSize(10); 
    9796                    break; 
    9897                 
    99                 case 'double': 
    10098                case 'float': 
    10199                    $column->setType('FLOAT'); 
     
    104102                 
    105103                case 'bool': 
    106                 case 'boolean': 
    107104                    $column->setType('TINYINT'); 
    108105                    $column->setSize(1); 
  • trunk/src/main/php/net/stubbles/reflection/reflection.php

    r698 r942  
    1818                      'net.stubbles.reflection.stubReflectionPackage', 
    1919                      'net.stubbles.reflection.stubReflectionParameter', 
    20                       'net.stubbles.reflection.stubReflectionProperty' 
     20                      'net.stubbles.reflection.stubReflectionPrimitive', 
     21                      'net.stubbles.reflection.stubReflectionProperty', 
     22                      'net.stubbles.reflection.stubReflectionType' 
    2123); 
    2224?> 
  • trunk/src/main/php/net/stubbles/reflection/stubReflectionFunction.php

    r901 r942  
    99 */ 
    1010stubClassLoader::load('net.stubbles.reflection.annotations.stubAnnotationFactory', 
    11                       'net.stubbles.reflection.stubReflectionParameter' 
     11                      'net.stubbles.reflection.stubReflectionClass', 
     12                      'net.stubbles.reflection.stubReflectionParameter', 
     13                      'net.stubbles.reflection.stubReflectionPrimitive' 
    1214); 
    1315/** 
     
    119121     * returns information about the return type of a function 
    120122     *  
    121      * If the return type is a known class the return value is an instance of 
    122      * stubReflectionClass, if it is a scalar type or an unknown class the 
    123      * return value is a string and if the function does not have a return value 
    124      * this method returns null. 
     123     * If the return type is a class the return value is an instance of 
     124     * stubReflectionClass (if the class is unknown a 
     125     * stubClassNotFoundException will be thrown), if it is a scalar type the 
     126     * return value is an instance of stubReflectionPrimitive, and if the 
     127     * method does not have a return value this method returns null. 
    125128     * Please be aware that this is guessing from the doc block with which the 
    126129     * function is documented. If the doc block is missing or incorrect the 
     
    128131     * hints for return values in PHP itself. 
    129132     * 
    130      * @return  string|stubReflectionClass 
     133     * @return  stubReflectionType 
    131134     */ 
    132135    public function getReturnType() 
     
    139142        $returnParts = explode(' ', trim(str_replace('@return', '', $returnPart))); 
    140143        $returnType  = trim($returnParts[0]); 
    141         if (class_exists($returnType, false) === true) { 
     144        try { 
     145            return stubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType); 
     146        } catch (stubIllegalArgumentException $iae) { 
    142147            return new stubReflectionClass($returnType); 
    143148        } 
    144          
    145         return $returnType; 
    146149    } 
    147150} 
  • trunk/src/main/php/net/stubbles/reflection/stubReflectionMethod.php

    r900 r942  
    1010stubClassLoader::load('net.stubbles.reflection.annotations.stubAnnotationFactory', 
    1111                      'net.stubbles.reflection.stubReflectionClass', 
    12                       'net.stubbles.reflection.stubReflectionParameter' 
     12                      'net.stubbles.reflection.stubReflectionParameter', 
     13                      'net.stubbles.reflection.stubReflectionPrimitive' 
    1314); 
    1415/** 
     
    140141     * returns information about the return type of a method 
    141142     *  
    142      * If the return type is a known class the return value is an instance of 
    143      * stubReflectionClass, if it is a scalar type or an unknown class the 
    144      * return value is a string and if the method does not have a return value 
    145      * this method returns null. 
     143     * If the return type is a class the return value is an instance of 
     144     * stubReflectionClass (if the class is unknown a 
     145     * stubClassNotFoundException will be thrown), if it is a scalar type the 
     146     * return value is an instance of stubReflectionPrimitive, and if the 
     147     * method does not have a return value this method returns null. 
    146148     * Please be aware that this is guessing from the doc block with which the 
    147149     * method is documented. If the doc block is missing or incorrect the return 
     
    149151     * return values in PHP itself. 
    150152     * 
    151      * @return  string|stubReflectionClass 
     153     * @return  stubReflectionType 
    152154     */ 
    153155    public function getReturnType() 
     
    160162        $returnParts = explode(' ', trim(str_replace('@return', '', $returnPart))); 
    161163        $returnType  = trim($returnParts[0]); 
    162         if (class_exists($returnType, false) === true) { 
     164        try { 
     165            return stubReflectionPrimitive::forName(new ReflectionClass('stubReflectionPrimitive'), $returnType); 
     166        } catch (stubIllegalArgumentException $iae) { 
    163167            return new stubReflectionClass($returnType); 
    164168        } 
    165          
    166         return $returnType; 
    167169    } 
    168170}