Skip to content

Larastan Updates #26

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PHPStan

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none

- uses: "ramsey/composer-install@v2"

- name: Install composer dependencies (need autoloader built)
run: |
composer install --no-scripts

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"require-dev": {
"laravel/pint": "^1.5",
"nunomaduro/collision": "^6.4",
"nunomaduro/larastan": "^2.4.1",
"larastan/larastan": "^2.4.1",
"orchestra/testbench": "^7.22",
"pestphp/pest": "^1.22",
"pestphp/pest-plugin-laravel": "^1.1",
Expand Down
189 changes: 94 additions & 95 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 2
paths:
- src/
3 changes: 2 additions & 1 deletion src/Api/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace STS\HubSpot\Api;

use Illuminate\Support\Arr;
use STS\HubSpot\Api\Interfaces\ModelInterface;

class Collection extends \Illuminate\Support\Collection
class Collection extends \Illuminate\Support\Collection implements ModelInterface
{
protected array $response = [];
protected int $total = 0;
Expand Down
8 changes: 8 additions & 0 deletions src/Api/Interfaces/ModelInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace STS\HubSpot\Api\Interfaces;

interface ModelInterface
{
public function __construct(array $properties = []);
}
7 changes: 5 additions & 2 deletions src/Api/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
use Illuminate\Support\Traits\Macroable;
use STS\HubSpot\Api\Concerns\HasAssociations;
use STS\HubSpot\Api\Concerns\HasPropertyDefinitions;
use STS\HubSpot\Api\Interfaces\ModelInterface;
use STS\HubSpot\Crm\Owner;
use STS\HubSpot\Crm\Property;
use STS\HubSpot\Facades\HubSpot;

/**
* @property-read Collection $definitions
* @property-read int $id
* @method array properties()
*/
abstract class Model
abstract class Model implements ModelInterface
{
use ForwardsCalls, Macroable, HasAssociations, HasPropertyDefinitions;

Expand Down Expand Up @@ -62,7 +65,7 @@ public function __construct(array $properties = [])
$this->fill($properties);
}

public static function hydrate(array $payload = []): static
public static function hydrate(array $payload = []): self
{
$instance = new static;
$instance->init($payload);
Expand Down