Skip to content

Commit

Permalink
Merge pull request #7 from Yproximite/symfony-compatibility
Browse files Browse the repository at this point in the history
Symfony compatibility
  • Loading branch information
gordalina committed Aug 12, 2020
2 parents 2d7b801 + 43a9a4d commit 9fa0670
Show file tree
Hide file tree
Showing 46 changed files with 4,639 additions and 570 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/bin/
/vendor/
composer.lock
vendor/
bin/*
.php_cs.cache
28 changes: 28 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('var')
;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => true
],
'no_unreachable_default_argument_value' => false,
'braces' => [
'allow_single_line_closure' => true,
],
'heredoc_to_nowdoc' => false,
'phpdoc_summary' => false,
'declare_strict_types' => true,
])
->setFinder($finder)
;
62 changes: 62 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
dist: bionic

language: php

cache:
directories:
- vendor
- ~/.composer/cache/files

env:
global:
- COMPOSER_MEMORY_LIMIT=-1

matrix:
fast_finish: true
include:
# Minimum supported dependencies with the latest and oldest PHP version
- php: 7.2
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
- php: 7.3
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
- php: 7.4
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"

# Test the latest stable release
- php: 7.2
- php: 7.3
- php: 7.4

# Test specific Symfony versions
- php: 7.4
env: SYMFONY_VERSION="4.4.11" # LTS
- php: 7.4
env: SYMFONY_VERSION="4.*" # Last 4.x version
- php: 7.4
env: SYMFONY_VERSION="5.*" # Last 5.x version

# Latest commit to master
- php: 7.4
env: STABILITY="dev"

allow_failures:
# Dev-master is allowed to fail.
- env: STABILITY="dev"
- env: SYMFONY_VERSION="5.*"

before_install:
- phpenv config-rm xdebug.ini
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
- composer require --no-update symfony/flex ${DEPENDENCIES}
- if ! [ -z "$SYMFONY_VERSION" ]; then composer config extra.symfony.require "${SYMFONY_VERSION}"; fi;

before_script:
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
- composer install --no-interaction --prefer-dist

install:
- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction

script:
- bin/php-cs-fixer fix --verbose --diff --dry-run Mixpanel/
- bin/phpspec run -f dot -n
2 changes: 2 additions & 0 deletions Annotation/Annotation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down
6 changes: 4 additions & 2 deletions Annotation/Append.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down Expand Up @@ -34,12 +36,12 @@ final class Append extends Annotation
/**
* @Required
*
* @var integer
* @var int
*/
public $value;

/**
* @var boolean
* @var bool
*/
public $ignoreTime;
}
4 changes: 3 additions & 1 deletion Annotation/ClearCharges.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand All @@ -25,7 +27,7 @@ final class ClearCharges extends Annotation
public $id;

/**
* @var boolean
* @var bool
*/
public $ignoreTime;
}
4 changes: 3 additions & 1 deletion Annotation/DeleteUser.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand All @@ -25,7 +27,7 @@ final class DeleteUser extends Annotation
public $id;

/**
* @var boolean
* @var bool
*/
public $ignoreTime;
}
2 changes: 2 additions & 0 deletions Annotation/Expression.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down
2 changes: 2 additions & 0 deletions Annotation/Id.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down
6 changes: 4 additions & 2 deletions Annotation/Increment.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down Expand Up @@ -34,12 +36,12 @@ final class Increment extends Annotation
/**
* @Required
*
* @var integer
* @var int
*/
public $value;

/**
* @var boolean
* @var bool
*/
public $ignoreTime;
}
2 changes: 2 additions & 0 deletions Annotation/Register.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down
4 changes: 3 additions & 1 deletion Annotation/Remove.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down Expand Up @@ -32,7 +34,7 @@ final class Remove extends Annotation
public $props;

/**
* @var boolean
* @var bool
*/
public $ignoreTime;
}
4 changes: 3 additions & 1 deletion Annotation/Set.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down Expand Up @@ -32,7 +34,7 @@ final class Set extends Annotation
public $props;

/**
* @var boolean
* @var bool
*/
public $ignoreTime;
}
4 changes: 3 additions & 1 deletion Annotation/SetOnce.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down Expand Up @@ -32,7 +34,7 @@ final class SetOnce extends Annotation
public $props;

/**
* @var boolean
* @var bool
*/
public $ignoreTime;
}
2 changes: 2 additions & 0 deletions Annotation/Track.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down
4 changes: 3 additions & 1 deletion Annotation/TrackCharge.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down Expand Up @@ -32,7 +34,7 @@ final class TrackCharge extends Annotation
public $amount;

/**
* @var boolean
* @var bool
*/
public $ignoreTime;
}
2 changes: 2 additions & 0 deletions Annotation/Unregister.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down
2 changes: 2 additions & 0 deletions Annotation/UpdateUser.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the mixpanel bundle.
*
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### v3.0

- Changed autoload from PSR-0 to PSR-4
- v3 now supports Symfony 4.4+ and Symfony 5.0+
- Uses version ~2.8 of `mixpanel/mixpanel-php`
- Using the autowiring
- Remove compatibility with old Symfony versions not maintained
- Setting up Travis + Php-cs Fixer
- Add ``auto_update_user`` parameter in order to send user data on each request
- Add ``enable`` parameter in order to enable/disable send data to Mixpanel
- Add ``extra_data`` config to send more user data
- Create ``MixpanelEvent`` if you want to send data without annotation
- Be able to use ``Expression`` in props
```php
* @Mixpanel\Track("Order Completed", props={
* "user": @Mixpanel\Expression("user.getId()")
* })
```
- Some fixes (event name, getId not exist, ...)
- Update Readme

Loading

0 comments on commit 9fa0670

Please sign in to comment.