Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforced properties and methods to be all static.
- Loading branch information
Guilherme Blanco
committed
Dec 1, 2014
1 parent
f222edd
commit 5e90b58
Showing
6 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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 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,18 @@ | ||
--TEST-- | ||
Check if final abstract classes enforces static methods | ||
--SKIPIF-- | ||
<?php if (version_compare(zend_version(), '2.4.0', '<=')) die('skip ZendEngine 2.4 or later needed'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
final abstract class A | ||
{ | ||
public function display($name) | ||
{ | ||
echo "Hello $name\n"; | ||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Class %s contains non-static method (%s) and therefore cannot be declared 'abstract final' in %s on line %d |
This file contains 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,15 @@ | ||
--TEST-- | ||
Check if final abstract classes enforces static properties | ||
--SKIPIF-- | ||
<?php if (version_compare(zend_version(), '2.4.0', '<=')) die('skip ZendEngine 2.4 or later needed'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
final abstract class A | ||
{ | ||
public $foo = 'bar'; | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Class %s contains non-static property declaration and therefore cannot be declared 'abstract final' in %s on line %d |
This file contains 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,15 @@ | ||
--TEST-- | ||
Check if final abstract classes prevents abstract static methods | ||
--SKIPIF-- | ||
<?php if (version_compare(zend_version(), '2.4.0', '<=')) die('skip ZendEngine 2.4 or later needed'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
final abstract class A | ||
{ | ||
public static abstract function display($name); | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Class %s contains abstract static method (%s) and therefore cannot be declared 'abstract final' in %s on line %d |
This file contains 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