PHP Classes

File: phpcf-src/test/expected/trait.php

Recommend this page to a friend!
  Packages of Alex Krash   PHP Code formatter   phpcf-src/test/expected/trait.php   Download  
File: phpcf-src/test/expected/trait.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP Code formatter
Reformat PHP code according to standard options
Author: By
Last change:
Date: 12 years ago
Size: 582 bytes
 

 

Contents

Class file image Download
<?php
trait SampleTrait
{
    /**
     * @var int this is trait variable
     */
    protected $trait_variable = 1;

    public function test($a, $b)
    {
        $b = 10; // test
    }
}

trait TraitTwo {}

trait TraitThree
{
    public function test($a, $b)
    {
        $b = 20;
    }
}

class Impl
{
    use SampleTrait, TraitTwo;
}

class ImplConflict
{
    use SampleTrait, TraitThree {}
}

class ImplResolved
{
    use SampleTrait, TraitThree
    {
        TraitThree::test insteadof SampleTrait;
        SampleTrait::test as testNew;
        test as private test;
    }
}