feat: phpcs, psr12 rules and fixes

This commit is contained in:
2024-08-15 03:58:10 +03:00
parent 8089a5c0dd
commit f5b868f5f4
6 changed files with 103 additions and 7 deletions

View File

@@ -12,5 +12,8 @@
"psr-4": {
"Ivuorinen\\BusinessDataFetcher\\": "src/"
}
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.10"
}
}

85
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1651a96cd6f414d8650851a68e3cf096",
"content-hash": "db4a711b51fc33460388a38b09cee0ad",
"packages": [
{
"name": "guzzlehttp/guzzle",
@@ -667,7 +667,88 @@
"time": "2024-04-18T09:32:20+00:00"
}
],
"packages-dev": [],
"packages-dev": [
{
"name": "squizlabs/php_codesniffer",
"version": "3.10.2",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017",
"reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4"
},
"bin": [
"bin/phpcbf",
"bin/phpcs"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "Former lead"
},
{
"name": "Juliette Reinders Folmer",
"role": "Current lead"
},
{
"name": "Contributors",
"homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards",
"static analysis"
],
"support": {
"issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues",
"security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy",
"source": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
"wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki"
},
"funding": [
{
"url": "https://github.com/PHPCSStandards",
"type": "github"
},
{
"url": "https://github.com/jrfnl",
"type": "github"
},
{
"url": "https://opencollective.com/php_codesniffer",
"type": "open_collective"
}
],
"time": "2024-07-21T23:26:44+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],

View File

@@ -1,10 +1,10 @@
<?php
require_once 'vendor/autoload.php';
require_once "vendor/autoload.php";
$client = new Ivuorinen\BusinessDataFetcher\BusinessDataFetcher();
try {
$results = $client->getBusinessInformation('1639413-9');
$results = $client->getBusinessInformation("1639413-9");
print_r($results);
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
var_dump($e);

8
phpcs.xml Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>PSR12</description>
<rule ref="PSR12">
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<exclude name="PSR12.Operators.OperatorSpacing"/>
</rule>
</ruleset>

View File

@@ -2,4 +2,6 @@
namespace Ivuorinen\BusinessDataFetcher\Exceptions;
class ApiResponseErrorException extends \Exception {}
class ApiResponseErrorException extends \Exception
{
}

View File

@@ -2,4 +2,6 @@
namespace Ivuorinen\BusinessDataFetcher\Exceptions;
class UnexpectedValueException extends \Exception {}
class UnexpectedValueException extends \Exception
{
}