Skip to content
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

[2.0] feat: Add global SDK #680

Merged
merged 4 commits into from
Oct 29, 2018
Merged

[2.0] feat: Add global SDK #680

merged 4 commits into from
Oct 29, 2018

Conversation

HazAT
Copy link
Member

@HazAT HazAT commented Oct 29, 2018

This PR add the "global" SDK to the SDK 🙃
Which means it should enable stuff like:

init(["dsn" => "DSN"]);

captureMessage("test");

Internally it uses a Hub, Scope and Client to make everything work.

@HazAT HazAT self-assigned this Oct 29, 2018
Makefile Outdated
@@ -18,10 +18,10 @@ cs-fix:
vendor/bin/php-cs-fixer fix --config=.php_cs

phpstan:
vendor/bin/phpstan analyse
vendor/bin/phpstan analyse src tests -c phpstan.neon -l 7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those settings are hard-coded in the configuration, they are not needed.

composer.json Outdated
"psr-4" : {
"Sentry\\" : "src/"
}
},
"autoload-dev": {
"files": ["src/Sdk.php"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't add it twice to the autoloader, the previous one is always used.

composer.json Outdated
"psr-4" : {
"Sentry\\" : "src/"
}
},
"autoload-dev": {
"files": ["src/Sdk.php"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"files": ["src/Sdk.php"],

@@ -119,7 +119,7 @@ public function getMiddlewares();
/**
* Gets the instance of the client built using the configured options.
*
* @return ClientInterface
* @return Client
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the interface for extendability.

Suggested change
* @return Client
* @return ClientInterface

*/
public function getClient();
public function getClient(): Client;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function getClient(): Client;
public function getClient(): ClientInterface;

src/Sdk.php Show resolved Hide resolved
@@ -34,6 +34,13 @@
/**
* Constructor.
*
* @var Hub
*/
public static $currentHub;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static $currentHub;
private static $currentHub;

@Jean85 Jean85 added this to the Release 2.0 milestone Oct 29, 2018
@HazAT HazAT changed the title [WIP] [2.0] feat: Add global SDK [2.0] feat: Add global SDK Oct 29, 2018
@ste93cry ste93cry self-requested a review October 29, 2018 13:34
@HazAT
Copy link
Member Author

HazAT commented Oct 29, 2018

I will merge this now, tests work besides the http bug #681

@HazAT HazAT merged commit 3e9272e into 2.0 Oct 29, 2018
@HazAT HazAT deleted the feat/global-sdk branch October 29, 2018 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants