- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 50
Add true and false as PseudoTypes #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            14 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      2503785
              
                Add true and false as PseudoTypes
              
              
                mvriel 8d29b5d
              
                Correct issues in tests
              
              
                mvriel b59ba30
              
                Position return type : correctly
              
              
                mvriel 229d114
              
                Fix linting issues
              
              
                mvriel d88bf46
              
                Merge branch 'master' of github.com:phpDocumentor/TypeResolver into a…
              
              
                mvriel 5d82f79
              
                Added immutable annotations
              
              
                mvriel 316ba16
              
                Add test for Boolean type too
              
              
                mvriel ee677e3
              
                Merge branch '1.x' of github.com:phpDocumentor/TypeResolver into add-…
              
              
                mvriel a883b34
              
                Retarget to 1.x and fix conflicts
              
              
                mvriel ca84e5b
              
                Fix linting and pre-commit test
              
              
                mvriel 65b3070
              
                Support deprecated FQSENs for BC
              
              
                mvriel 069ab05
              
                Fix styling issues
              
              
                mvriel 068f4b3
              
                Disable phpcs sniff for BC compat
              
              
                mvriel c5c9889
              
                Add extra check for BC
              
              
                jaapio File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?php | ||
|  | ||
| declare(strict_types=1); | ||
|  | ||
| /** | ||
| * This file is part of phpDocumentor. | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| * | ||
| * @link http://phpdoc.org | ||
| */ | ||
|  | ||
| namespace phpDocumentor\Reflection; | ||
|  | ||
| interface PseudoType extends Type | ||
| { | ||
| public function underlyingType() : Type; | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|  | ||
| declare(strict_types=1); | ||
|  | ||
| /** | ||
| * This file is part of phpDocumentor. | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| * | ||
| * @link https://phpdoc.org | ||
| */ | ||
|  | ||
| namespace phpDocumentor\Reflection\PseudoTypes; | ||
|  | ||
| use phpDocumentor\Reflection\PseudoType; | ||
| use phpDocumentor\Reflection\Type; | ||
| use phpDocumentor\Reflection\Types\Boolean; | ||
| use function class_alias; | ||
|  | ||
| /** | ||
| * Value Object representing the PseudoType 'False', which is a Boolean type. | ||
| * | ||
| * @psalm-immutable | ||
| */ | ||
| final class False_ extends Boolean implements PseudoType | ||
| { | ||
| public function underlyingType() : Type | ||
| { | ||
| return new Boolean(); | ||
| } | ||
|  | ||
| public function __toString() : string | ||
| { | ||
| return 'false'; | ||
| } | ||
| } | ||
|  | ||
| class_alias('\phpDocumentor\Reflection\PseudoTypes\False_', 'phpDocumentor\Reflection\Types\False_', false); | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|  | ||
| declare(strict_types=1); | ||
|  | ||
| /** | ||
| * This file is part of phpDocumentor. | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| * | ||
| * @link https://phpdoc.org | ||
| */ | ||
|  | ||
| namespace phpDocumentor\Reflection\PseudoTypes; | ||
|  | ||
| use phpDocumentor\Reflection\PseudoType; | ||
| use phpDocumentor\Reflection\Type; | ||
| use phpDocumentor\Reflection\Types\Boolean; | ||
| use function class_alias; | ||
|  | ||
| /** | ||
| * Value Object representing the PseudoType 'False', which is a Boolean type. | ||
| * | ||
| * @psalm-immutable | ||
| */ | ||
| final class True_ extends Boolean implements PseudoType | ||
|         
                  mvriel marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| { | ||
| public function underlyingType() : Type | ||
| { | ||
| return new Boolean(); | ||
| } | ||
|  | ||
| public function __toString() : string | ||
| { | ||
| return 'true'; | ||
| } | ||
| } | ||
|  | ||
| class_alias('\phpDocumentor\Reflection\PseudoTypes\True_', 'phpDocumentor\Reflection\Types\True_', false); | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              This file was deleted.
      
      Oops, something went wrong.
      
    
  This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <?php | ||
|  | ||
| declare(strict_types=1); | ||
|  | ||
| /** | ||
| * This file is part of phpDocumentor. | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| * | ||
| * @link http://phpdoc.org | ||
| */ | ||
|  | ||
| namespace phpDocumentor\Reflection\PseudoTypes; | ||
|  | ||
| use phpDocumentor\Reflection\Types\Boolean; | ||
| use PHPUnit\Framework\TestCase; | ||
|  | ||
| /** | ||
| * @coversDefaultClass \phpDocumentor\Reflection\PseudoTypes\False_ | ||
| */ | ||
| final class FalseTest extends TestCase | ||
| { | ||
| /** | ||
| * @covers ::underlyingType | ||
| */ | ||
| public function testExposesUnderlyingType() : void | ||
| { | ||
| $false = new False_(); | ||
|  | ||
| $this->assertInstanceOf(Boolean::class, $false->underlyingType()); | ||
| } | ||
|  | ||
| /** | ||
| * @covers ::__toString | ||
| */ | ||
| public function testFalseStringifyCorrectly() : void | ||
| { | ||
| $false = new False_(); | ||
|  | ||
| $this->assertSame('false', (string) $false); | ||
| } | ||
|  | ||
| /** | ||
| * @covers \phpDocumentor\Reflection\PseudoTypes\False_ | ||
| */ | ||
| public function testCanBeInstantiatedUsingDeprecatedFqsen() : void | ||
| { | ||
| $false = new \phpDocumentor\Reflection\Types\False_(); | ||
|  | ||
| $this->assertSame('false', (string) $false); | ||
| $this->assertInstanceOf(False_::class, $false); | ||
| $this->assertInstanceOf(\phpDocumentor\Reflection\Types\False_::class, $false); | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <?php | ||
|  | ||
| declare(strict_types=1); | ||
|  | ||
| /** | ||
| * This file is part of phpDocumentor. | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| * | ||
| * @link http://phpdoc.org | ||
| */ | ||
|  | ||
| namespace phpDocumentor\Reflection\PseudoTypes; | ||
|  | ||
| use phpDocumentor\Reflection\Types\Boolean; | ||
| use PHPUnit\Framework\TestCase; | ||
|  | ||
| /** | ||
| * @coversDefaultClass \phpDocumentor\Reflection\PseudoTypes\True_ | ||
| */ | ||
| class TrueTest extends TestCase | ||
| { | ||
| /** | ||
| * @covers ::underlyingType | ||
| */ | ||
| public function testExposesUnderlyingType() : void | ||
| { | ||
| $true = new True_(); | ||
|  | ||
| $this->assertInstanceOf(Boolean::class, $true->underlyingType()); | ||
| } | ||
|  | ||
| /** | ||
| * @covers ::__toString | ||
| */ | ||
| public function testTrueStringifyCorrectly() : void | ||
| { | ||
| $true = new True_(); | ||
|  | ||
| $this->assertSame('true', (string) $true); | ||
| } | ||
|  | ||
| /** | ||
| * @covers \phpDocumentor\Reflection\PseudoTypes\True_ | ||
| */ | ||
| public function testCanBeInstantiatedUsingDeprecatedFqsen() : void | ||
| { | ||
| $true = new \phpDocumentor\Reflection\Types\True_(); | ||
|  | ||
| $this->assertSame('true', (string) $true); | ||
| $this->assertInstanceOf(True_::class, $true); | ||
| $this->assertInstanceOf(\phpDocumentor\Reflection\Types\True_::class, $true); | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?php | ||
|  | ||
| declare(strict_types=1); | ||
|  | ||
| /** | ||
| * This file is part of phpDocumentor. | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| * | ||
| * @link http://phpdoc.org | ||
| */ | ||
|  | ||
| namespace phpDocumentor\Reflection\Types; | ||
|  | ||
| use PHPUnit\Framework\TestCase; | ||
|  | ||
| /** | ||
| * @coversDefaultClass \phpDocumentor\Reflection\Types\Boolean | ||
| */ | ||
| final class BooleanTest extends TestCase | ||
| { | ||
| /** | ||
| * @covers ::__toString | ||
| */ | ||
| public function testBooleanStringifyCorrectly() : void | ||
| { | ||
| $type = new Boolean(); | ||
|  | ||
| $this->assertSame('bool', (string) $type); | ||
| } | ||
| } | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.