-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Upgrade to PHP7 strict mode #169
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
Closed
eddiejaoude
wants to merge
26
commits into
DesignPatternsPHP:master
from
eddiejaoude:php7-strict-mode
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
991a10f
Update ignore to ignore vagrant files
eddiejaoude 5df676e
composer phar added to gitignore
eddiejaoude 8f70b11
vagrant & ansible scripts added inc docs in README
eddiejaoude 60a93e2
Link to vagrant docs added to README
eddiejaoude f158b2c
project path in VM added to README
eddiejaoude f34535f
Upgraded to PHP7 with ansible
eddiejaoude ed7d158
Decorator TypeHint test not needed
eddiejaoude 9fc16e8
FactoryMethod updated to PHP7 strict mode
eddiejaoude 75703be
CI config for PHP7 only as not BC
eddiejaoude 3b9097f
StaticFactory updated to PHP7 strict mode
eddiejaoude 10a6ede
Strict type declaration for FactoryMethod Design Pattern
eddiejaoude 5919e86
Strict type declaration for StaticFactory Design Pattern
eddiejaoude dff806b
Singleton updated to PHP7 strict mode
eddiejaoude 8752405
Updated docblocs for FactoryMethod Design Pattern
eddiejaoude 69ecb73
Factory Method Tests docbloc updated
eddiejaoude dc38323
Static Factory Design Pattern Docbloc updated
eddiejaoude 579caab
Singleton Docblocs updated
eddiejaoude 4441ceb
Static Factory Test in strict mode
eddiejaoude a0991d1
Singleton Test in strict mode
eddiejaoude 90ddc4d
Factory Method type confusion fixed in test
eddiejaoude 8bf65ff
Prototype Design Pattern upgraded to PHP7
eddiejaoude 18a3d07
SimpleFactory upgraded to PHP7 strict mode
eddiejaoude 2437040
Removed phpunit output from README
eddiejaoude 313876f
Removed php5-fpm ansible handler
eddiejaoude 2afbb34
Removed commented out code for php5-fpm
eddiejaoude 5397832
Removed Pear & Pecl from Ansible scripts
eddiejaoude 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ | |
/vendor/ | ||
_build/ | ||
*.mo | ||
.vagrant/ | ||
phpunit.xml | ||
composer.phar |
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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace DesignPatterns\Creational\FactoryMethod; | ||
|
||
/** | ||
* class FactoryMethod | ||
* Class FactoryMethod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here too and for every class the same |
||
* @package DesignPatterns\Creational\FactoryMethod | ||
*/ | ||
abstract class FactoryMethod | ||
{ | ||
|
||
/** @var int */ | ||
const CHEAP = 1; | ||
|
||
/** @var int */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. definitely |
||
const FAST = 2; | ||
|
||
/** | ||
* The children of the class must implement this method | ||
* | ||
* Sometimes this method can be public to get "raw" object | ||
* | ||
* @param string $type a generic type | ||
* | ||
* @return VehicleInterface a new vehicle | ||
*/ | ||
abstract protected function createVehicle($type); | ||
/** @var array */ | ||
public static $typeTexts = [ | ||
1 => 'Cheap', | ||
2 => 'Fast', | ||
]; | ||
|
||
/** | ||
* Creates a new vehicle | ||
|
@@ -29,11 +28,22 @@ abstract protected function createVehicle($type); | |
* | ||
* @return VehicleInterface a new vehicle | ||
*/ | ||
public function create($type) | ||
public function create(int $type) : VehicleInterface | ||
{ | ||
$obj = $this->createVehicle($type); | ||
$obj->setColor("#f00"); | ||
|
||
return $obj; | ||
} | ||
|
||
/** | ||
* The children of the class must implement this method | ||
* | ||
* Sometimes this method can be public to get "raw" object | ||
* | ||
* @param int $type a generic type | ||
* | ||
* @return VehicleInterface a new vehicle | ||
*/ | ||
abstract protected function createVehicle(int $type) : VehicleInterface; | ||
} |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type of comments is non sens. Why do you have to write
Class Bicycle
when is clearly that you define this class 3 lines below ?