-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/rotexsoft/versatile-collections/issues/12.
Enabling strict typing and proper type hints for php 7.2+
- Loading branch information
1 parent
db2ae4f
commit d16c6c8
Showing
33 changed files
with
212 additions
and
154 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
declare(strict_types=1); | ||
namespace VersatileCollections; | ||
|
||
/** | ||
|
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 |
---|---|---|
@@ -1,46 +1,47 @@ | ||
<?php | ||
namespace VersatileCollections; | ||
|
||
/** | ||
* Description of CallablesCollection | ||
* | ||
* Below is a list of acceptable value(s), that could be comma separated, | ||
* for the @used-for tag in phpdoc blocks for public methods in this class: | ||
* | ||
* - accessing-or-extracting-keys-or-items | ||
* - adding-items | ||
* - adding-methods-at-runtime | ||
* - checking-keys-presence | ||
* - checking-items-presence | ||
* - creating-new-collections | ||
* - deleting-items | ||
* - finding-or-searching-for-items | ||
* - getting-collection-meta-data | ||
* - iteration | ||
* - mathematical-operations | ||
* - modifying-keys | ||
* - modifying-items | ||
* - ordering-or-sorting-items | ||
* - other-operations | ||
* | ||
* @author aadegbam | ||
*/ | ||
class CallablesCollection implements \VersatileCollections\StrictlyTypedCollectionInterface { | ||
|
||
use StrictlyTypedCollectionInterfaceImplementationTrait; | ||
|
||
public function __construct(callable ...$callables) { | ||
|
||
$this->versatile_collections_items = $callables; | ||
} | ||
|
||
public function checkType($item) { | ||
|
||
return is_callable($item); | ||
} | ||
|
||
public function getType() { | ||
|
||
return 'callable'; | ||
} | ||
} | ||
<?php | ||
declare(strict_types=1); | ||
namespace VersatileCollections; | ||
|
||
/** | ||
* Description of CallablesCollection | ||
* | ||
* Below is a list of acceptable value(s), that could be comma separated, | ||
* for the @used-for tag in phpdoc blocks for public methods in this class: | ||
* | ||
* - accessing-or-extracting-keys-or-items | ||
* - adding-items | ||
* - adding-methods-at-runtime | ||
* - checking-keys-presence | ||
* - checking-items-presence | ||
* - creating-new-collections | ||
* - deleting-items | ||
* - finding-or-searching-for-items | ||
* - getting-collection-meta-data | ||
* - iteration | ||
* - mathematical-operations | ||
* - modifying-keys | ||
* - modifying-items | ||
* - ordering-or-sorting-items | ||
* - other-operations | ||
* | ||
* @author aadegbam | ||
*/ | ||
class CallablesCollection implements \VersatileCollections\StrictlyTypedCollectionInterface { | ||
|
||
use StrictlyTypedCollectionInterfaceImplementationTrait; | ||
|
||
public function __construct(callable ...$callables) { | ||
|
||
$this->versatile_collections_items = $callables; | ||
} | ||
|
||
public function checkType($item) { | ||
|
||
return is_callable($item); | ||
} | ||
|
||
public function getType() { | ||
|
||
return 'callable'; | ||
} | ||
} |
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
Oops, something went wrong.