GithubHelp home page GithubHelp logo

b2b-api-php's People

Contributors

4irik avatar eldario avatar evgen14 avatar gomzyakov avatar tarampampam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

b2b-api-php's Issues

Update PHPStan

When we run phpstan analyze, we looked a message:

⚠️  You're running a really old version of PHPStan.️

The last release in the 0.12.x series with new features
and bugfixes was released on September 12th 2021,
that's 582 days ago.

Since then more than 67 new PHPStan versions were released
with hundreds of new features, bugfixes, and other
quality of life improvements.

To learn about what you're missing out on, check out
this blog with articles about the latest major releases:
https://phpstan.org/blog

Upgrade today to PHPStan 1.8 or newer by using
"phpstan/phpstan": "^1.8" in your composer.json.

Fix namespaces in Unit-tests

Сейчас в некоторых unit-тест-классах (остальные тесты, в целом, не проверял) встречаются namespace-строки типа:

namespace Avtocod\B2BApi\Tests;

Штормина справедливо светится на них, должно быть:

namespace Avtocod\B2BApi\Tests\Unit;

С ходу несколько таких файлов:

  • tests/Unit/ClientTest.php
  • tests/Unit/DateTimeFactoryTest
  • tests/Unit/SettingsTest

Replace `new static` with `new self` or finalize classes

PHPStan errors:

 ------ ------------------------------------------------------- 
  103    Unsafe usage of new static().                          
         💡 Consider making the class or the constructor final.  
 ------ ------------------------------------------------------- 

 ------ ------------------------------------------------------- 
  Line   Responses/UserResponse.php                             
 ------ ------------------------------------------------------- 
  91     Unsafe usage of new static().                          
         💡 Consider making the class or the constructor final.  
 ------ ------------------------------------------------------- 

Now disabled:

parameters:
  # ...
  ignoreErrors:
    - # Replacing with `return new self` or classes finalization requires major version upping. Make it on next major release
      message: '#Unsafe usage of new static\(\)#'
      paths:
        - src/Responses/*Response.php
        - src/Responses/Entities/*.php
        - src/Exceptions/*Exception.php

We must replace new static with new self or finalize classes in new major version (v4.x)

Proposal to change the method `userReportMake`

Is your feature request related to a problem?

Сейчас в сигнатуре метода userReportMake (ClientInterface) 8 параметров. С учётом PR #14 будет девять, что овер-многовато.

Describe the solution you'd like

Все необязательные параметры условно можно поделить на две группы -- те, которые попадут в $request_body['options'] и те, которые попадут непосредственно в $request_body:

$request_body = [
    'queryType'    => $type,
    'query'        => $value,
    'options'      => <дополнительные параметры в options>
    'foo_параметр' => <доп. параметр непосредственно в request_body>
];

К options-параметрам относятся:

    ?array $options = [],
    ?bool $is_force = false,
    ?string $on_update = null,
    ?string $on_complete = null,

К параметрам попадающим в $request_body -- $data и, если PR #14 будет принят, $idempotence_key.

Не уверен на счёт последней парочки ($data & $idempotence_key), но 4 options-параметра явно напрашиваются на объединение в некий param-объект.

Предлагаю в будущих мажерных (сломается обратная совместимость) версиях b2b-api-php сигнатуру метода userReportMake заменить на что-нибудь типа:

public function userReportMake(
    string $report_type_uid,
    string $type,
    string $value,
    ?BodyParams $body_params,
    ?OptionalParams $optional_params,
): UserReportMakeResponse

Remove dependency from guzzle http client

The new guzzle http client supports the PSR http client interface. It would be great to remove the dependency from the require block to the suggest block in composer and just use the PSR interface.

Floating bug in `ClientTest` on CI

Describe the bug

Floating bug in ClientTest on CI (PHP 7.4, maybe not only):

> @php ./vendor/bin/phpunit --coverage-html='./coverage/html' --testsuite=Unit
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

.........F.....................................................  63 / 105 ( 60%)
..........................................                      105 / 105 (100%)

Time: 1.46 seconds, Memory: 16.00 MB

There was 1 failure:

1) Avtocod\B2BApi\Tests\Unit\ClientTest::testDoRequestFireEventsOnSuccess
Failed asserting that 6 matches expected 0.

/home/runner/work/b2b-api-php/b2b-api-php/tests/Unit/ClientTest.php:325
/home/runner/work/b2b-api-php/b2b-api-php/src/Client.php:384
/home/runner/work/b2b-api-php/b2b-api-php/src/Client.php:384
/home/runner/work/b2b-api-php/b2b-api-php/src/Client.php:356
/home/runner/work/b2b-api-php/b2b-api-php/src/Client.php:92
/home/runner/work/b2b-api-php/b2b-api-php/tests/Unit/ClientTest.php:332

FAILURES!
Tests: 105, Assertions: 919, Failures: 1.

Steps to reproduce the behavior:

You can see here:
https://github.com/avtocod/b2b-api-php/pull/18/checks?check_run_id=1230816870

How do I get an account for your API?

If you have any questions feel free to ask

Can you explain how I get an account for your API?, is there a contact email address? Or is there a registration form?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.