mirror of
https://github.com/php/php-src.git
synced 2024-10-17 14:32:37 +00:00
7357867bac
# This is the first attempt to implement the properties as discussed on the mailinglist. # RFC is not updated to reflect this changes, yet.
40 lines
989 B
PHP
40 lines
989 B
PHP
--TEST--
|
|
Potentially conflicting properties should result in a strict notice. Property use is discorage for traits that are supposed to enable maintainable code reuse. Accessor methods are the language supported idiom for this.
|
|
--FILE--
|
|
<?php
|
|
error_reporting(E_ALL);
|
|
|
|
trait THello1 {
|
|
private $foo;
|
|
}
|
|
|
|
trait THello2 {
|
|
private $foo;
|
|
}
|
|
|
|
echo "PRE-CLASS-GUARD-TraitsTest\n";
|
|
|
|
class TraitsTest {
|
|
use THello1;
|
|
use THello2;
|
|
}
|
|
|
|
error_reporting(E_ALL | E_STRICT);
|
|
|
|
echo "PRE-CLASS-GUARD-TraitsTest2\n";
|
|
|
|
class TraitsTest2 {
|
|
use THello1;
|
|
use THello2;
|
|
}
|
|
|
|
var_dump(property_exists('TraitsTest', 'foo'));
|
|
var_dump(property_exists('TraitsTest2', 'foo'));
|
|
?>
|
|
--EXPECTF--
|
|
PRE-CLASS-GUARD-TraitsTest
|
|
PRE-CLASS-GUARD-TraitsTest2
|
|
|
|
Strict Standards: THello1 and THello2 define the same property ($foo) in the composition of TraitsTest2. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in %s on line %d
|
|
bool(true)
|
|
bool(true)
|